[Bioperl-l] Re: pfam/swissprot domain info

Jason Stajich jason at cgt.duhs.duke.edu
Mon May 12 11:18:17 EDT 2003


$feat->each_tag_value($tag) returns an array.

However, we recommend using the method get_tag_values (each_tag_value is
just an alias for this function so no code breaks if you use it).

        Title   : get_tag_values
        Usage   : @values = $gsf->get_tag_values('note');
        Function: Returns a list of all the values stored
                  under a particular tag.
        Returns : A list of scalars
        Args    : The name of the tag


You need to do this to test what you are interested in:

foreach my $val ( $feat->each_tag_value($tag) ) {
 if( $val =~ /DOMAINNAME/ ) {
  print "print stuff here\n";
 }
}

On Sun, 11 May 2003, Douglas Kojetin wrote:

> I don't know how I figured this out on my own (well, with the help of
> the bioperl documentation, which is a bit intimidating), but here is
> the solution if anyone needs it in the future. One question though that
> I don't quite understand (it's probably just me). In the last 'if'
> statement, why do I have to use 'print' in the line?
>
> e.g.
> if (print $feat->each_tag_value($tag) =~ "/the_domain_of_interest/")
> rather than
> if ($feat->each_tag_value($tag) =~ "/the_domain_of_interest/")
>
> Same result if i assign '$feat->each_tag_value($tag)' to a variable.
>
>
>
> #####################################
> use Bio::Index::SwissProt;
> use Bio::SeqFeatureI;
>
> my $protein = "a_name";
> my $database = new Bio::DB::SwissProt;
> my $seq = $database->get_Seq_by_id($protein);
> @features = $seq->get_SeqFeatures();
> foreach $feat (@features) {
>    if ($feat->primary_tag eq "DOMAIN") {
>      foreach $tag ( $feat->all_tags() ) {
>        if (print $feat->each_tag_value($tag) =~
> "/the_domain_of_interest/") {
>          print $feat->start, "\t", $feat->end, "\n";
>        }
>      }
>    }
> }
>
>
> Thanks for humoring me!
> Doug
>
>
> > I was wondering if there is any way to extract domain information
> > either from swissprot or pfam directly. If you visit swissprot, there
> > is information included in the 'features' that includes 'domain' ...
> > 'mod_res' .. that have values for sequence length or number for the
> > respective domain or important residue.
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at bioperl.org
> http://pw600a.bioperl.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list