Simple code example to retrieve annotations
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Carp;
5 use Bio::SeqIO;
6
7 my $embl_file = shift;
8 my $informat = "embl";
9
10 my $seq_in = Bio::SeqIO -> new(-file => "<$embl_file",
11 -format => $informat)
12 or croak("File Open Error: $embl_file\n");
13
14 while (my $seq = $seq_in->next_seq) {
15
16
17 # ID
18 $seq->primary_seq->display_id();
19 # AC
20 $seq->primary_seq->accession_number();
21
22 # DE
23 $seq->primary_seq->desc();
24
25 # CC
26 my $annotation = $seq->annotation();
27 my @comments = $annotation->get_Annotations('comment');
28 foreach my $comment (@comments){
29 print $comment->as_text;
30 }
31
32
33 print "\n";
34 }
35
36 $seq_in->close() or croak("Close error: $embl_file\n");
Leave a Reply