[Bioperl-l] Problem to extract protein_id and transcript from CDS
Marc Logghe
Marc.Logghe at ablynx.com
Tue Jan 15 14:44:54 UTC 2008
Hi,
Try testing for existence first using the has_tag() method.
It is provided by Bio::AnnotatableI.
print OUT $feat_object->get_tag_values('protein_id')," " if
($feat->has_tag('protein_id'));
HTH,
Marc
> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of Diogo Tschoeke
> Sent: dinsdag 15 januari 2008 14:40
> To: Bioperl-list
> Subject: [Bioperl-l] Problem to extract protein_id and transcript from
CDS
>
> Hello,
>
> I want to extract protein_id and transcript from a CDS tag, from
genome in
> genbak format but i have one problem, when the sequence in the file
don't
> have the protein_id or the transcript the script gives me this error:
>
> ------------- EXCEPTION -------------
> MSG: asking for tag value that does not exist protein_id
> STACK Bio::SeqFeature::Generic::get_tag_values
> /usr/share/perl5/Bio/SeqFeature/Generic.pm:504
> STACK toplevel parser_cds.pl:25
> --------------------------------------
>
> Bellow I past the script
>
> ##############################################
> use Bio::SeqIO;
> use warnings;
>
> my $infile = $ARGV[0];
> my $outfile = "$infile.out";
> open (OUT, ">>$outfile");
>
> my $seq_in = Bio::SeqIO->new('-file' => "<$infile",
> '-format' => 'Genbank');
>
> while (my $inseq = $seq_in->next_seq) {
>
> for my $feat_object ($inseq->get_SeqFeatures){
> if ($feat_object->primary_tag eq "CDS"){
> print OUT $feat_object->get_tag_values('protein_id'),"
";
> print OUT
$feat_object->get_tag_values('translation'),"\n";
> }
> }
> }
> ###############################################
>
> Somebody can helps me?
>
> Thank
>
> Diogo Tschoeke
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list