NAME
Bio::SearchIO::blast - Event generator for event based parsing of blast reports
SYNOPSIS
# Do not use this object directly - it is used as part of the
# Bio::SearchIO system.
my
$searchio
= Bio::SearchIO->new(
-format
=>
'blast'
,
-file
=>
't/data/ecolitst.bls'
);
while
(
my
$result
=
$searchio
->next_result ) {
while
(
my
$hit
=
$result
->next_hit ) {
while
(
my
$hsp
=
$hit
->next_hsp ) {
# ...
}
}
}
DESCRIPTION
This object encapsulated the necessary methods for generating events suitable for building Bio::Search objects from a BLAST report file. Read the Bio::SearchIO for more information about how to use this.
This driver can parse:
NCBI produced plain text BLAST reports from blastall, this also includes PSIBLAST, PSITBLASTN, RPSBLAST, and bl2seq reports. NCBI XML BLAST output is parsed with the blastxml SearchIO driver
WU-BLAST all reports
Jim Kent's BLAST-like output from his programs (BLASTZ, BLAT)
BLAST-like output from Paracel BTK output
bl2seq parsing
Since I cannot differentiate between BLASTX and TBLASTN since bl2seq doesn't report the algorithm used - I assume it is BLASTX by default - you can supply the program type with -report_type in the SearchIO constructor i.e.
my
$parser
= Bio::SearchIO->new(
-format
=>
'blast'
,
-file
=>
'bl2seq.tblastn.report'
,
-report_type
=>
'tblastn'
);
This only really affects where the frame and strand information are put - they will always be on the $hsp->query instead of on the $hsp->hit part of the feature pair for blastx and tblastn bl2seq produced reports. Hope that's clear...
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
bioperl-l
@bioperl
.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:
AUTHOR - Jason Stajich
Email Jason Stajich jason-at-bioperl.org
CONTRIBUTORS
Steve Chervitz sac-at-bioperl.org
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : new
Usage :
my
$obj
= Bio::SearchIO::blast->new(
%args
);
Function: Builds a new Bio::SearchIO::blast object
Returns : Bio::SearchIO::blast
Args : Key-value pairs:
-fh/
-file
=> filehandle/filename to BLAST file
-format
=>
'blast'
-report_type
=>
'blastx'
,
'tblastn'
, etc -- only
for
bl2seq
reports
when
you want to distinguish between
tblastn and blastx reports (this only controls
where the frame information is put - on the query
or subject object.
-inclusion_threshold
=> e-value threshold
for
inclusion in the
PSI-BLAST score matrix model (blastpgp)
-signif
=> float or scientific notation number to be used
as a P- or Expect value cutoff
-score
=> integer or scientific notation number to be used
as a blast score value cutoff
-bits
=> integer or scientific notation number to be used
as a bit score value cutoff
-hit_filter
=> reference to a function to be used
for
filtering hits based on arbitrary criteria.
All hits of
each
BLAST report must satisfy
this criteria to be retained.
If a hit fails this test, it is ignored.
This function should take a
Bio::Search::Hit::BlastHit.pm object as its first
argument and
return
true
if
the hit should be retained.
Sample filter function:
-hit_filter
=>
sub
{
$hit
=
shift
;
$hit
->gaps == 0; },
(Note: -filt_func is synonymous
with
-hit_filter)
-overlap
=> integer. The amount of overlap to permit between
adjacent HSPs
when
tiling HSPs. A reasonable value is 2.
Default =
$Bio::SearchIO::blast::MAX_HSP_OVERLAP
.
The following criteria are not yet supported:
(these are probably best applied within this module rather than in the
event handler since they would permit the parser to take some shortcuts.)
-check_all_hits
=> boolean. Check all hits
for
significance against
significance criteria. Default = false.
If false, stops processing hits
after
the first
non-significant hit or the first hit that fails
the hit_filter call. This speeds parsing,
taking advantage of the fact that the hits
are processed in the order they appear in the report.
-min_query_len
=> integer to be used as a minimum
for
query sequence
length
.
Reports
with
query sequences below this
length
will
not be processed. Default =
no
minimum
length
.
-best
=> boolean. Only process the best hit of
each
report;
default
= false.
next_result
Title : next_result
Usage :
my
$hit
=
$searchio
->next_result;
Function: Returns the
next
Result from a search
Returns : Bio::Search::Result::ResultI object
Args : none
_will_handle
Title : _will_handle
if
(
$self
->_will_handle(
$type
) ) { ... }
Function: Provides an optimized way to check whether or not an element of a
given
type is to be handled.
Returns : Reference to EventHandler object
if
the element type is to be handled.
undef
if
the element type is not to be handled.
Args : string containing type of element.
Optimizations:
Using the cached pointer to the EventHandler to minimize repeated lookups.
Caching the will_handle status for each type that is encountered so that it only need be checked by calling handler->will_handle($type) once.
This does not lead to a major savings by itself (only 5-10%). In combination with other optimizations, or for large parse jobs, the savings good be significant.
To test against the unoptimized version, remove the parentheses from around the third term in the ternary " ? : " operator and add two calls to $self->_eventHandler().
start_element
Title : start_element
Usage :
$eventgenerator
->start_element
Function: Handles a start element event
Returns : none
Args : hashref
with
at least 2
keys
'Data'
and
'Name'
end_element
Title : end_element
Usage :
$eventgenerator
->end_element
Function: Handles an end element event
Returns : hashref
with
an element's worth of data
Args : hashref
with
at least 2
keys
'Data'
and
'Name'
element
Title : element
Usage :
$eventhandler
->element({
'Name'
=>
$name
,
'Data'
=>
$str
});
Function: Convenience method that calls start_element, characters, end_element
Returns : none
Args : Hash
ref
with
the
keys
'Name'
and
'Data'
characters
Title : characters
Usage :
$eventgenerator
->characters(
$str
)
Function: Send a character events
Returns : none
Args : string
within_element
Title : within_element
Usage :
if
(
$eventgenerator
->within_element(
$element
) ) {}
Function: Test
if
we are within a particular element
This is different than
'in'
because within can be tested
for
a whole block.
Returns : boolean
Args : string element name
See Also: in_element
in_element
Title : in_element
Usage :
if
(
$eventgenerator
->in_element(
$element
) ) {}
Function: Test
if
we are in a particular element
This is different than
'within_element'
because within
can be tested
for
a whole block.
Returns : boolean
Args : string element name
See Also: within_element
start_document
Title : start_document
Usage :
$eventgenerator
->start_document
Function: Handle a start document event
Returns : none
Args : none
end_document
Title : end_document
Usage :
$eventgenerator
->end_document
Function: Handles an end document event
Returns : Bio::Search::Result::ResultI object
Args : none
inclusion_threshold
Title : inclusion_threshold
Usage :
my
$incl_thresh
=
$isreb
->inclusion_threshold;
:
$isreb
->inclusion_threshold(1e-5);
Function: Get/Set the e-value threshold
for
inclusion in the PSI-BLAST
score matrix model (blastpgp) that was used
for
generating the reports
being parsed.
Returns : number (real)
Default value:
$Bio::SearchIO::IteratedSearchResultEventBuilder::DEFAULT_INCLUSION_THRESHOLD
Args : number (real) (e.g., 0.0001 or 1e-4 )
max_significance
Usage :
$obj
->max_significance();
Purpose : Set/Get the P or Expect value used as significance screening cutoff.
This is the value of the -signif parameter supplied to new().
Hits
with
P or E-value above this are skipped.
Returns : Scientific notation number
with
this
format
: 1.0e-05.
Argument : Scientific notation number or float (
when
setting)
Comments : Screening of significant hits uses the data provided on the
: description line. For NCBI BLAST1 and WU-BLAST, this data
: is P-value.
for
NCBI BLAST2 it is an Expect value.
signif
Synonym for max_significance()
min_score
Usage :
$obj
->min_score();
Purpose : Set/Get the Blast score used as screening cutoff.
This is the value of the -score parameter supplied to new().
Hits
with
scores below this are skipped.
Returns : Integer or scientific notation number.
Argument : Integer or scientific notation number (
when
setting)
Comments : Screening of significant hits uses the data provided on the
: description line.
min_query_length
Usage :
$obj
->min_query_length();
Purpose : Gets the query sequence
length
used as screening criteria.
This is the value of the -min_query_len parameter supplied to new().
Hits
with
sequence
length
below this are skipped.
Returns : Integer
Argument : n/a
best_hit_only
Title : best_hit_only
Usage :
"only getting best hit.\n"
if
$obj
->best_hit_only;
Purpose : Set/Get the indicator
for
whether or not to process only
: the best BlastHit.
Returns : Boolean (1 | 0)
Argument : Boolean (1 | 0) (
when
setting)
check_all_hits
Title : check_all_hits
Usage :
"checking all hits.\n"
if
$obj
->check_all_hits;
Purpose : Set/Get the indicator
for
whether or not to process all hits.
: If false, the parser will stop processing hits
after
the
: the first non-significance hit or the first hit that fails
: any hit filter.
Returns : Boolean (1 | 0)
Argument : Boolean (1 | 0) (
when
setting)