Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl script for extracting gene information from gff file
by kcott (Archbishop) on Jun 07, 2017 at 07:50 UTC | |
by Anonymous Monk on Jun 09, 2017 at 00:45 UTC | |
|
Re: perl script for extracting gene information from gff file
by huck (Prior) on Jun 07, 2017 at 03:00 UTC | |
by Anonymous Monk on Jun 07, 2017 at 07:39 UTC | |
|
Re: perl script for extracting gene information from gff file
by hippo (Archbishop) on Jun 07, 2017 at 09:14 UTC | |
by Anonymous Monk on Jun 09, 2017 at 00:51 UTC |