[Bioperl-l] Odd problem with get_tag_values

Adlai Burman adlai at refenestration.com
Fri Feb 24 16:27:19 EST 2012


P.S. In case anyone is interested (and I hope they are), here is an example of one record that fails here and one that doesn't:

NC_015820 parses and NC_012927 fails. Unlike what I said earlier, some of the good ones have exons and some of the crashers don't.

On Feb 24, 2012, at 10:03 PM, Brian Osborne wrote:

> Adlai,
> 
> You are absolutely sure that every single CDS feature has a "gene" tag inside it?
> 
> If this is not the case then you have to use the "if ($cds_feature->has_tag("gene")) …" type of logic.
> 
> Brian O.
> 
> On Feb 24, 2012, at 3:43 PM, Adlai Burman wrote:
> 
>> I have come across a perplexing problem with trying to parse sequence features into hashes from gb records. This is the minimal code which shows my problem:
>> 
>> #!/usr/bin/perl                                                                                                     
>> use strict;
>> use warnings;
>> use IO::String;
>> use Bio::Perl;
>> use Bio::SeqIO;
>> use IO::String;
>> 
>> my @files = </Users/adlai/Dropbox/atrsh/*>;
>> foreach my $file(@files){
>> 
>> 
>> my @cds_features = grep {$_->primary_tag eq 'CDS' } Bio::SeqIO->new(-file => $file)->next_seq->get_SeqFeatures;
>> my %strands = map {$_->get_tag_values('gene'), $_->strand} @cds_features; ##This Is The Culprit. 
>> .
>> .
>> .
>> #do nifty stuff
>> }
>> 
>> For some files this approach works just fine.
>> For others the script dies immediately with the error message:
>> 
>> ------------- EXCEPTION -------------
>> MSG: asking for tag value that does not exist gene
>> STACK Bio::SeqFeature::Generic::get_tag_values /Users/adlai/Downloads/BioPerl-1.6.1/Bio/SeqFeature/Generic.pm:517
>> STACK toplevel tosend.pl:16
>> -------------------------------------
>> 
>> The difference in the files that parse and those that don't seems to be that the files that crash have "intron" and "exon" tags. They ALL have "gene" tags.
>> Does anyone know why this is a problem and what can be done to circumvent it?
>> 
>> Thanks,
>> Adlai
>> 
>> 
>> _______________________________________________
>> 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