[Bioperl-l] Extracting a particular feature from a sequence

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Thu May 19 10:11:57 EDT 2005


Hi

Sorry if this documentation exists, but if it does I haven't been able
to find it.

I want to find a feature with a particular tag=value pairing in a
sequence file.  The Feature and Annotation HOWTO suggests a combination
of grep and get_SeqFeatures:

my @cds_features = grep { $_->primary_tag eq 'CDS' }
	Bio::SeqIO->new(-file => $gb_file)->next_seq->get_SeqFeatures;

However, if I want to examine a feature for a particular gene within a
sequence containing an entire bacterial genome, the above code is
somewhat cumbersome, having to iterate through all the features just to
find one.

Just wondering if there was a method I could use to extract just a
single feature, something really nice like:

$seq->get_SeqFeature(-primary_tag => 'CDS', -locus_tag => 'STY2701');

Thanks
Mick



More information about the Bioperl-l mailing list