File: genbank.pl

package info (click to toggle)
libboulder-perl 1.30-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 404 kB
  • ctags: 306
  • sloc: perl: 4,286; makefile: 41
file content (41 lines) | stat: -rwxr-xr-x 1,311 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl

# This requires LWP to be installed.
#use lib '.','..';

use Boulder::Genbank;
$gb = new Boulder::Genbank(-accessor=>'Entrez',-param=>[qw/M57939 M28274 L36028/]);

while (my $s = $gb->get) {
  @introns = $s->Features->Intron;
  print "There are ",scalar(@introns)," introns.\n";
  if (@introns) {
    foreach (sort {$a->Number <=> $b->Number} @introns) {
      print "Intron number ",$_->Number,":\n",
            "\tPosition = ",$_->Position,"\n",
            "\tEvidence = ",$_->Evidence,"\n";
    }
  }
  @exons = $s->Features->Exon;
  print "There are ",scalar(@exons)," exons.\n";
  if (@exons) {
    foreach (sort {$a->Number <=> $b->Number} @exons) {
      print "Exon number ",$_->Number,":\n",
            "\tPosition = ",$_->Position,"\n",
            "\tEvidence = ",$_->Evidence,"\n",
            "\tGene = ",$_->Gene,"\n";
    }
  }
  
  if ($s->Features->Polya_signal || $s->Features->Polya_site) {
    print "The first PolyA site is at ",$s->Features->Polya_signal ? 
      $s->Features->Polya_signal->Position :
      $s->Features->Polya_site->Position
	,"\n";
  }
  
  print "This sequence has the following top level tags: ",join(',',$s->tags),"\n";
  print "\n","Here's the whole thing as a table:\n";
  print $s->asTable;
  print "------------------------------------\n";
}