Assalam o alaikum everyone ,, I want to extract genes information from annotation files (gff). I have gff files of different genomes downloaded from NCBI and two txt files 1 of them contains full path of gff files and 2nd contains list of genes which information have to extract from annotation files. $ cat annotation_files_path ~/home/usr/NCBI_Mammals_genomes/Nine_banded_armadillo/ ~/home/usr/NCBI_Mammals_genomes/Noth_American_deer_mouse/

#!usr/bin/perl # # read genes into array # my @ARGV = []; my $genesFn = "Genes_list.txt"; open my $genesFh, "<", $genesFn or die "could not open genes file hand +le!\n"; while (<$genesFh>) { chomp; push @ARGV, $_; } # # write any matches between annotation line and pattern to results fil +e # my $annotationsFn = "GCF_000298275.1_OryAfe1.0_genomic.gff"; my $resultsFn = "answer.gff"; open my $annotationsFh, "<", $annotationsFn or die "could not open ann +otations file handle!\n"; open my $resultsFh, ">", $resultsFn or die "could not open handle to r +esults file!\n"; while (<$annotationsFh>) { chomp; if ($_ =~ /ACMSD/ || $_ =~ /CRYM/ || $_ =~ /ARID1B/ { print $resultsFh " $_\n"; } close $resultsFh; close $annotationsFh; close $genesFh;

I have two problems now first one is that all genes information come in a single file but i want different output file for different genes and if gene not present it should be mentioned,, and second and major problem is that i have to work on about 100 annotation files and in annotation_file_path.txt i gave complete path of all annotation files but failed to execute it because script only work when a single annotation file use as shown above otherwise it print whole annotation _file_path.txt ,,, is there any way to open each path of annotation_file.txt one by one ??? kindly guide me ??? i'm a beginner so happy to give me more info..


In reply to perl script for extracting gene information from gff file by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.