Biotech > FAQ > BioPerl FAQ (Frequently Asked Questions)

How do I retrieve all the features from a sequen...

To see other biotech frequently asked questions, please visit http://biotech.fyicenter.com/faq/

(Continued from previous question...)

How do I retrieve all the features from a sequence?

How about all the features which are exons or have a /note field that contains a certain gene name?

To get all the features:

my @features = $seq->all_SeqFeatures();

To get all the features filtering on only those which have the primary tag (ie. feature type) exon.

my @genes = grep { $_->primary_tag eq 'exon'}
$seq->all_SeqFeatures();

To get all the features filtering on this which have the /note tag and within the note field contain the requested string $noteval.

my @f_with_note = grep {  my @a = $_->has_tag('note') ? $_->each_tag_value('note') : ();
                                         grep { /$noteval/ } @a;  }  $seq->all_SeqFeatures();

(Continued on next question...)

Other Frequently Asked Questions