[Bioperl-l] using Bio::DB::GenBank get translation

Brian Osborne brian_osborne at cognia.com
Fri Dec 12 10:46:08 EST 2003


Vince,

Your code looked correct to me, I was puzzled, so I ran it and it worked.
Here's the output:

No translation
1..864
No translation
No translation
No translation
No translation
No translation

Here's the code:

use Bio::DB::GenBank;
my $gb = new Bio::DB::GenBank;
my $seq;
my $accession = shift or die "No accession\n";

$seq = $gb->get_Seq_by_acc($accession);

foreach my $feat ($seq->all_SeqFeatures){
   my $CDS = "";
   if ($feat->has_tag('translation')){
      $CDS = $feat->start."..".$feat->end;
      print "$CDS\n";
   }else{
      print "No translation\n";
   }
}

Try it with accession "AB072353", for example.

Brian O.


-----Original Message-----
From: bioperl-l-bounces at portal.open-bio.org
[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Vince Forgetta
Sent: Friday, December 12, 2003 10:13 AM
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] using Bio::DB::GenBank get translation

Hi all,

i have seen on some previous posts that you can retrieve the CDS start
and stop from a GenBank DNA sequence accessionif the file is stored
locally and read in using Bio::SeqIO. How would I retrieve the
translation start and stop of a GenBank accession downloaded using
Bio::DB::GenBank. For example, the code below does not seem to find a
tag "translation":

use Bio::DB::GenBank;
my $gb = new Bio::DB::GenBank;
my $seq;
 my $accession;
 $seq = $gb->get_Seq_by_acc($accession);
 while (not(defined($seq)));
foreach my $feat ($seq->all_SeqFeatures()){
        my $CDS = "";
        if ($feat->has_tag('translation')){
        $CDS = $feat->start."..".$feat->end;
        return "$CDS\n";
    }else{
        return "Not found\n";
    }


Thank you for your time.

_______________________________________________
Bioperl-l mailing list
Bioperl-l at portal.open-bio.org
http://portal.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list