Created
February 14, 2019 11:23
-
-
Save toniher/0692c6f1476b2aa8448c838cd557928e to your computer and use it in GitHub Desktop.
Handy parse of GFF files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# List of IDs - one per line | |
my $list = shift; | |
# File with potential IDs, it can be GFF but also othersH | |
my $gff = shift; | |
my @ids; | |
open( LIST, $list ) || die "Cannot open $list"; | |
while( <LIST> ) { | |
my ($id) = $_=~/^(\S+)/; | |
push( @ids, $id ); | |
} | |
close( LIST ); | |
foreach my $id ( @ids ) { | |
my $geneid = $id; | |
$geneid=~s/P\d+\s*$//g; | |
open (GFF, $gff ); | |
while( <GFF> ) { | |
if ( $_=~$geneid ) { | |
print; | |
} | |
} | |
close( GFF ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment