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

Vince Forgetta vince.forgetta at staff.mcgill.ca
Fri Dec 12 10:54:00 EST 2003


I figured out the problem. Call it a sematic lapse in perl coding, but 
my code below returns a result and exits on the first failure of finding 
a tag that has translation !! Doh !! Sorry for the bother, and thanks 
for the help.

Vince

Brian Osborne wrote:

>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
>
>
>
>  
>


-- 
+-----------------------------------------------------------+
|  Vincenzo Forgetta                                        |
|  Computational Biology                                    |
|  McGill University and Genome Quebec Innovation Centre    |
|  740 Dr. Penfield Avenue                                  |
|  Room 7211                                                |
|  Montreal, Quebec Canada, H3A 1A4                         |
|  Tel: 514-398-3311 00476                                  |
|  Email: vince.forgetta at staff.mcgill.ca                    |
+-----------------------------------------------------------+





More information about the Bioperl-l mailing list