[Bioperl-l] Extracting GenBank Information

Leonardo Marino-Ramirez marino at tofu.tamu.edu
Tue Aug 5 09:14:42 EDT 2003


Hi Michael,

What you want to do is get features for the genbank objects and extract
them as follows:

use Bio::DB::GenBank;

my $gb     = new Bio::DB::GenBank();

my $seq    = $gb->get_Seq_by_acc('AF308740.1');
my $desc   = $seq->desc();
my $length = $seq->length();
my $id     = $seq->primary_id();

print "GI: $id\tDESC: $desc\tLEN: $length bp\n";

my @features = $seq->all_SeqFeatures();
## Your favorite tags can be collected here
my @cds      = grep { $_->primary_tag eq 'CDS' } $seq->get_SeqFeatures();

foreach my $feature (@features) {
    my $primary_tag = $feature->primary_tag();
    my $start       = $feature->start();
    my $end         = $feature->end();
    my $strand      = $feature->strand();
    print "$primary_tag\t$start\t$end\t$strand\n";

    foreach my $each_tag ($feature->get_all_tags()) {
        my @tag_values = $feature->each_tag_value($each_tag);
        print "\t$each_tag\t at tag_values\n";
    }
}

foreach my $feature (@cds) {
    my $primary_tag = $feature->primary_tag();
    my $protein     = $feature->seq->translate->subseq(1,10);
    print "\n$primary_tag\t$protein\n";
}

Regards, Leonardo


On Tue, 5 Aug 2003, Michael Hughes wrote:

>
>  Hello
>
>  I am writing a code to extract mouse inbred strain information from
> GenBank.
>
>  Using get_Seq_by_acc, I am able to bring up the GenBank file on screen but
> I can't find a way to search through this file and extract the relevant
> information.
>   I have tried saving it locally to search the output file but I can only
> output the fasta format which has no strain information (I have tried using
> $gb = new Bio::DB::GenBank (-format => 'genbank'); but I still receive
> fasta).
>
>   So, my questions are:
>
>         - is there a way to search the file generated on line?
>         - if not, how do I output a full GenBank file to a local folder?
>
>  Thanks in advance for any help
>
>  Michael Hughes
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

-- 
___________________________________________________
    _/
   _/                      Leonardo Marino-Ramirez
  _/    _/      _/_/_/    marino at tofu.tamu.edu
 _/    _/_/  _/_/    _/  11915 Renwood Lane
_/_/_/_/  _/  _/_/_/    Rockville, MD 20852
     _/      _/     _/ Phone: (301) 770-2388
    _/      _/     _/ http://marino-johnson.org/
___________________________________________________



More information about the Bioperl-l mailing list