annotate scripts/get_sequences_based_on_ids.pl @ 2:0d8315be76b7

Uploaded
author biomonika
date Tue, 17 Feb 2015 21:59:51 -0500
parents 05c27700e5ca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
1 use Bio::DB::Fasta;
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
2
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
3 my $fastaFile = shift;
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
4 my $queryFile = shift;
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
5
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
6 my $db = Bio::DB::Fasta->new( $fastaFile );
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
7 open (IN, $queryFile);
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
8 while (<IN>){
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
9 chomp;
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
10 $seq = $_;
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
11 my $sequence = $db->seq($seq);
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
12 if (!defined( $sequence )) {
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
13 die "Sequence $seq not found. \n"
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
14 }
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
15 print ">$seq\n", "$sequence\n";
05c27700e5ca initial commit
biomonika <biomonika@psu.edu>
parents:
diff changeset
16 }