[Bioperl-l] Error parsing genbank file

Koul, Sunita sunita at pathology.wustl.edu
Tue Aug 13 18:56:40 UTC 2013


Thanks -I added the  "has->tag" option before working on the features and it is working fine now


-----Original Message-----
From: Fields, Christopher J [mailto:cjfields at illinois.edu]
Sent: Tuesday, August 13, 2013 1:23 PM
To: Koul, Sunita
Cc: bioperl-l at lists.open-bio.org
Subject: Re: [Bioperl-l] Error parsing genbank file


On Aug 13, 2013, at 12:12 PM, "Koul, Sunita" <sunita at pathology.wustl.edu> wrote:

> All,
> I am trying to retrieve some gene information from genbank file.
> Part of the code is to ignore the pseudo genes
>
>
> if( $featobj->primary_tag eq 'gene' )
>                                             {
>                                               print "$geneID\n";
>
>
>                                                            if(scalar($featobj->get_tag_values('pseudo')) > 0)
>                                    {
>
> $pseudo{$geneID} = 1;
>
>                                                                           next;
>                                                            } }
>
> This throws me an error
>
> What is the reason for this error
>
>
>
> MSG: asking for tag value that does not exist pseudo
> STACK: Error::throw
> STACK: Bio::Root::Root::throw
> /usr/local/share/perl5/Bio/Root/Root.pm:472
> STACK: Bio::SeqFeature::Generic::get_tag_values
> /usr/local/share/perl5/Bio/SeqFeature/Generic.pm:522

As the message implies, there is no tag for 'pseudo' for the feature in question, you need to use 'if ($featobj->has_tag('pseudo'))' as a check prior to working on the feature.

Frankly, this is a stricture that I don't like (e.g. dying if the tag isn't present), but it has been in place for quite a long time.  I wouldn't be opposed to removing or making it less death-y.

> If I comment out the above code -I get another error for this part of
> the error with the message that
> MSG: asking for tag value that does not exist 'db_xref'
>
>
>                              foreach my $featobj ($seqobj->all_SeqFeatures() )
>                              {
>                                             my $geneID;
>
>                                             for my $value ($featobj->get_tag_values('db_xref'))
>      {
>               if ($value =~ /GeneID:(.*)/)
>               {
>                              $geneID = $1;
>               }
>      }
>
> Please help me understand what is wrong in this code

Same problem, you are asking for a tag in the feature that doesn't exist.

chris


The materials in this email are private and may contain Protected Health Information. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying, distribution or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return email.




More information about the Bioperl-l mailing list