Privates (from "my" definitions)
%MODEMAP = ( 'Iteration' => 'result', 'Hit' => 'hit', 'Hsp' => 'hsp')
%MAPPING = ( 'BlastOutput_program' => 'RESULT-algorithm_name', 'BlastOutput_version' => 'RESULT-algorithm_version', 'BlastOutput_db' => 'RESULT-database_name', 'BlastOutput_reference' => 'RESULT-program_reference', 'BlastOutput_query-def' => 'RESULT-query_description', 'BlastOutput_query-len' => 'RESULT-query_length', 'BlastOutput_query-ID' => 'runid', 'Parameters_matrix' => { 'RESULT-parameters' => 'matrix'}, 'Parameters_expect' => { 'RESULT-parameters' => 'expect'}, 'Parameters_include' => { 'RESULT-parameters' => 'include'}, 'Parameters_sc-match' => { 'RESULT-parameters' => 'match'}, 'Parameters_sc-mismatch' => { 'RESULT-parameters' => 'mismatch'}, 'Parameters_gap-open' => { 'RESULT-parameters' => 'gapopen'}, 'Parameters_gap-extend' => { 'RESULT-parameters' => 'gapext'}, 'Parameters_filter' => {'RESULT-parameters' => 'filter'}, 'Statistics_db-num' => 'RESULT-database_entries', 'Statistics_db-len' => 'RESULT-database_letters', 'Statistics_hsp-len' => { 'RESULT-statistics' => 'hsplength'}, 'Statistics_eff-space' => { 'RESULT-statistics' => 'effectivespace'}, 'Statistics_kappa' => { 'RESULT-statistics' => 'kappa' }, 'Statistics_lambda' => { 'RESULT-statistics' => 'lambda' }, 'Statistics_entropy' => { 'RESULT-statistics' => 'entropy'}, 'Hsp_bit-score' => 'HSP-bits', 'Hsp_score' => 'HSP-score', 'Hsp_evalue' => 'HSP-evalue', 'Hsp_query-from' => 'HSP-query_start', 'Hsp_query-to' => 'HSP-query_end', 'Hsp_hit-from' => 'HSP-hit_start', 'Hsp_hit-to' => 'HSP-hit_end', 'Hsp_positive' => 'HSP-conserved', 'Hsp_identity' => 'HSP-identical', 'Hsp_gaps' => 'HSP-gaps', 'Hsp_hitgaps' => 'HSP-hit_gaps', 'Hsp_querygaps' => 'HSP-query_gaps', 'Hsp_qseq' => 'HSP-query_seq', 'Hsp_hseq' => 'HSP-hit_seq', 'Hsp_midline' => 'HSP-homology_seq', 'Hsp_align-len' => 'HSP-hsp_length', 'Hsp_query-frame'=> 'HSP-query_frame', 'Hsp_hit-frame' => 'HSP-hit_frame', 'Hit_id' => 'HIT-name', 'Hit_len' => 'HIT-length', 'Hit_accession' => 'HIT-accession', 'Hit_def' => 'HIT-description', 'Hit_num' => 'HIT-order', 'Iteration_iter-num' => 'HIT-iteration', 'Iteration_stat' => 'HIT-iteration_statistic', 'Iteration_query-def' => 'RESULT-query_description', 'Iteration_query-len' => 'RESULT-query_length', 'Iteration_query-ID' => 'runid', )
%IGNOREDTAGS = ( 'Hsp_num' => 1, 'Hsp_pattern-from' => 1, 'Hsp_pattern-to' => 1, 'Hsp_density' => 1, 'Iteration_message' => 1, 'Hit_hsps' => 1, 'BlastOutput_param' => 1, 'Iteration_hits' => 1, 'Statistics' => 1, 'Parameters' => 1, 'BlastOutput' => 1, 'BlastOutput_iterations' => 1, )
This is the XML handler for BLAST XML parsing. Currently it passes elements off
to the event handler, which is ultimately responsible for Bio::Search object
generation.
This was recently split off from the original code for Bio::SearchIO::blastxml
primarily for maintenance purposes.
sub end_element
{ my ($self,$data) = @_;
my $nm = $data->{'Name'};
my $rc;
if($nm eq 'BlastOutput_program' &&
$self->{'_last_data'} =~ /(t?blast[npx])/i ) {
$self->{'_type'} = uc $1;
}
if ($nm eq 'Iteration') {
map {
$self->{'_values'}->{$_} = $self->{'_resultdata'}->{$_};
} keys %{ $self->{'_resultdata'} };
}
if( my $type = $MODEMAP{$nm} ) {
if( $self->eventHandler->will_handle($type) ) {
my $func = sprintf("end_%s",lc $type);
$rc = $self->eventHandler->$func($self->{'_type'},
$self->{'_values'});
}
}
elsif( exists $MAPPING{$nm} ) {
if ( ref($MAPPING{$nm}) =~ /hash/i ) {
my $key = (keys %{$MAPPING{$nm}})[0];
$self->{'_values'}->{$key}->{$MAPPING{$nm}->{$key}} = $self->{'_last_data'};
} else {
$self->{'_values'}->{$MAPPING{$nm}} = $self->{'_last_data'};
}
}
elsif( exists $IGNOREDTAGS{$nm} ){
}
else {
$self->debug("ignoring unrecognized element type $nm\n");
}
$self->{'_last_data'} = '';
$self->{'_result'} = $rc if( $nm eq 'Iteration' );
if ($nm eq 'Iteration') {
$self->{'_values'} = {};
}} |
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _