[Bioperl-l] getting the Sbjct database from a hit

Hilmar Lapp hlapp@gmx.net
Sat, 07 Oct 2000 18:03:25 +0200

Catherine Letondal wrote:
> Hi,
> I have a script that extracts sequences from a blast report which doesn't work
> anymore. The sequences were extracted giving the name of the subject database and its
> AC. There is a change apparently, since with the last bioperl version this doesn't work
> anymore :
>     foreach $hit ($blast->hits) {
>         $db = $hit->database;
>     }
> What is the new way to do this (there is apparently a Bio::Tools::Blast::Sbjct
> which has the ->database method, but I don't know how to create from - what's is
> this @hitdata in the doc. example (http://bioperl.org/Core/POD//Bio/Tools/Blast/Sbjct.html):
>     require Bio::Tools::Blast::Sbjct;
>     $hit = new Bio::Tools::Blast::Sbjct (-DATA    =>\@hitData,
>                                          -PARENT  =>$self,
>                                          -NAME    =>5,
>                                          -RANK    =>5,
>                                          -RANK_BY =>'order',
>                                          -MAKE    =>'query' (or 'sbjct'),
>                                          -OVERLAP =>2,
>                                          -PROGRAM =>'TBLASTN'
>                                          );

First, usually you don't create Sbjct objects yourself, but obtain them
from a Bio::Tools::Blast object created from a BLAST report. As you're
writing this first, I assume that's in fact what you're doing.

I'm not sure what you're referring to with the database() method. If you
want to get the name of the database the sequence was searched against,
you can simply call $blast->database(). To obtain the database containing
the hit (i.e., the database part of the identifier for those cases in
which the identifier is a compound of database and accession) you have to
interpret $hit->name() yourself, as the documentation tells.
$hit->database() will only return a dash ('-').

Hope this helps.


Hilmar Lapp                                email: hlapp@gmx.net
NFI Vienna, IFD/Bioinformatics             phone: +43 1 86634 631
A-1235 Vienna                                fax: +43 1 86634 727