[Bioperl-l] accessing optional qualifiers within features?
Hilmar Lapp
hlapp@gmx.net
Sat, 11 Nov 2000 23:43:54 -0800
Samuel Aparicio wrote:
>
> Hi everyone
> I am wondering if there is a method in Bioperl which allows access to
> optional qualifiers with features in a genbank/embl entry. For example,
> being able to parse out
> the value of /note in the example below.
>
> repeat_region 1586..1760
> /note="L1M1 repeat: matches 5299..5484 of
> consensus"
>
Bio::Seq has a method all_SeqFeatures(). For every element of the returned
array (a Bio::SeqFeatureI compliant object) you can call
has_tag("tag_name") and each_tag_value("tag_name") in order to query for
existence and retrieve the values associated with a tag. So,
foreach $feat ($seq->all_SeqFeatures()) {
if(($feat->primary_tag() eq "repeat_region") &&
($feat->has_tag("note")) {
foreach $val ($feat->each_tag_value("note")) {
print "note: $val\n";
}
}
}
Hope this helps. BTW the mentioned methods are documented in the perldoc
pages of their modules (Bio::Seq and Bio::SeqFeature::Generic).
Hilmar
--
-----------------------------------------------------------------
Hilmar Lapp email: hlapp@gmx.net
GNF, San Diego, Ca. 92122 phone: +1 858 812 1757
-----------------------------------------------------------------