| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SearchIO::exonerate | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Jason Stajich <jason-at-bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||||||
| 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::exonerate - parser for Exonerate | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # do not use this module directly, it is a driver for SearchIO | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | use Bio::SearchIO; | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | my $searchio = Bio::SearchIO->new(-file => 'file.exonerate', | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | -format => 'exonerate'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | while( my $r = $searchio->next_result ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | print $r->query_name, "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | This is a driver for the SearchIO system for parsing Exonerate (Guy | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | Slater) output. You can get Exonerate at | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | http://www.ebi.ac.uk/~guy/exonerate/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | [until Guy puts up a Web reference,publication for it.]). | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | An optional parameter -min_intron is supported by the L<new> | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | initialization method. This is if you run Exonerate with a different | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | minimum intron length (default is 30) the parser will be able to | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | detect the difference between standard deletions and an intron. Still | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | some room to play with there that might cause this to get | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | misinterpreted that has not been fully tested or explored. | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | The VULGAR and CIGAR formats should be parsed okay now creating HSPs | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | where appropriate (so merging match states where appropriate rather | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | than breaking an HSP at each indel as it may have done in the past). | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | The GFF that comes from exonerate is still probably a better way to go | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | if you are doing protein2genome or est2genome mapping. | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | For example you can see this script: | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ### TODO: Jason, this link is dead, do we have an updated one? | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | http://fungal.genome.duke.edu/~jes12/software/scripts/process_exonerate_gff3.perl.txt | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | If your report contains both CIGAR and VULGAR lines only the first one | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | will processed for a given Query/Target pair. If you preferentially | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | want to use VULGAR or CIGAR add one of these options when initializing | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | the SearchIO object. | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | -cigar => 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | OR | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | -vulgar => 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | Or set them via these methods. | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | $parser->cigar(1) | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | OR | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $parser->vulgar(1) | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | web: | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | =head1 AUTHOR - Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | Email jason-at-bioperl.org | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | package Bio::SearchIO::exonerate; | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | $Bio::SearchIO::exonerate::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | ▶ | use vars qw(@STATES %MAPPING %MODEMAP $DEFAULT_WRITER_CLASS $MIN_INTRON); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | ▶ | use base qw(Bio::SearchIO); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | %MODEMAP = ( 'ExonerateOutput' => 'result', | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 'Hit' => 'hit', | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 'Hsp' => 'hsp' | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | %MAPPING = | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 'Hsp_query-from'=> 'HSP-query_start', | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 'Hsp_query-to' => 'HSP-query_end', | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 'Hsp_hit-from' => 'HSP-hit_start', | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 'Hsp_hit-to' => 'HSP-hit_end', | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 'Hsp_qseq' => 'HSP-query_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 'Hsp_hseq' => 'HSP-hit_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 'Hsp_midline' => 'HSP-homology_seq', | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 'Hsp_score' => 'HSP-score', | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 'Hsp_qlength' => 'HSP-query_length', | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 'Hsp_hlength' => 'HSP-hit_length', | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 'Hsp_align-len' => 'HSP-hsp_length', | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 'Hsp_identity' => 'HSP-identical', | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 'Hsp_gaps' => 'HSP-hsp_gaps', | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 'Hsp_hitgaps' => 'HSP-hit_gaps', | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 'Hsp_querygaps' => 'HSP-query_gaps', | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 'Hit_id' => 'HIT-name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 'Hit_desc' => 'HIT-description', | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 'Hit_len' => 'HIT-length', | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 'Hit_score' => 'HIT-score', | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 'ExonerateOutput_program' => 'RESULT-algorithm_name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 'ExonerateOutput_query-def' => 'RESULT-query_name', | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 'ExonerateOutput_query-desc'=> 'RESULT-query_description', | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 'ExonerateOutput_query-len' => 'RESULT-query_length', | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | $DEFAULT_WRITER_CLASS = 'Bio::SearchIO::Writer::HitTableWriter'; | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | $MIN_INTRON=30; # This is the minimum intron size | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | Title : new | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | Usage : my $obj = Bio::SearchIO::exonerate->new(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | Function: Builds a new Bio::SearchIO::exonerate object | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | Returns : an instance of Bio::SearchIO::exonerate | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | Args : -min_intron => somewhat obsolete option, how to determine if a | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | an indel is an intron or a local gap. Use VULGAR | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | rather than CIGAR to avoid this heuristic,default 30. | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | -cigar => 1 set this to 1 if you want to parse | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | CIGAR exclusively. | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | -vulgar => 1 set this to 1 if you want to parse VULGAR | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | exclusively, setting both to 1 will revert | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | to the default behavior of just parsing the | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | first line that it sees. | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 5 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 5 | my ($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 182 | 5 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 5 | my ($min_intron,$cigar, | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | $vulgar) = $self->_rearrange([qw(MIN_INTRON | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | CIGAR | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | VULGAR)], @_); | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 5 | ▶ | if( $min_intron ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $MIN_INTRON = $min_intron; | |||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 5 | ▶ | if( $cigar && $vulgar ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$cigar and $vulgar
MC/DC0%0/2
$cigar and $vulgar
$cigar
$vulgar
Truth table33%1/3
A and B
A= $cigarB= $vulgar
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->warn("cannot get HSPs from both CIGAR and VULGAR lines, will just choose whichever comes first (same as if you had chosen neither"); | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $cigar = 0; $vulgar=0; | |||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 5 | $self->cigar($cigar); | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | 5 | $self->vulgar($vulgar); | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | 5 | $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | =head2 next_result | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | Title : next_result | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | Usage : my $hit = $searchio->next_result; | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | Function: Returns the next Result from a search | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | Returns : Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 10 | ▶ | sub next_result{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_result: called CC=32 SCAR=36.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | 10 | local $/ = "\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 213 | 10 | local $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 10 | $self->{'_last_data'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 10 | my ($reporttype,$seenquery,$reportline); | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 10 | $self->start_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | 10 | my @hit_signifs; | |||||||||||||||||||||||||||||||||||||||||||||
| 219 | my $seentop; | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 10 | my (@q_ex, @m_ex, @h_ex); ## gc addition | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | 10 | ▶ | while( defined($_ = $self->_readline) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # warn( "Reading $_"); | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 375 | ▶ | if( /^\s*Query:\s+(\S+)\s*(.+)?/ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 6 | ▶ | if( $seentop ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $self->end_element({'Name' => 'ExonerateOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $self->_pushback($_); | |||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return $self->end_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 6 | $seentop = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | 6 | my ($nm,$desc) = ($1,$2); | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 6 | ▶ | chomp($desc) if defined $desc; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 6 | $self->{'_result_count'}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 233 | 6 | $self->start_element({'Name' => 'ExonerateOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 234 | 6 | $self->element({'Name' => 'ExonerateOutput_query-def', | |||||||||||||||||||||||||||||||||||||||||||||
| 235 | 'Data' => $nm }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 | $self->element({'Name' => 'ExonerateOutput_query-desc', | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | 'Data' => $desc }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 6 | $self->element({'Name' => 'ExonerateOutput_program', | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | 'Data' => 'Exonerate' }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 6 | $self->{'_seencigar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 241 | 6 | $self->{'_vulgar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } elsif ( /^Target:\s+(\S+)\s*(.+)?/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 5 | my ($nm,$desc) = ($1,$2); | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 5 | ▶ | chomp($desc) if defined $desc; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 5 | $self->start_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 247 | 5 | $self->element({'Name' => 'Hit_id', | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | 'Data' => $nm}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 5 | $self->element({'Name' => 'Hit_desc', | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | 'Data' => $desc}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 5 | $self->{'_seencigar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 252 | 5 | $self->{'_vulgar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 253 | } elsif( s/^vulgar:\s+(\S+)\s+ # query sequence id | ||||||||||||||||||||||||||||||||||||||||||||||
| 254 | (\d+)\s+(\d+)\s+([\-\+\.])\s+ # query start-end-strand | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | (\S+)\s+ # target sequence id | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | (\d+)\s+(\d+)\s+([\-\+])\s+ # target start-end-strand | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | (-?\d+)\s+ # score | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | //ox ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 4 | ▶ | next if( $self->cigar || $self->{'_seencigar'}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->cigar or $self->{"_seencigar"}
MC/DC0%0/2
$self->cigar or $self->{"_seencigar"}
$self->cigar
$self->{"_seencigar"}
Truth table33%1/3
A or B
A= $self->cigarB= $self->{"_seencigar"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 4 | $self->{'_vulgar'}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # Note from Ewan. This is ugly - copy and paste from | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # cigar line parsing. Should unify somehow... | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 4 | ▶ | if( ! $self->within_element('result') ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $self->start_element({'Name' => 'ExonerateOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $self->element({'Name' => 'ExonerateOutput_query-def', | |||||||||||||||||||||||||||||||||||||||||||||
| 268 | 'Data' => $1 }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 4 | ▶ | if( ! $self->within_element('hit') ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 1 | $self->start_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1 | $self->element({'Name' => 'Hit_id', | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 'Data' => $5}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||
| 276 | ## gc note: | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ## $qe and $he are no longer used for calculating the ends, | ||||||||||||||||||||||||||||||||||||||||||||||
| 278 | ## just the $qs and $hs values and the alignment and insert lenghts | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 4 | my ($qs,$qe,$qstrand) = ($2,$3,$4); | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | my ($hs,$he,$hstrand) = ($6,$7,$8); | |||||||||||||||||||||||||||||||||||||||||||||
| 281 | 4 | my $score = $9; | |||||||||||||||||||||||||||||||||||||||||||||
| 282 | # $self->element({'Name' => 'ExonerateOutput_query-len', | ||||||||||||||||||||||||||||||||||||||||||||||
| 283 | # 'Data' => $qe}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | # $self->element({'Name' => 'Hit_len', | ||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # 'Data' => $he}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ## gc note: | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ## add one because these values are zero-based | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ## this calculation was originally done lower in the code, | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | ## but it's clearer to do it just once at the start | ||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 4 | my @rest = split; | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | 4 | my ($qbegin,$qend) = ('query-from', 'query-to'); | |||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 4 | ▶ | if( $qstrand eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $qstrand = -1; $qe++; | |||||||||||||||||||||||||||||||||||||||||||||
| 296 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 4 | $qstrand = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 298 | 4 | $qs++; | |||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 4 | my ($hbegin,$hend) = ('hit-from', 'hit-to'); | |||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 4 | ▶ | if( $hstrand eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $hstrand = -1; | |||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $he++; | |||||||||||||||||||||||||||||||||||||||||||||
| 305 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 4 | $hstrand = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | $hs++; | |||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # okay let's do this right and generate a set of HSPs | ||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # from the cigar line/home/bio1/jes12/bin/exonerate --model est2genome --bestn 1 t/data/exonerate_cdna.fa t/data/exonerate_genomic_rev.fa | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 4 | my ($aln_len,$inserts,$deletes) = (0,0,0); | |||||||||||||||||||||||||||||||||||||||||||||
| 313 | 4 | my ($laststate,@events,$gaps) =( '' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 314 | 4 | ▶ | while( @rest >= 3 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 60 | my ($state,$len1,$len2) = (shift @rest, shift @rest, shift @rest); | |||||||||||||||||||||||||||||||||||||||||||||
| 316 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # HSPs are only the Match cases; otherwise we just | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # move the coordinates on by the correct amount | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 60 | ▶ | if( $state eq 'M' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 20 | ▶ | if( $laststate eq 'G' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # merge gaps across Match states so the HSP | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # goes across | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 4 | $events[-1]->{$qend} = $qs + $len1*$qstrand - $qstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 326 | 4 | $events[-1]->{$hend} = $hs + $len2*$hstrand - $hstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 327 | 4 | $events[-1]->{'gaps'} = $gaps; | |||||||||||||||||||||||||||||||||||||||||||||
| 328 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 16 | push @events, | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | { 'score' => $score, | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 'align-len' => $len1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | $qbegin => $qs, | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | $qend => ($qs + $len1*$qstrand - $qstrand), | ||||||||||||||||||||||||||||||||||||||||||||||
| 334 | $hbegin => $hs, | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | $hend => ($hs + $len2*$hstrand - $hstrand), | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 20 | $gaps = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 339 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 40 | ▶ | $gaps = $len1 + $len2 if $state eq 'G'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 60 | $qs += $len1*$qstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 343 | 60 | $hs += $len2*$hstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | 60 | $laststate= $state; | |||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 4 | for my $event ( @events ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 347 | 16 | $self->start_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 348 | 16 | ▶ | while( my ($key,$val) = each %$event ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 100 | $self->element({'Name' => "Hsp_$key", | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | 'Data' => $val}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 16 | $self->element({'Name' => 'Hsp_identity', | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | 'Data' => 0}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 16 | $self->end_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # end of hit | ||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | $self->element({'Name' => 'Hit_score', | |||||||||||||||||||||||||||||||||||||||||||||
| 359 | 'Data' => $score}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # issued end... | ||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 4 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 4 | $self->end_element({'Name' => 'ExonerateOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 4 | return $self->end_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } elsif( s/^cigar:\s+(\S+)\s+ # query sequence id | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | (\d+)\s+(\d+)\s+([\-\+])\s+ # query start-end-strand | ||||||||||||||||||||||||||||||||||||||||||||||
| 368 | (\S+)\s+ # target sequence id | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | (\d+)\s+(\d+)\s+([\-\+])\s+ # target start-end-strand | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | (-?\d+)\s+ # score | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | //ox ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 2 | ▶ | next if( $self->vulgar || $self->{'_seenvulgar'}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->vulgar or $self->{"_seenvulgar"}
MC/DC0%0/2
$self->vulgar or $self->{"_seenvulgar"}
$self->vulgar
$self->{"_seenvulgar"}
Truth table33%1/3
A or B
A= $self->vulgarB= $self->{"_seenvulgar"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 2 | $self->{'_cigar'}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 2 | ▶ | if( ! $self->within_element('result') ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $self->start_element({'Name' => 'ExonerateOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $self->element({'Name' => 'ExonerateOutput_query-def', | |||||||||||||||||||||||||||||||||||||||||||||
| 378 | 'Data' => $1 }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 2 | ▶ | if( ! $self->within_element('hit') ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $self->start_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $self->element({'Name' => 'Hit_id', | |||||||||||||||||||||||||||||||||||||||||||||
| 383 | 'Data' => $5}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | ## gc note: | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | ## $qe and $he are no longer used for calculating the ends, | ||||||||||||||||||||||||||||||||||||||||||||||
| 387 | ## just the $qs and $hs values and the alignment and insert lenghts | ||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 2 | my ($qs,$qe,$qstrand) = ($2,$3,$4); | |||||||||||||||||||||||||||||||||||||||||||||
| 389 | 2 | my ($hs,$he,$hstrand) = ($6,$7,$8); | |||||||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | my $score = $9; | |||||||||||||||||||||||||||||||||||||||||||||
| 391 | # $self->element({'Name' => 'ExonerateOutput_query-len', | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | # 'Data' => $qe}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # $self->element({'Name' => 'Hit_len', | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # 'Data' => $he}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | my @rest = split; | |||||||||||||||||||||||||||||||||||||||||||||
| 397 | 2 | ▶ | if( $qstrand eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 2 | $qstrand = -1; | |||||||||||||||||||||||||||||||||||||||||||||
| 399 | 2 | ($qs,$qe) = ($qe,$qs); # flip-flop if we're on opp strand | |||||||||||||||||||||||||||||||||||||||||||||
| 400 | 2 | $qs--; $qe++; | |||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | } else { $qstrand = 1; } | |||||||||||||||||||||||||||||||||||||||||||||
| 402 | 2 | ▶ | if( $hstrand eq '-' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | $hstrand = -1; | |||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ($hs,$he) = ($he,$hs); # flip-flop if we're on opp strand | |||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | $hs--; $he++; | |||||||||||||||||||||||||||||||||||||||||||||
| 406 | 2 | } else { $hstrand = 1; } | |||||||||||||||||||||||||||||||||||||||||||||
| 407 | # okay let's do this right and generate a set of HSPs | ||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # from the cigar line | ||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||
| 410 | ## gc note: | ||||||||||||||||||||||||||||||||||||||||||||||
| 411 | ## add one because these values are zero-based | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | ## this calculation was originally done lower in the code, | ||||||||||||||||||||||||||||||||||||||||||||||
| 413 | ## but it's clearer to do it just once at the start | ||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 2 | $qs++; $hs++; | |||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2 | my ($aln_len,$inserts,$deletes) = (0,0,0); | |||||||||||||||||||||||||||||||||||||||||||||
| 417 | 2 | ▶ | while( @rest >= 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 10 | my ($state,$len) = (shift @rest, shift @rest); | |||||||||||||||||||||||||||||||||||||||||||||
| 419 | 10 | ▶ | if( $state eq 'I' ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $inserts+=$len; | |||||||||||||||||||||||||||||||||||||||||||||
| 421 | } elsif( $state eq 'D' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 4 | ▶ | if( $len >= $MIN_INTRON ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 4 | $self->start_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 4 | $self->element({'Name' => 'Hsp_score', | |||||||||||||||||||||||||||||||||||||||||||||
| 426 | 'Data' => $score}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 4 | $self->element({'Name' => 'Hsp_align-len', | |||||||||||||||||||||||||||||||||||||||||||||
| 428 | 'Data' => $aln_len}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 4 | $self->element({'Name' => 'Hsp_identity', | |||||||||||||||||||||||||||||||||||||||||||||
| 430 | 'Data' => $aln_len - | ||||||||||||||||||||||||||||||||||||||||||||||
| 431 | ($inserts + $deletes)}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # HSP ends where the other begins | ||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 4 | $self->element({'Name' => 'Hsp_query-from', | |||||||||||||||||||||||||||||||||||||||||||||
| 435 | 'Data' => $qs}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 436 | ## gc note: | ||||||||||||||||||||||||||||||||||||||||||||||
| 437 | ## $qs is now the start of the next hsp | ||||||||||||||||||||||||||||||||||||||||||||||
| 438 | ## the end of this hsp is 1 before this position | ||||||||||||||||||||||||||||||||||||||||||||||
| 439 | ## (or 1 after in case of reverse strand) | ||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 4 | $qs += $aln_len*$qstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 441 | 4 | $self->element({'Name' => 'Hsp_query-to', | |||||||||||||||||||||||||||||||||||||||||||||
| 442 | 'Data' => $qs - ($qstrand*1)}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 4 | $hs += $deletes*$hstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 445 | 4 | $self->element({'Name' => 'Hsp_hit-from', | |||||||||||||||||||||||||||||||||||||||||||||
| 446 | 'Data' => $hs}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 4 | $hs += $aln_len*$hstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 448 | 4 | $self->element({'Name' => 'Hsp_hit-to', | |||||||||||||||||||||||||||||||||||||||||||||
| 449 | 'Data' => $hs-($hstrand*1)}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 4 | $self->element({'Name' => 'Hsp_align-len', | |||||||||||||||||||||||||||||||||||||||||||||
| 452 | 'Data' => $aln_len + $inserts | ||||||||||||||||||||||||||||||||||||||||||||||
| 453 | + $deletes}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 4 | $self->element({'Name' => 'Hsp_identity', | |||||||||||||||||||||||||||||||||||||||||||||
| 455 | 'Data' => $aln_len }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 4 | $self->element({'Name' => 'Hsp_gaps', | |||||||||||||||||||||||||||||||||||||||||||||
| 458 | 'Data' => $inserts + $deletes}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 4 | $self->element({'Name' => 'Hsp_querygaps', | |||||||||||||||||||||||||||||||||||||||||||||
| 460 | 'Data' => $inserts}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 4 | $self->element({'Name' => 'Hsp_hitgaps', | |||||||||||||||||||||||||||||||||||||||||||||
| 462 | 'Data' => $deletes}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | ## gc addition start | ||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 4 | $self->element({'Name' => 'Hsp_qseq', | |||||||||||||||||||||||||||||||||||||||||||||
| 467 | 'Data' => shift @q_ex, | ||||||||||||||||||||||||||||||||||||||||||||||
| 468 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 4 | $self->element({'Name' => 'Hsp_hseq', | |||||||||||||||||||||||||||||||||||||||||||||
| 470 | 'Data' => shift @h_ex, | ||||||||||||||||||||||||||||||||||||||||||||||
| 471 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 4 | $self->element({'Name' => 'Hsp_midline', | |||||||||||||||||||||||||||||||||||||||||||||
| 473 | 'Data' => shift @m_ex, | ||||||||||||||||||||||||||||||||||||||||||||||
| 474 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 475 | ## gc addition end | ||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 4 | $self->end_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 4 | $aln_len = $inserts = $deletes = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | $deletes+=$len; | |||||||||||||||||||||||||||||||||||||||||||||
| 481 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 6 | $aln_len += $len; | |||||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | $self->start_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||
| 487 | ## gc addition start | ||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 2 | $self->element({'Name' => 'Hsp_qseq', | |||||||||||||||||||||||||||||||||||||||||||||
| 490 | 'Data' => shift @q_ex, | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 2 | $self->element({'Name' => 'Hsp_hseq', | |||||||||||||||||||||||||||||||||||||||||||||
| 493 | 'Data' => shift @h_ex, | ||||||||||||||||||||||||||||||||||||||||||||||
| 494 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 2 | $self->element({'Name' => 'Hsp_midline', | |||||||||||||||||||||||||||||||||||||||||||||
| 496 | 'Data' => shift @m_ex, | ||||||||||||||||||||||||||||||||||||||||||||||
| 497 | }); | ||||||||||||||||||||||||||||||||||||||||||||||
| 498 | ## gc addition end | ||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 2 | $self->element({'Name' => 'Hsp_score', | |||||||||||||||||||||||||||||||||||||||||||||
| 501 | 'Data' => $score}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | $self->element({'Name' => 'Hsp_query-from', | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | 'Data' => $qs}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 2 | $qs += $aln_len*$qstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 507 | 2 | $self->element({'Name' => 'Hsp_query-to', | |||||||||||||||||||||||||||||||||||||||||||||
| 508 | 'Data' => $qs - ($qstrand*1)}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 2 | $hs += $deletes*$hstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 511 | 2 | $self->element({'Name' => 'Hsp_hit-from', | |||||||||||||||||||||||||||||||||||||||||||||
| 512 | 'Data' => $hs}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 2 | $hs += $aln_len*$hstrand; | |||||||||||||||||||||||||||||||||||||||||||||
| 514 | 2 | $self->element({'Name' => 'Hsp_hit-to', | |||||||||||||||||||||||||||||||||||||||||||||
| 515 | 'Data' => $hs -($hstrand*1)}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 2 | $self->element({'Name' => 'Hsp_align-len', | |||||||||||||||||||||||||||||||||||||||||||||
| 518 | 'Data' => $aln_len}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 2 | $self->element({'Name' => 'Hsp_identity', | |||||||||||||||||||||||||||||||||||||||||||||
| 521 | 'Data' => $aln_len - ($inserts + $deletes)}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 2 | $self->element({'Name' => 'Hsp_gaps', | |||||||||||||||||||||||||||||||||||||||||||||
| 524 | 'Data' => $inserts + $deletes}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 2 | $self->element({'Name' => 'Hsp_querygaps', | |||||||||||||||||||||||||||||||||||||||||||||
| 527 | 'Data' => $inserts}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 2 | $self->element({'Name' => 'Hsp_hitgaps', | |||||||||||||||||||||||||||||||||||||||||||||
| 529 | 'Data' => $deletes}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 2 | $self->end_element({'Name' => 'Hsp'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 2 | $self->element({'Name' => 'Hit_score', | |||||||||||||||||||||||||||||||||||||||||||||
| 533 | 'Data' => $score}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 2 | $self->end_element({'Name' => 'Hit'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 536 | 2 | $self->end_element({'Name' => 'ExonerateOutput'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 2 | return $self->end_document(); | |||||||||||||||||||||||||||||||||||||||||||||
| 539 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # skipping this line | ||||||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 4 | ▶ | return $self->end_document() if( $seentop ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||
| 546 | =head2 start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||
| 548 | Title : start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 549 | Usage : $eventgenerator->start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 550 | Function: Handles a start element event | ||||||||||||||||||||||||||||||||||||||||||||||
| 551 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 552 | Args : hashref with at least 2 keys 'Data' and 'Name' | ||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||
| 555 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 271 | ▶ | sub start_element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_element: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 271 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 559 | # we currently don't care about attributes | ||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 271 | my $nm = $data->{'Name'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 561 | 271 | my $type = $MODEMAP{$nm}; | |||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 271 | ▶ | if( $type ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 34 | ▶ | if( $self->_eventHandler->will_handle($type) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 34 | my $func = sprintf("start_%s",lc $type); | |||||||||||||||||||||||||||||||||||||||||||||
| 566 | 34 | $self->_eventHandler->$func($data->{'Attributes'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 34 | unshift @{$self->{'_elements'}}, $type; | |||||||||||||||||||||||||||||||||||||||||||||
| 569 | 34 | ▶ | if($type eq 'result') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 6 | $self->{'_values'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 571 | 6 | $self->{'_result'}= undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||
| 577 | =head2 end_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||
| 579 | Title : start_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 580 | Usage : $eventgenerator->end_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 581 | Function: Handles an end element event | ||||||||||||||||||||||||||||||||||||||||||||||
| 582 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 583 | Args : hashref with at least 2 keys 'Data' and 'Name' | ||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||
| 586 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 271 | ▶ | sub end_element { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_element: called CC=7 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 271 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 590 | 271 | my $nm = $data->{'Name'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 591 | 271 | my $type = $MODEMAP{$nm}; | |||||||||||||||||||||||||||||||||||||||||||||
| 592 | 271 | my $rc; | |||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 271 | ▶ | if( $type = $MODEMAP{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 34 | ▶ | if( $self->_eventHandler->will_handle($type) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 34 | my $func = sprintf("end_%s",lc $type); | |||||||||||||||||||||||||||||||||||||||||||||
| 597 | $rc = $self->_eventHandler->$func($self->{'_reporttype'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 34 | $self->{'_values'}); | |||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 34 | shift @{$self->{'_elements'}}; | |||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||
| 602 | } elsif( $MAPPING{$nm} ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 237 | ▶ | if ( ref($MAPPING{$nm}) =~ /hash/i ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | my $key = (keys %{$MAPPING{$nm}})[0]; | |||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | $self->{'_values'}->{$key}->{$MAPPING{$nm}->{$key}} = $self->{'_last_data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 607 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 237 | $self->{'_values'}->{$MAPPING{$nm}} = $self->{'_last_data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | $self->debug( "unknown nm $nm, ignoring\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 271 | $self->{'_last_data'} = ''; # remove read data if we are at | |||||||||||||||||||||||||||||||||||||||||||||
| 614 | # end of an element | ||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 271 | ▶ | $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"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 271 | return $rc; | |||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||
| 619 | =head2 element | ||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||
| 621 | Title : element | ||||||||||||||||||||||||||||||||||||||||||||||
| 622 | Usage : $eventhandler->element({'Name' => $name, 'Data' => $str}); | ||||||||||||||||||||||||||||||||||||||||||||||
| 623 | Function: Convience method that calls start_element, characters, end_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 624 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 625 | Args : Hash ref with the keys 'Name' and 'Data' | ||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||
| 628 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 237 | ▶ | sub element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
element: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 237 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 632 | 237 | $self->start_element($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 633 | 237 | $self->characters($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 634 | 237 | $self->end_element($data); | |||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||
| 637 | =head2 characters | ||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||
| 639 | Title : characters | ||||||||||||||||||||||||||||||||||||||||||||||
| 640 | Usage : $eventgenerator->characters($str) | ||||||||||||||||||||||||||||||||||||||||||||||
| 641 | Function: Send a character events | ||||||||||||||||||||||||||||||||||||||||||||||
| 642 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 643 | Args : string | ||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||
| 646 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 237 | ▶ | sub characters{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
characters: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 237 | my ($self,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 237 | ▶ | return unless ( defined $data->{'Data'} && $data->{'Data'} !~ /^\s+$/ ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $data->{"Data"} and not $data->{"Data"} =~ /^\s+$/
MC/DC50%1/2
defined $data->{"Data"} and not $data->{"Data"} =~ /^\s+$/
defined $data->{"Data"}
not $data->{"Data"} =~ /^\s+$/
Truth table66%2/3
A and not(B)
A= defined $data->{"Data"}B= not $data->{"Data"} =~ /^\s+$/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 215 | $self->{'_last_data'} = $data->{'Data'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||
| 656 | =head2 within_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||
| 658 | Title : within_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 659 | Usage : if( $eventgenerator->within_element($element) ) {} | ||||||||||||||||||||||||||||||||||||||||||||||
| 660 | Function: Test if we are within a particular element | ||||||||||||||||||||||||||||||||||||||||||||||
| 661 | This is different than 'in' because within can be tested | ||||||||||||||||||||||||||||||||||||||||||||||
| 662 | for a whole block. | ||||||||||||||||||||||||||||||||||||||||||||||
| 663 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||||||
| 664 | Args : string element name | ||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||
| 667 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 12 | ▶ | sub within_element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
within_element: called CC=6 SCAR=19.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 12 | my ($self,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 671 | return 0 if ( ! defined $name && | ||||||||||||||||||||||||||||||||||||||||||||||
| 672 | ! defined $self->{'_elements'} || | ||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 12 | ▶ | 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 table20%1/5
not(A || B) or C
A= defined $nameB= defined $self->{'_elements'}C= scalar @{$self->{"_elements"};} == 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 12 | foreach ( @{$self->{'_elements'}} ) { | |||||||||||||||||||||||||||||||||||||||||||||
| 675 | 17 | ▶ | if( $_ eq $name ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 11 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||
| 683 | =head2 in_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||
| 685 | Title : in_element | ||||||||||||||||||||||||||||||||||||||||||||||
| 686 | Usage : if( $eventgenerator->in_element($element) ) {} | ||||||||||||||||||||||||||||||||||||||||||||||
| 687 | Function: Test if we are in a particular element | ||||||||||||||||||||||||||||||||||||||||||||||
| 688 | This is different than 'in' because within can be tested | ||||||||||||||||||||||||||||||||||||||||||||||
| 689 | for a whole block. | ||||||||||||||||||||||||||||||||||||||||||||||
| 690 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||||||
| 691 | Args : string element name | ||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||
| 694 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | ▶ | sub in_element{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
in_element: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | my ($self,$name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | return 0 if ! defined $self->{'_elements'}->[0]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | return ( $self->{'_elements'}->[0] eq $name) | |||||||||||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||||||
| 702 | =head2 start_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||
| 704 | Title : start_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 705 | Usage : $eventgenerator->start_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 706 | Function: Handle a start document event | ||||||||||||||||||||||||||||||||||||||||||||||
| 707 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 708 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||
| 711 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 10 | ▶ | sub start_document{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 715 | 10 | $self->{'_lasttype'} = ''; | |||||||||||||||||||||||||||||||||||||||||||||
| 716 | 10 | $self->{'_values'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 717 | 10 | $self->{'_result'}= undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 718 | 10 | $self->{'_elements'} = []; | |||||||||||||||||||||||||||||||||||||||||||||
| 719 | 10 | $self->{'_reporttype'} = 'exonerate'; | |||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||
| 723 | =head2 end_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||
| 725 | Title : end_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 726 | Usage : $eventgenerator->end_document | ||||||||||||||||||||||||||||||||||||||||||||||
| 727 | Function: Handles an end document event | ||||||||||||||||||||||||||||||||||||||||||||||
| 728 | Returns : Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||||||
| 729 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||
| 732 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 6 | ▶ | sub end_document{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 6 | my ($self,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 736 | 6 | return $self->{'_result'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | sub write_result { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_result: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my ($self, $blast, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | if( not defined($self->writer) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | $self->warn("Writer not defined. Using a $DEFAULT_WRITER_CLASS"); | |||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | $self->writer( $DEFAULT_WRITER_CLASS->new() ); | |||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | $self->SUPER::write_result( $blast, @args ); | |||||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | sub result_count { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | return $self->{'_result_count'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | ▶ | sub report_count { shift->result_count } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
report_count: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||
| 757 | =head2 vulgar | ||||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||||
| 759 | Title : vulgar | ||||||||||||||||||||||||||||||||||||||||||||||
| 760 | Usage : $obj->vulgar($newval) | ||||||||||||||||||||||||||||||||||||||||||||||
| 761 | Function: Get/Set flag, do you want to build HSPs from VULGAR string? | ||||||||||||||||||||||||||||||||||||||||||||||
| 762 | Returns : value of vulgar (a scalar) | ||||||||||||||||||||||||||||||||||||||||||||||
| 763 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||
| 766 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 7 | ▶ | sub vulgar{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vulgar: called CC=5 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 770 | 7 | ▶ | my $x = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 7 | ▶ | if( @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 0 | ▶ | if( $_[0] && $self->{'_cigar'} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0] and $self->{"_cigar"}
MC/DC0%0/2
$_[0] and $self->{"_cigar"}
$_[0]
$self->{"_cigar"}
Truth table0%0/3
A and B
A= $_[0]B= $self->{"_cigar"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | $self->warn("Trying to set vulgar and cigar both to 1, must be either or"); | |||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | $self->{'_cigar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | return $self->{'_vulgar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 7 | return $self->{'_vulgar'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||
| 781 | =head2 cigar | ||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||
| 783 | Title : cigar | ||||||||||||||||||||||||||||||||||||||||||||||
| 784 | Usage : $obj->cigar($newval) | ||||||||||||||||||||||||||||||||||||||||||||||
| 785 | Function: Get/Set boolean flag do you want to build HSPs from CIGAR strings? | ||||||||||||||||||||||||||||||||||||||||||||||
| 786 | Returns : value of cigar (a scalar) | ||||||||||||||||||||||||||||||||||||||||||||||
| 787 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||
| 790 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 9 | ▶ | sub cigar{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cigar: called CC=5 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 794 | 9 | ▶ | my $x = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 9 | ▶ | if( @_ ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | ▶ | if( $_[0] && $self->{'_vulgar'} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0] and $self->{"_vulgar"}
MC/DC0%0/2
$_[0] and $self->{"_vulgar"}
$_[0]
$self->{"_vulgar"}
Truth table0%0/3
A and B
A= $_[0]B= $self->{"_vulgar"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | $self->warn("Trying to set vulgar and cigar both to 1, must be either or"); | |||||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | $self->{'_vulgar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | return $self->{'_cigar'} = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 800 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 9 | return $self->{'_cigar'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 803 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||||||