| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SearchIO::erpin | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Chris Fields <cjfields-at-uiuc-dot-edu> | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Chris Fields | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | Bio::SearchIO::erpin - SearchIO-based ERPIN parser | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # do not call this module directly. Use Bio::SearchIO. | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | This is an experimental SearchIO-based parser for output from | ||||||||||||||||||||||||||||||||||||||||||
| 25 | the erpin program. It currently parses erpin output for ERPIN | ||||||||||||||||||||||||||||||||||||||||||
| 26 | versions 4.2.5 and above; older versions may work but will not be supported. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 33 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||
| 34 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 37 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 46 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 47 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 48 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 53 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 54 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | =head1 AUTHOR - Chris Fields | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | Email cjfields-at-uiuc-dot-edu | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 65 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | package Bio::SearchIO::erpin; | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | $Bio::SearchIO::erpin::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | ▶ | use base qw(Bio::SearchIO); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | my %MODEMAP = ( | |||||||||||||||||||||||||||||||||||||||||
| 79 | 'Result' => 'result', | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 'Hit' => 'hit', | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 'Hsp' => 'hsp' | ||||||||||||||||||||||||||||||||||||||||||
| 82 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | my %MAPPING = ( | |||||||||||||||||||||||||||||||||||||||||
| 85 | 'Hsp_bit-score' => 'HSP-bits', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 'Hsp_score' => 'HSP-score', | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 'Hsp_evalue' => 'HSP-evalue', # no evalues yet | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 'Hsp_query-from' => 'HSP-query_start', | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 'Hsp_query-to' => 'HSP-query_end', | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 'Hsp_hit-from' => 'HSP-hit_start', # | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 'Hsp_hit-to' => 'HSP-hit_end', # | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 'Hsp_gaps' => 'HSP-hsp_gaps', | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 'Hsp_hitgaps' => 'HSP-hit_gaps', | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 'Hsp_querygaps' => 'HSP-query_gaps', | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 'Hsp_qseq' => 'HSP-query_seq', | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 'Hsp_hseq' => 'HSP-hit_seq', | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 'Hsp_midline' => 'HSP-homology_seq', | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 'Hsp_structure' => 'HSP-meta', | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 'Hsp_align-len' => 'HSP-hsp_length', | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 'Hsp_stranded' => 'HSP-stranded', | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | # not supported yet | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 'Hsp_positive' => 'HSP-conserved', | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 'Hsp_identity' => 'HSP-identical', | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 'Hit_id' => 'HIT-name', | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 'Hit_len' => 'HIT-length', | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 'Hit_gi' => 'HIT-ncbi_gi', | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 'Hit_accession' => 'HIT-accession', | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 'Hit_def' => 'HIT-description', | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 'Hit_signif' => 'HIT-significance', # none yet | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 'Hit_score' => 'HIT-score', # best HSP bit score | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 'Hit_bits' => 'HIT-bits', # best HSP bit score | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 'ERPIN_program' => 'RESULT-algorithm_name', # get/set | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 'ERPIN_version' => 'RESULT-algorithm_version', # get/set | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 'ERPIN_query-def'=> 'RESULT-query_name', # get/set | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 'ERPIN_query-len'=> 'RESULT-query_length', | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 'ERPIN_query-acc'=> 'RESULT-query_accession', # get/set | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 'ERPIN_querydesc'=> 'RESULT-query_description', # get/set | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 'ERPIN_db' => 'RESULT-database_name', # get/set | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 'ERPIN_db-len' => 'RESULT-database_entries', # none yet | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 'ERPIN_db-let' => 'RESULT-database_letters', # none yet | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 'Parameters_cutoff' => { 'RESULT-parameters' => 'cutoff' }, | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 'Parameters_expect' => { 'RESULT-parameters' => 'expect' }, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 'Parameters_include' => { 'RESULT-parameters' => 'include' }, | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 'Parameters_sc-match' => { 'RESULT-parameters' => 'match' }, | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 'Parameters_sc-mismatch' => { 'RESULT-parameters' => 'mismatch' }, | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 'Parameters_gap-open' => { 'RESULT-parameters' => 'gapopen' }, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 'Parameters_gap-extend' => { 'RESULT-parameters' => 'gapext' }, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 'Parameters_filter' => { 'RESULT-parameters' => 'filter' }, | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 'Parameters_allowgaps' => { 'RESULT-parameters' => 'allowgaps' }, | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 'Parameters_full_dbpath' => { 'RESULT-parameters' => 'full_dbpath' }, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 'Statistics_db-let' => { 'RESULT-statistics' => 'dbletters' }, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | my $MINSCORE = 0; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | my $DEFAULT_VERSION = '4.2.5'; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | my $DEFAULT_ALGORITHM = 'erpin'; | |||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 146 | Usage : my $obj = Bio::SearchIO::infernal->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | Function: Builds a new Bio::SearchIO::infernal object | ||||||||||||||||||||||||||||||||||||||||||
| 148 | Returns : Bio::SearchIO::infernal | ||||||||||||||||||||||||||||||||||||||||||
| 149 | Args : -fh/-file => cmsearch (infernal) filename | ||||||||||||||||||||||||||||||||||||||||||
| 150 | -format => 'erpin' | ||||||||||||||||||||||||||||||||||||||||||
| 151 | -algorithm => algorithm (default 'Infernal') | ||||||||||||||||||||||||||||||||||||||||||
| 152 | -query_acc => query accession, eg. Rfam accession (default undef) | ||||||||||||||||||||||||||||||||||||||||||
| 153 | -hsp_minscore => minimum HSP score cutoff | ||||||||||||||||||||||||||||||||||||||||||
| 154 | -version => ERPIN version (not reported in output) | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | ▶ | sub _initialize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | $self->SUPER::_initialize(@args); | |||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | my ($cutoff, $accession, $version) = | |||||||||||||||||||||||||||||||||||||||||
| 162 | $self->_rearrange([qw(HSP_MINSCORE QUERY_ACC VERSION)],@args); | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | my $handler = $self->_eventHandler; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | $handler->register_factory( | |||||||||||||||||||||||||||||||||||||||||
| 165 | 'result', | ||||||||||||||||||||||||||||||||||||||||||
| 166 | Bio::Factory::ObjectFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 167 | -type => 'Bio::Search::Result::GenericResult', | ||||||||||||||||||||||||||||||||||||||||||
| 168 | -interface => 'Bio::Search::Result::ResultI', | ||||||||||||||||||||||||||||||||||||||||||
| 169 | -verbose => $self->verbose() | ||||||||||||||||||||||||||||||||||||||||||
| 170 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 171 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | $handler->register_factory( | |||||||||||||||||||||||||||||||||||||||||
| 174 | 'hit', | ||||||||||||||||||||||||||||||||||||||||||
| 175 | Bio::Factory::ObjectFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 176 | -type => 'Bio::Search::Hit::ModelHit', | ||||||||||||||||||||||||||||||||||||||||||
| 177 | -interface => 'Bio::Search::Hit::HitI', | ||||||||||||||||||||||||||||||||||||||||||
| 178 | -verbose => $self->verbose() | ||||||||||||||||||||||||||||||||||||||||||
| 179 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 180 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | $handler->register_factory( | |||||||||||||||||||||||||||||||||||||||||
| 183 | 'hsp', | ||||||||||||||||||||||||||||||||||||||||||
| 184 | Bio::Factory::ObjectFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 185 | -type => 'Bio::Search::HSP::ModelHSP', | ||||||||||||||||||||||||||||||||||||||||||
| 186 | -interface => 'Bio::Search::HSP::HSPI', | ||||||||||||||||||||||||||||||||||||||||||
| 187 | -verbose => $self->verbose() | ||||||||||||||||||||||||||||||||||||||||||
| 188 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 189 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | ▶ | $accession && $self->query_accession($accession); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | ▶ | $cutoff ||= $MINSCORE; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$cutoff ||= $MINSCORE
MC/DC0%0/2
$cutoff ||= $MINSCORE
$cutoff
$MINSCORE
Truth table33%1/3
A ||= B
A= $cutoffB= $MINSCORE
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | $self->hsp_minscore($cutoff); | |||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | ▶ | $version ||= $DEFAULT_VERSION; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$version ||= $DEFAULT_VERSION
MC/DC0%0/2
$version ||= $DEFAULT_VERSION
$version
$DEFAULT_VERSION
Truth table33%1/3
A ||= B
A= $versionB= $DEFAULT_VERSION
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | $self->algorithm_version($version); | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | =head2 next_result | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | Title : next_result | ||||||||||||||||||||||||||||||||||||||||||
| 200 | Usage : my $hit = $searchio->next_result; | ||||||||||||||||||||||||||||||||||||||||||
| 201 | Function: Returns the next Result from a search | ||||||||||||||||||||||||||||||||||||||||||
| 202 | Returns : Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 203 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | ▶ | sub next_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_result: called CC=31 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | my $seentop = 0; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | local $/ = "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | local $_; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1 | my $accession = $self->query_accession; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 1 | my $minscore = $self->hsp_minscore; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | my $version = $self->algorithm_version; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 1 | my $verbose = $self->verbose; # cache for speed? | |||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | $self->start_document(); | |||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | my ($lasthit, $lastscore, $lastlen, $lasteval); | |||||||||||||||||||||||||||||||||||||||||
| 218 | #my $hitline; | ||||||||||||||||||||||||||||||||||||||||||
| 219 | PARSER: | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | ▶ | while ( defined( my $line = $self->_readline ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 16 | ▶ | next if $line =~ m{^\s*$}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 13 | ▶ | if ($line =~ m{^Training\sset:\s+"(.*)"}xmso) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | ▶ | if ($seentop) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $self->_pushback($line); | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | last PARSER; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 1 | $self->start_element({'Name' => 'Result'}); | |||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | $self->element_hash( { | |||||||||||||||||||||||||||||||||||||||||
| 229 | 'ERPIN_query-def' => $1, | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 'ERPIN_program' =>'erpin', | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 'ERPIN_version' => $version, | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 'ERPIN_query-acc' => $accession, | ||||||||||||||||||||||||||||||||||||||||||
| 233 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | $seentop = 1; | |||||||||||||||||||||||||||||||||||||||||
| 235 | # parse rest of header here | ||||||||||||||||||||||||||||||||||||||||||
| 236 | HEADER: | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | ▶ | while (defined ($line = $self->_readline) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 9 | ▶ | next if $line =~ m{^\s*$}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 7 | ▶ | if (index($line, '>') == 0 || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
index($line, ">") == 0 or index($line, "-------- at level 1 --------") == 0
MC/DC50%1/2
index($line, ">") == 0 or index($line, "-------- at level 1 --------") == 0
index($line, ">") == 0
index($line, "-------- at level 1 --------") == 0
Truth table66%2/3
A or B
A= index($line, ">") == 0B= index($line, "-------- at level 1 --------") == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | index($line, '-------- at level 1 --------') == 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | $self->_pushback($line); | |||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | last HEADER; | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | 6 | ▶ | if ($line =~ m{^\s+(\d+\ssequences\sof\slength\s\d+)}xmso) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | $self->element( | |||||||||||||||||||||||||||||||||||||||||
| 246 | {'Name' => 'ERPIN_querydesc', | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 'Data' => $1} | ||||||||||||||||||||||||||||||||||||||||||
| 248 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 249 | } elsif ($line =~ m{^Cutoff:\s+(\S+)}xmso) { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 1 | $self->element( | |||||||||||||||||||||||||||||||||||||||||
| 251 | {'Name' => 'Parameters_cutoff', | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 'Data' => $1} | ||||||||||||||||||||||||||||||||||||||||||
| 253 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 254 | } elsif ($line =~ m{^Database:\s+"(.*)"}xmso) { | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | $self->element( | |||||||||||||||||||||||||||||||||||||||||
| 256 | {'Name' => 'ERPIN_db', | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 'Data' => $1} | ||||||||||||||||||||||||||||||||||||||||||
| 258 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 259 | } elsif ($line =~ m{^\s+(\d+)\snucleotides\sto\sbe\sprocessed\sin\s(\d+)\ssequences}xmso) { | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->element_hash( | |||||||||||||||||||||||||||||||||||||||||
| 261 | {'ERPIN_db-len' => $2, | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 'ERPIN_db-let' => $1} | ||||||||||||||||||||||||||||||||||||||||||
| 263 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 264 | } elsif ($line =~ m{^E-value\sat\scutoff\s\S+\sfor\s\S+\sdouble\sstrand\sdata:\s+(\S+)}xmso) { | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 1 | $self->element( | |||||||||||||||||||||||||||||||||||||||||
| 266 | {'Name' => 'Parameters_expect', | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 'Data' => $1} | ||||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 269 | } elsif ($line =~ m{^\s+(ATGC\sratios:\s+(?:\S+\s+\S+\s+\S+\s+\S+))}) { | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 1 | $self->element( | |||||||||||||||||||||||||||||||||||||||||
| 271 | {'Name' => 'Statistics_db-let', | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 'Data' => $1} | ||||||||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } elsif ($line =~ m{^>(\S+)\s+(.*)}xmso ) { | ||||||||||||||||||||||||||||||||||||||||||
| 277 | 2 | my ($id, $desc) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 2 | chomp $desc; | |||||||||||||||||||||||||||||||||||||||||
| 279 | # desc line is repeated for each strand, so must check | ||||||||||||||||||||||||||||||||||||||||||
| 280 | # prior to starting a new hit | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 2 | ▶ | if (!$lasthit || $id ne $lasthit) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $lasthit or $id ne $lasthit
MC/DC50%1/2
not $lasthit or $id ne $lasthit
not $lasthit
$id ne $lasthit
Truth table66%2/3
not(A) or B
A= not $lasthitB= $id ne $lasthit
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | ▶ | if ($self->within_element('hit') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $self->element_hash({ | |||||||||||||||||||||||||||||||||||||||||
| 284 | 'Hit_signif' => $lasteval, | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 'Hit_score' => $lastscore, | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 'Hit_bits' => $lastscore | ||||||||||||||||||||||||||||||||||||||||||
| 287 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 1 | $self->start_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | my ($gi, $acc, $ver) = $self->_get_seq_identifiers($id); | |||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | ▶ | $self->element_hash({ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 'Hit_id' => $id, | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 'Hit_gi' => $gi, | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 'Hit_accession' => $ver ? "$acc.$ver" : | ||||||||||||||||||||||||||||||||||||||||||
| 297 | $acc ? $acc : $id, | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 'Hit_def' => $desc | ||||||||||||||||||||||||||||||||||||||||||
| 299 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 2 | $lasthit = $id; | |||||||||||||||||||||||||||||||||||||||||
| 302 | ▶ | } elsif ( (index($line, 'FW') == 0) || (index($line, 'RC') == 0)) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
index($line, "FW") == 0 or index($line, "RC") == 0
MC/DC100%2/2
index($line, "FW") == 0 or index($line, "RC") == 0
index($line, "FW") == 0
index($line, "RC") == 0
Truth table100%3/3
A or B
A= index($line, "FW") == 0B= index($line, "RC") == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 4 | my ($str, $hn, $pos, $score, $eval) = split ' ', $line; | |||||||||||||||||||||||||||||||||||||||||
| 304 | 4 | ▶ | if ($minscore < $score) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 4 | $self->start_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | my ($start, $end) = split m{\.\.}, $pos, 2; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 4 | ▶ | ($start, $end) = ($end, $start) if ($str eq 'RC'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 4 | $line = $self->_readline; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 4 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 4 | $self->element_hash({ | |||||||||||||||||||||||||||||||||||||||||
| 312 | 'Hsp_stranded' => 'HIT', | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 'Hsp_hit-from' => $start, | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 'Hsp_hit-to' => $end, | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 'Hsp_score' => $score, | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 'Hsp_bit-score' => $score, | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 'Hsp_evalue' => $eval, | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 'Hsp_query-from' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 'Hsp_query-to' => length($line), | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 'Hsp_align-len' => length($line), | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 'Hsp_hseq' =>$line | ||||||||||||||||||||||||||||||||||||||||||
| 322 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 4 | $self->end_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||
| 324 | 4 | ▶ | $lastscore = $score if (!$lastscore || $lastscore < $score); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $lastscore or $lastscore < $score
MC/DC100%2/2
not $lastscore or $lastscore < $score
not $lastscore
$lastscore < $score
Truth table100%3/3
not(A) or B
A= not $lastscoreB= $lastscore < $score
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 4 | ▶ | $lasteval = $eval if (!$lasteval || $lasteval > $eval); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $lasteval or $lasteval > $eval
MC/DC100%2/2
not $lasteval or $lasteval > $eval
not $lasteval
$lasteval > $eval
Truth table100%3/3
not(A) or B
A= not $lastevalB= $lasteval > $eval
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 328 | #$self->debug("Dropped data: $line"); | ||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | ▶ | if ($seentop) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 1 | ▶ | if ($self->within_element('hit')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | $self->element_hash({ | |||||||||||||||||||||||||||||||||||||||||
| 334 | 'Hit_signif' => $lasteval, | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 'Hit_score' => $lastscore, | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 'Hit_bits' => $lastscore | ||||||||||||||||||||||||||||||||||||||||||
| 337 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 1 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | $self->end_element({'Name' => 'Result'}); | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | return $self->end_document(); | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | =head2 start_element | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | Title : start_element | ||||||||||||||||||||||||||||||||||||||||||
| 348 | Usage : $eventgenerator->start_element | ||||||||||||||||||||||||||||||||||||||||||
| 349 | Function: Handles a start element event | ||||||||||||||||||||||||||||||||||||||||||
| 350 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 351 | Args : hashref with at least 2 keys 'Data' and 'Name' | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 6 | ▶ | sub start_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_element: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 6 | my ( $self, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | # we currently don't care about attributes | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 6 | my $nm = $data->{'Name'}; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 6 | my $type = $MODEMAP{$nm}; | |||||||||||||||||||||||||||||||||||||||||
| 361 | 6 | ▶ | if ($type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 6 | ▶ | if ( $self->_eventHandler->will_handle($type) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 6 | my $func = sprintf( "start_%s", lc $type ); | |||||||||||||||||||||||||||||||||||||||||
| 364 | 6 | $self->_eventHandler->$func( $data->{'Attributes'} ); | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 6 | unshift @{ $self->{'_elements'} }, $type; | |||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 6 | ▶ | if ( defined $type | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $type and $type eq "result"
MC/DC50%1/2
defined $type and $type eq "result"
defined $type
$type eq "result"
Truth table66%2/3
A and B
A= defined $typeB= $type eq "result"
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | && $type eq 'result' ) | ||||||||||||||||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 1 | $self->{'_values'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 372 | 1 | $self->{'_result'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | =head2 end_element | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | Title : start_element | ||||||||||||||||||||||||||||||||||||||||||
| 379 | Usage : $eventgenerator->end_element | ||||||||||||||||||||||||||||||||||||||||||
| 380 | Function: Handles an end element event | ||||||||||||||||||||||||||||||||||||||||||
| 381 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 382 | Args : hashref with at least 2 keys, 'Data' and 'Name' | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 11 | ▶ | sub end_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_element: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 11 | my ( $self, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 11 | my $nm = $data->{'Name'}; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 11 | my $type = $MODEMAP{$nm}; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 11 | my $rc; | |||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 11 | ▶ | if ($type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 6 | ▶ | if ( $self->_eventHandler->will_handle($type) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 6 | my $func = sprintf( "end_%s", lc $type ); | |||||||||||||||||||||||||||||||||||||||||
| 396 | $rc = $self->_eventHandler->$func( $self->{'_reporttype'}, | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 6 | $self->{'_values'} ); | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | 6 | my $lastelem = shift @{ $self->{'_elements'} }; | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | elsif ( $MAPPING{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 5 | ▶ | if ( ref( $MAPPING{$nm} ) =~ /hash/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 3 | my $key = ( keys %{ $MAPPING{$nm} } )[0]; | |||||||||||||||||||||||||||||||||||||||||
| 404 | $self->{'_values'}->{$key}->{ $MAPPING{$nm}->{$key} } = | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 3 | $self->{'_last_data'}; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | $self->{'_values'}->{ $MAPPING{$nm} } = $self->{'_last_data'}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $self->debug("unknown nm $nm, ignoring\n"); | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 11 | $self->{'_last_data'} = ''; # remove read data if we are at | |||||||||||||||||||||||||||||||||||||||||
| 415 | # end of an element | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 11 | ▶ | $self->{'_result'} = $rc if ( defined $type && $type eq 'result' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $type and $type eq "result"
MC/DC100%2/2
defined $type and $type eq "result"
defined $type
$type eq "result"
Truth table100%3/3
A and B
A= defined $typeB= $type eq "result"
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | 11 | return $rc; | |||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | =head2 element | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | Title : element | ||||||||||||||||||||||||||||||||||||||||||
| 423 | Usage : $eventhandler->element({'Name' => $name, 'Data' => $str}); | ||||||||||||||||||||||||||||||||||||||||||
| 424 | Function: Convenience method that calls start_element, characters, end_element | ||||||||||||||||||||||||||||||||||||||||||
| 425 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 426 | Args : Hash ref with the keys 'Name' and 'Data' | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 5 | ▶ | sub element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
element: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 5 | my ( $self, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 433 | # simple data calls (%MAPPING) do not need start_element | ||||||||||||||||||||||||||||||||||||||||||
| 434 | 5 | $self->characters($data); | |||||||||||||||||||||||||||||||||||||||||
| 435 | 5 | $self->end_element($data); | |||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | =head2 element_hash | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | Title : element | ||||||||||||||||||||||||||||||||||||||||||
| 441 | Usage : $eventhandler->element_hash({'Hsp_hit-from' => $start, | ||||||||||||||||||||||||||||||||||||||||||
| 442 | 'Hsp_hit-to' => $end, | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 'Hsp_score' => $lastscore}); | ||||||||||||||||||||||||||||||||||||||||||
| 444 | Function: Convenience method that takes multiple simple data elements and | ||||||||||||||||||||||||||||||||||||||||||
| 445 | maps to appropriate parameters | ||||||||||||||||||||||||||||||||||||||||||
| 446 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 447 | Args : Hash ref with the mapped key (in %MAPPING) and value | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 7 | ▶ | sub element_hash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
element_hash: called CC=8 SCAR=26.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 7 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 453 | 7 | ▶ | $self->throw("Must provide data hash ref") if !$data || !ref($data); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$data and ref $data
MC/DC0%0/2
$data and ref $data
$data
ref $data
Truth table33%1/3
A and B
A= $dataB= ref $data
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 7 | for my $nm (sort keys %{$data}) { | |||||||||||||||||||||||||||||||||||||||||
| 455 | 51 | ▶ | next if $data->{$nm} && $data->{$nm} =~ m{^\s*$}o; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$data->{$nm} and $data->{$nm} =~ /^\s*$/o
MC/DC0%0/2
$data->{$nm} and $data->{$nm} =~ /^\s*$/o
$data->{$nm}
$data->{$nm} =~ /^\s*$/o
Truth table33%1/3
A and B
A= $data->{$nm}B= $data->{$nm} =~ /^\s*$/o
| |||||||||||||||||||||||||||||||||||||||||||
| 456 | 51 | ▶ | if ( $MAPPING{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | 51 | ▶ | if ( ref( $MAPPING{$nm} ) =~ /hash/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | my $key = ( keys %{ $MAPPING{$nm} } )[0]; | |||||||||||||||||||||||||||||||||||||||||
| 459 | $self->{'_values'}->{$key}->{ $MAPPING{$nm}->{$key} } = | ||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $data->{$nm}; | |||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 462 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 463 | 51 | $self->{'_values'}->{ $MAPPING{$nm} } = $data->{$nm}; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | =head2 characters | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | Title : characters | ||||||||||||||||||||||||||||||||||||||||||
| 472 | Usage : $eventgenerator->characters($str) | ||||||||||||||||||||||||||||||||||||||||||
| 473 | Function: Send a character events | ||||||||||||||||||||||||||||||||||||||||||
| 474 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 475 | Args : string | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | 5 | ▶ | sub characters { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
characters: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 481 | 5 | my ( $self, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 482 | 5 | ▶ | return unless ( defined $data->{'Data'} && $data->{'Data'} !~ /^\s+$/o ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $data->{"Data"} and not $data->{"Data"} =~ /^\s+$/o
MC/DC0%0/2
defined $data->{"Data"} and not $data->{"Data"} =~ /^\s+$/o
defined $data->{"Data"}
not $data->{"Data"} =~ /^\s+$/o
Truth table33%1/3
A and not(B)
A= defined $data->{"Data"}B= not $data->{"Data"} =~ /^\s+$/o
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 5 | $self->{'_last_data'} = $data->{'Data'}; | |||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | =head2 within_element | ||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | Title : within_element | ||||||||||||||||||||||||||||||||||||||||||
| 489 | Usage : if( $eventgenerator->within_element($element) ) {} | ||||||||||||||||||||||||||||||||||||||||||
| 490 | Function: Test if we are within a particular element | ||||||||||||||||||||||||||||||||||||||||||
| 491 | This is different than 'in' because within can be tested | ||||||||||||||||||||||||||||||||||||||||||
| 492 | for a whole block. | ||||||||||||||||||||||||||||||||||||||||||
| 493 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||
| 494 | Args : string element name | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 2 | ▶ | sub within_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
within_element: called CC=6 SCAR=19.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 499 | 2 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 500 | return 0 | ||||||||||||||||||||||||||||||||||||||||||
| 501 | if ( !defined $name | ||||||||||||||||||||||||||||||||||||||||||
| 502 | || !defined $self->{'_elements'} | ||||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | ▶ | || scalar @{ $self->{'_elements'} } == 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $name && defined $self->{"_elements"} or scalar @{$self->{"_elements"};} == 0
defined $name && defined $self->{'_elements'}
MC/DC0%0/3
not defined $name && defined $self->{"_elements"} or scalar @{$self->{"_elements"};} == 0
defined $name
defined $self->{'_elements'}
scalar @{$self->{"_elements"};} == 0
Truth table25%1/4
not(A && B) or C
A= defined $nameB= defined $self->{'_elements'}C= scalar @{$self->{"_elements"};} == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 2 | foreach ( @{ $self->{'_elements'} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 505 | 2 | ▶ | return 1 if ( $_ eq $name ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | =head2 in_element | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | Title : in_element | ||||||||||||||||||||||||||||||||||||||||||
| 513 | Usage : if( $eventgenerator->in_element($element) ) {} | ||||||||||||||||||||||||||||||||||||||||||
| 514 | Function: Test if we are in a particular element | ||||||||||||||||||||||||||||||||||||||||||
| 515 | This is different than 'within' because 'in' only | ||||||||||||||||||||||||||||||||||||||||||
| 516 | tests its immediate parent. | ||||||||||||||||||||||||||||||||||||||||||
| 517 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||
| 518 | Args : string element name | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub in_element { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_element: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | ▶ | return 0 if !defined $self->{'_elements'}->[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | return ( $self->{'_elements'}->[0] eq $name ); | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | =head2 start_document | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | Title : start_document | ||||||||||||||||||||||||||||||||||||||||||
| 531 | Usage : $eventgenerator->start_document | ||||||||||||||||||||||||||||||||||||||||||
| 532 | Function: Handle a start document event | ||||||||||||||||||||||||||||||||||||||||||
| 533 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 534 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 1 | ▶ | sub start_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 1 | $self->{'_lasttype'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 541 | 1 | $self->{'_values'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 542 | 1 | $self->{'_result'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 543 | 1 | $self->{'_elements'} = []; | |||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | =head2 end_document | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | Title : end_document | ||||||||||||||||||||||||||||||||||||||||||
| 549 | Usage : $eventgenerator->end_document | ||||||||||||||||||||||||||||||||||||||||||
| 550 | Function: Handles an end document event | ||||||||||||||||||||||||||||||||||||||||||
| 551 | Returns : Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 552 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 1 | ▶ | sub end_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 558 | 1 | return $self->{'_result'}; | |||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | =head2 result_count | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | Title : result_count | ||||||||||||||||||||||||||||||||||||||||||
| 564 | Usage : my $count = $searchio->result_count | ||||||||||||||||||||||||||||||||||||||||||
| 565 | Function: Returns the number of results we have processed | ||||||||||||||||||||||||||||||||||||||||||
| 566 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 567 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | sub result_count { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | return $self->{'_result_count'}; | |||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | =head2 query_accession | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | Title : query_accession | ||||||||||||||||||||||||||||||||||||||||||
| 579 | Usage : my $acc = $parser->query_accession(); | ||||||||||||||||||||||||||||||||||||||||||
| 580 | Function: Get/Set query (model) accession; Infernal currently does not output | ||||||||||||||||||||||||||||||||||||||||||
| 581 | the accession number (Rfam accession #) | ||||||||||||||||||||||||||||||||||||||||||
| 582 | Returns : String (accession) | ||||||||||||||||||||||||||||||||||||||||||
| 583 | Args : [optional] String (accession) | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 2 | ▶ | sub query_accession { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_accession: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 588 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 589 | 2 | ▶ | return $self->{'_query_accession'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | return $self->{'_query_accession'}; | |||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | =head2 hsp_minscore | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | Title : hsp_minscore | ||||||||||||||||||||||||||||||||||||||||||
| 596 | Usage : my $cutoff = $parser->hsp_minscore(); | ||||||||||||||||||||||||||||||||||||||||||
| 597 | Function: Get/Set min bit score cutoff (for generating Hits/HSPs) | ||||||||||||||||||||||||||||||||||||||||||
| 598 | Returns : score (number) | ||||||||||||||||||||||||||||||||||||||||||
| 599 | Args : [optional] score (number) | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | 2 | ▶ | sub hsp_minscore { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hsp_minscore: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 605 | 2 | ▶ | return $self->{'_hsp_minscore'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | 1 | return $self->{'_hsp_minscore'}; | |||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | =head2 algorithm_version | ||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||
| 611 | Title : algorithm_version | ||||||||||||||||||||||||||||||||||||||||||
| 612 | Usage : my $ver = $parser->algorithm_version(); | ||||||||||||||||||||||||||||||||||||||||||
| 613 | Function: Get/Set algorithm version (not defined in RNAMotif output) | ||||||||||||||||||||||||||||||||||||||||||
| 614 | Returns : String (accession) | ||||||||||||||||||||||||||||||||||||||||||
| 615 | Args : [optional] String (accession) | ||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | 2 | ▶ | sub algorithm_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
algorithm_version: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 621 | 2 | ▶ | return $self->{'_algorithm'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | 1 | return $self->{'_algorithm'}; | |||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||