[Bioperl-l] Creating and retrieving seqfeatures by name
Chad Matsalla
chad@sausage.usask.ca
Fri, 22 Feb 2002 11:48:45 -0600 (CST)
Hi All,
I would like to create SeqFeatures and retrieve them by name.
Here is some example code:
my $seq = new Bio::Seq( -seq =>
'atatatatatatatatatatatatatatatatatatatataaatatatatatatatatatata',
-primary_id => 'Chad1');
my $feature = new Bio::SeqFeature::Generic( -start => '10',
-end => '20');
$feature->attach_seq(
new Bio::PrimarySeq(-seq => $sequence,
-display_id => "Chads_kewl_feature")
);
$seq->add_SeqFeature($feature);
So, now how can I get the sequence for "Chads_kewl_feature", by name,
from $seq?
This is what I want:
my $chads_sequence = $seq->get_feature_sequence(-feature_name =>
'Chads_kewl_feature");
_or even better_
my $feature = $seq->get_feature_by_name(-name=>'Chads_kewl_feature');
This is what I was doing:
my @features = $seq->all_SeqFeatures();
foreach (@features) {
if ($_->seqname() eq "Chads_kewl_feature") {
print("Chads_kewl_feature's sequence is:\n");
print("\t ".$_->entire_seq()->seq()."\n");
}
}
Thanks for your help,
Chad Matsalla
--
"The POP3 server service depends on the SMTP server service, which
failed to start because of the following error:
The operation completed successfully."
- Windows NT Server v3.51