[Bioperl-l] Accessing /gene and /note fields in a GenBank file
Mick Watson
michaelwatson@paradigm-therapeutics.co.uk
Thu, 16 May 2002 16:15:09 +0100
To get all the "tags" in a feature table, try something like:
foreach my $feat (@features)
{
my @tags = $feat->all_tags;
foreach $tag (@tags) {
my @values = $feat->each_tag_value($tag);
}
}
If I understand you correctly, /gene and /note will be in the tags array
somewhere if they exist. I think $feat also has a has_tag($string) method (or
something similar) if you only want particular tags
Thanks
Mick
Adam Witney wrote:
> Hi, just been trying to write a GenBank parser for a GenBank file containing
> a whole genome
>
> How do I get access to the /gene and /note fields of each gene? I have this
> so far
>
> my $gbk_obj = Bio::SeqIO->new('-file' => "gbk_file",
> '-format' => 'GenBank');
>
> while (my $seq = $gbk_obj->next_seq())
> {
> my @features = $seq->all_SeqFeatures;
>
> foreach my $feat (@features)
> {
> print $feat->primary_tag."\n";
>
> print $feat->start.' - '.$feat->end."\t".$feat->strand."\n";
>
> my $seq_obj = $feat->seq;
>
> print $seq_obj->seq."\n";
>
> }
>
> Thanks
>
> adam
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l