[Bioperl-l] BioPerl Parsing problems
Jason Stajich
jason.stajich at duke.edu
Tue Dec 28 13:06:51 EST 2004
I think you want $hsp->significance() for BPlite - if you follow the
inheritance hierarchy you'll see that BPlite::HSP is-a
SeqFeature::SimilarityPair which is-a SeaFeature::Similarity which has
the significance method.
On Dec 28, 2004, at 11:59 AM, David García Cortés wrote:
> Hello.
>
> I'm trying to parse the results of a blast query, using BPLite. The
> problem is: I can't access the evalue of a HSP. For accessing the
> score, there are no problems: I only have to access the HSP's field
> "score. But... what with evalue? If I do the same using "evalue",
> there's an error: it can't find that field on the HSP.
>
> Here you can see the main part of the code:
>
> $factory = Bio::Tools::Run::StandAloneBlast->new(@pars);
> my $blst_rprt = $factory->blastall($seq);
> my $exists_results = parse_blast($blst_rprt);
>
>
> And the function parse_blast is this:
>
> sub parse_blast {
> my $blast_report = shift;
>
> while (my $result = $blast_report->nextSbjct) {
> while ( my $hsp = $result->nextHSP )
> {
> my $score = $hsp->score;
> my $evalue = $hsp->evalue;
> }
> }
>
> }
>
> A different problem (although closely related with the one above) i'd
> like to ask is this:
> I thought that maybe it'd be better to use SearchIO for the parsing,
> but then the problem is that when creating a SearchIO variable, you
> have to pass the name of the file where the blast result to parse is.
> But as you can see in the code, my blast result is in the variable
> $blst_rprt (or $blast_report), not in a file. So should I write the
> content of the $blast_report variable into a file, and pass this file
> to SearchIO? I don't like this solution; i would be grateful if you
> could give me an alternative one.
>
This is something you can ask StandAloneBlast to do for you by return a
Bio::SearchIO object provide the option
_READMETHOD => 'Blast' in @params array that you using.
This should be the default in recent releases of Bioperl (i.e. you can
only get BPlite object if you specify _READMETHOD => 'BPlite') so it
would depend on what version of Bioperl you are using.
You can also save the blast report to a file if you provide the -o =>
'filename' option in @params to write the report to a file and can then
reopen it with Bio::SearchIO.
-jason
> Thank you in advance.
>
> --
> David García Cortés
> Instituto Nacional de Bioinformática (INB)
> Nodo Computacional GNHC-2 UPC-CIRI
> c/. Jordi Girona 1-3
> Modul C6-E201 Tel. : 934 011 650
> E-08034 Barcelona Fax : 934 017 014
> Catalunya (Spain) e-mail: davidg at lsi.upc.edu
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
--
Jason Stajich
jason.stajich at duke.edu
http://www.duke.edu/~jes12/
More information about the Bioperl-l
mailing list