| Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
use Bio::Tools::BPpsilite;
open FH, "t/psiblastreport.out";
$report = Bio::Tools::BPpsilite->new(-fh=>\*FH);
# determine number of iterations executed by psiblast
$total_iterations = $report->number_of_iterations;
$last_iteration = $report->round($total_iterations);
# Process only hits found in last iteration ...
$oldhitarray_ref = $last_iteration->oldhits;
HIT: while($sbjct = $last_iteration->nextSbjct) {
$id = $sbjct->name;
$is_old = grep /\Q$id\E/, @$oldhitarray_ref;
if ($is_old ){next HIT;}
# do something with new hit...
}
$total_iterations = $report->number_of_iterations;* Results from an arbitrary iteration round can be accessed by using
$iteration3_report = $report->round(3);* The ids of the sequences which passed the significance threshold for
$oldhitarray_ref = $iteration3_report->oldhits; $newhitarray_ref = $iteration3_report->newhits;BPpsilite.pm should work equally well on reports generated by the
| new | No description | Code |
| query | Description | Code |
| qlength | Description | Code |
| database | Description | Code |
| pattern | Description | Code |
| query_pattern_location | Description | Code |
| number_of_iterations | Description | Code |
| round | Description | Code |
| _parseHeader | No description | Code |
| _preprocess | Description | Code |
| query | code | next | Top |
Title : query Usage : $query = $obj->query(); Function : returns the query object Returns : query object Args : |
| qlength | code | prev | next | Top |
Title : qlength Usage : $len = $obj->qlength(); Function : returns the length of the query Returns : length of query Args : |
| database | code | prev | next | Top |
Title : database Usage : $db = $obj->database(); Function : returns the database used in this search Returns : database used for search Args : |
| pattern | code | prev | next | Top |
Title : database Usage : $pattern = $obj->pattern(); Function : returns the pattern used in a PHIBLAST search |
| query_pattern_location | code | prev | next | Top |
Title : query_pattern_location
Usage : $qpl = $obj->query_pattern_location();
Function : returns reference to array of locations in the query sequence
of pattern used in a PHIBLAST search |
| number_of_iterations | code | prev | next | Top |
Title : number_of_iterations Usage : $total_iterations = $obj-> number_of_iterations(); Function : returns the total number of iterations used in this search Returns : total number of iterations used for search Args : none |
| round | code | prev | next | Top |
Title : round Usage : $Iteration3 = $report->round(3); Function : Method of retrieving data from a specific iteration Example : Returns : reference to requested Iteration object or null if argument is greater than total number of iterations Args : number of the requested iteration |
| _preprocess | code | prev | next | Top |
Title : _preprocess
Usage : internal routine, not called directly
Function : determines number of iterations in report and prepares
data so individual iterations canbe parsed in non-sequential
order
Example :
Returns : nothing. Sets TOTAL_ITERATION_NUMBER in object's hash
Args : reference to calling object |
| new | description | prev | next | Top |
my ($class, @args) = @_; my $self = $class->SUPER::new(@args); # initialize IO}
$self->_initialize_io(@args); $self->{'_tempdir'} = $self->tempdir('CLEANUP' => 1); $self->{'QPATLOCATION'} = []; # Anonymous array of query pattern locations for PHIBLAST
$self->{'NEXT_ITERATION_NUMBER'} = 1; $self->{'TOTAL_ITERATION_NUMBER'} = -1; # -1 indicates preprocessing not yet done
if ($self->_parseHeader) {$self->{'REPORT_DONE'} = 0} # there are alignments
else {$self->{'REPORT_DONE'} = 1} # empty report
return $self; # success - we hope!
| query | description | prev | next | Top |
shift->{'QUERY'}}
| qlength | description | prev | next | Top |
shift->{'LENGTH'}}
| database | description | prev | next | Top |
shift->{'DATABASE'}}
| pattern | description | prev | next | Top |
shift->{'PATTERN'}}
| query_pattern_location | description | prev | next | Top |
shift->{'QPATLOCATION'}}
| number_of_iterations | description | prev | next | Top |
my $self = shift; if ($self->{'TOTAL_ITERATION_NUMBER'} == -1){&_preprocess($self);} $self->{'TOTAL_ITERATION_NUMBER'};}
| round | description | prev | next | Top |
my $self = shift; my $iter_num = shift; $self->_initialize_io(-file => Bio::Root::IO->catfile ($self->{'_tempdir'},"iteration".$iter_num.".tmp")); if( ! $self->_fh ) { $self->throw("unable to re-open iteration file for round ".$iter_num); } return Bio::Tools::BPlite::Iteration->new(-round=>$iter_num, -parent=>$self);}
| _parseHeader | description | prev | next | Top |
my ($self) = @_; while(defined ($_ = $self->_readline) ) { if ($_ =~ /^Query=\s+([^\(]+)/) { my $query = $1; while(defined ($_ = $self->_readline)) { last if $_ !~ /\S/; $query .= $_; } $query =~ s/\s+/ /g; $query =~ s/^>//; $query =~ /\((\d+)\s+\S+\)\s*$/; my $length = $1; $self->{'QUERY'} = $query; $self->{'LENGTH'} = $length; } elsif ($_ =~ /^Database:\s+(.+)/) {$self->{'DATABASE'} = $1} elsif ($_ =~ /^\s*pattern\s+(\S+).*position\s+(\d+)\D/) { # For PHIBLAST reports}
$self->{'PATTERN'} = $1; push (@{$self->{'QPATLOCATION'}}, $2); } elsif ($_ =~ /^>|^Results from round 1/) { $self->_pushback($_); return 1; } elsif ($_ =~ /^Parameters|^\s+Database:/) { $self->_pushback($_); return 0; # there's nothing in the report
} }
| _preprocess | description | prev | next | Top |
my $self = shift; # $self->throw(" PSIBLAST report preprocessing not implemented yet!");}
my $oldround = 0; my ($currentline, $currentfile, $round); # open output file for data from iteration round #1
$round = 1; $currentfile = Bio::Root::IO->catfile($self->{'_tempdir'}, "iteration$round.tmp"); open (FILEHANDLE, ">$currentfile") || $self->throw("cannot open filehandle to write to file $currentfile"); while(defined ($currentline = $self->_readline()) ) { if ($currentline =~ /^Results from round\s+(\d+)/) { if ($oldround) { close (FILEHANDLE) ;} $round = $1; $currentfile = Bio::Root::IO->catfile($self->{'_tempdir'}, "iteration$round.tmp"); close FILEHANDLE; open (FILEHANDLE, ">$currentfile") || $self->throw("cannot open filehandle to write to file $currentfile"); $oldround = $round; }elsif ($currentline =~ /CONVERGED/){ # This is a fix for psiblast parsing with -m 6 /AE
$round--; } print FILEHANDLE $currentline ; } $self->{'TOTAL_ITERATION_NUMBER'}= $round; # It is necessary to close filehandle otherwise the whole
# file will not be read later !!
close FILEHANDLE;
| FEEDBACK | Top |
| Mailing Lists | Top |
bioperl-l@bioperl.org - General discussion http://bio.perl.org/MailList.html - About the mailing lists
| Reporting Bugs | Top |
bioperl-bugs@bio.perl.org http://bugzilla.bioperl.org/
| AUTHOR - Peter Schattner | Top |
| CONTRIBUTORS | Top |
| ACKNOWLEDGEMENTS | Top |
| COPYRIGHT | Top |
| DISCLAIMER | Top |