| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SearchIO | ||||||||||||||||||||||||||||||||||||||||||
| 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 - Driver for parsing Sequence Database Searches | ||||||||||||||||||||||||||||||||||||||||||
| 17 | (BLAST, FASTA, ...) | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | use Bio::SearchIO; | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # format can be 'fasta', 'blast', 'exonerate', ... | ||||||||||||||||||||||||||||||||||||||||||
| 23 | my $searchio = Bio::SearchIO->new( -format => 'blastxml', | ||||||||||||||||||||||||||||||||||||||||||
| 24 | -file => 'blastout.xml' ); | ||||||||||||||||||||||||||||||||||||||||||
| 25 | while ( my $result = $searchio->next_result() ) { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | while( my $hit = $result->next_hit ) { | ||||||||||||||||||||||||||||||||||||||||||
| 27 | # process the Bio::Search::Hit::HitI object | ||||||||||||||||||||||||||||||||||||||||||
| 28 | while( my $hsp = $hit->next_hsp ) { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # process the Bio::Search::HSP::HSPI object | ||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | This is a driver for instantiating a parser for report files from | ||||||||||||||||||||||||||||||||||||||||||
| 38 | sequence database searches. This object serves as a wrapper for the | ||||||||||||||||||||||||||||||||||||||||||
| 39 | format parsers in Bio::SearchIO::* - you should not need to ever | ||||||||||||||||||||||||||||||||||||||||||
| 40 | use those format parsers directly. (For people used to the SeqIO | ||||||||||||||||||||||||||||||||||||||||||
| 41 | system it, we are deliberately using the same pattern). | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | Once you get a SearchIO object, calling next_result() gives you back | ||||||||||||||||||||||||||||||||||||||||||
| 44 | a L<Bio::Search::Result::ResultI> compliant object, which is an object that | ||||||||||||||||||||||||||||||||||||||||||
| 45 | represents one Blast/Fasta/HMMER whatever report. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | A list of module names and formats is below: | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | blast BLAST (WUBLAST, NCBIBLAST,bl2seq) | ||||||||||||||||||||||||||||||||||||||||||
| 50 | fasta FASTA -m9 and -m0 | ||||||||||||||||||||||||||||||||||||||||||
| 51 | blasttable BLAST -m9 or -m8 output (both NCBI and WUBLAST tabular) | ||||||||||||||||||||||||||||||||||||||||||
| 52 | megablast MEGABLAST | ||||||||||||||||||||||||||||||||||||||||||
| 53 | psl UCSC PSL format | ||||||||||||||||||||||||||||||||||||||||||
| 54 | waba WABA output | ||||||||||||||||||||||||||||||||||||||||||
| 55 | axt AXT format | ||||||||||||||||||||||||||||||||||||||||||
| 56 | sim4 Sim4 | ||||||||||||||||||||||||||||||||||||||||||
| 57 | hmmer HMMER2 hmmpfam and hmmsearch or HMMER3 hmmscan and hmmsearch | ||||||||||||||||||||||||||||||||||||||||||
| 58 | exonerate Exonerate CIGAR and VULGAR format | ||||||||||||||||||||||||||||||||||||||||||
| 59 | blastxml NCBI BLAST XML | ||||||||||||||||||||||||||||||||||||||||||
| 60 | wise Genewise -genesf format | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | Also see the SearchIO HOWTO: | ||||||||||||||||||||||||||||||||||||||||||
| 63 | http://bioperl.org/howtos/SearchIO_HOWTO.html | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 70 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||
| 71 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 74 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 83 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 84 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 85 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 90 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 91 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | =head1 AUTHOR - Jason Stajich & Steve Chervitz | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | Email jason-at-bioperl.org | ||||||||||||||||||||||||||||||||||||||||||
| 98 | Email sac-at-bioperl.org | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 103 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | package Bio::SearchIO; | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 48 | $Bio::SearchIO::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 48 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 48 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | # Object preamble - inherits from Bio::Root::IO | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 48 | ▶ | use Bio::SearchIO::SearchResultEventBuilder; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | # Special exception class for exceptions during parsing. | ||||||||||||||||||||||||||||||||||||||||||
| 121 | # End users should not ever see these. | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # For an example of usage, see blast.pm. | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 48 | @Bio::SearchIO::InternalParserError::ISA = qw(Bio::Root::Exception); | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 48 | ▶ | use Symbol; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 48 | ▶ | use base qw(Bio::Root::IO Bio::Event::EventGeneratorI Bio::AnalysisParserI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 132 | Usage : my $obj = Bio::SearchIO->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 133 | Function: Builds a new Bio::SearchIO object | ||||||||||||||||||||||||||||||||||||||||||
| 134 | Returns : Bio::SearchIO initialized with the correct format | ||||||||||||||||||||||||||||||||||||||||||
| 135 | Args : -file => $filename | ||||||||||||||||||||||||||||||||||||||||||
| 136 | -format => format | ||||||||||||||||||||||||||||||||||||||||||
| 137 | -fh => filehandle to attach to | ||||||||||||||||||||||||||||||||||||||||||
| 138 | -result_factory => object implementing Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 139 | -hit_factory => object implementing Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 140 | -hsp_factory => object implementing Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 141 | -writer => object implementing Bio::SearchIO::SearchWriterI | ||||||||||||||||||||||||||||||||||||||||||
| 142 | -output_format => output format, which will dynamically load writer | ||||||||||||||||||||||||||||||||||||||||||
| 143 | -inclusion_threshold => e-value threshold for inclusion in the | ||||||||||||||||||||||||||||||||||||||||||
| 144 | PSI-BLAST score matrix model | ||||||||||||||||||||||||||||||||||||||||||
| 145 | -signif => float or scientific notation number to be used | ||||||||||||||||||||||||||||||||||||||||||
| 146 | as a P- or Expect value cutoff | ||||||||||||||||||||||||||||||||||||||||||
| 147 | -check_all_hits => boolean. Check all hits for significance against | ||||||||||||||||||||||||||||||||||||||||||
| 148 | significance criteria. Default = false. | ||||||||||||||||||||||||||||||||||||||||||
| 149 | If false, stops processing hits after the first | ||||||||||||||||||||||||||||||||||||||||||
| 150 | non-significant hit or the first hit that fails | ||||||||||||||||||||||||||||||||||||||||||
| 151 | the hit_filter call. This speeds parsing, | ||||||||||||||||||||||||||||||||||||||||||
| 152 | taking advantage of the fact that the hits are | ||||||||||||||||||||||||||||||||||||||||||
| 153 | processed in the order they appear in the report. | ||||||||||||||||||||||||||||||||||||||||||
| 154 | -min_query_len => integer to be used as a minimum for query sequence | ||||||||||||||||||||||||||||||||||||||||||
| 155 | length. Reports with query sequences below this | ||||||||||||||||||||||||||||||||||||||||||
| 156 | length will not be processed. | ||||||||||||||||||||||||||||||||||||||||||
| 157 | default = no minimum length. | ||||||||||||||||||||||||||||||||||||||||||
| 158 | -best => boolean. Only process the best hit of each report; | ||||||||||||||||||||||||||||||||||||||||||
| 159 | default = false. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | See L<Bio::Factory::ObjectFactoryI>, L<Bio::SearchIO::SearchWriterI> | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | Any factory objects in the arguments are passed along to the | ||||||||||||||||||||||||||||||||||||||||||
| 164 | SearchResultEventBuilder object which holds these factories and sets | ||||||||||||||||||||||||||||||||||||||||||
| 165 | default ones if none are supplied as arguments. | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | # TODO: The below don't seem to be implemented (e.g. in Bio::SearchIO::blast) | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # -score => integer or scientific notation number to be used | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # as a blast score value cutoff | ||||||||||||||||||||||||||||||||||||||||||
| 173 | # -bits => integer or scientific notation number to be used | ||||||||||||||||||||||||||||||||||||||||||
| 174 | # as a bit score value cutoff | ||||||||||||||||||||||||||||||||||||||||||
| 175 | # -overlap => integer. The amount of overlap to permit between | ||||||||||||||||||||||||||||||||||||||||||
| 176 | # adjacent HSPs when tiling HSPs. A reasonable value is 2. | ||||||||||||||||||||||||||||||||||||||||||
| 177 | # default = $Bio::SearchIO::blast::MAX_HSP_OVERLAP. | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 212 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=10 SCAR=24.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 212 | my($caller,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 212 | ▶ | my $class = ref($caller) || $caller; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $caller || $caller
MC/DC0%0/2
ref $caller || $caller
ref $caller
$caller
Truth table33%1/3
A || B
A= ref $callerB= $caller
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | # or do we want to call SUPER on an object if $caller is an | ||||||||||||||||||||||||||||||||||||||||||
| 184 | # object? | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 212 | ▶ | if( $class =~ /Bio::SearchIO::(\S+)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 106 | my ($self) = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 187 | 106 | $self->_initialize(@args); | |||||||||||||||||||||||||||||||||||||||||
| 188 | 106 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 106 | my %param = @args; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 106 | @param{ map { lc $_ } keys %param } = values %param; # lowercase keys | |||||||||||||||||||||||||||||||||||||||||
| 192 | my $format = $param{'-format'} || | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 106 | ▶ | $class->_guess_format( $param{'-file'} || $ARGV[0] ) || 'blast'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition62%5/8
$param{'-format'} || $class->_guess_format($param{'-file'} || $ARGV[0]) || 'blast'
$param{"-format"} or $class->_guess_format($param{"-file"} || $ARGV[0])
$param{'-file'} || $ARGV[0]
MC/DC50%1/2
$param{'-format'} || $class->_guess_format($param{'-file'} || $ARGV[0]) || 'blast'
$param{"-format"}
$class->_guess_format($param{"-file"} || $ARGV[0])
MC/DC0%0/2
$param{'-file'} || $ARGV[0]
$param{'-file'}
$ARGV[0]
Truth table66%2/3
A or B
A= $param{"-format"}B= $class->_guess_format($param{"-file"} || $ARGV[0])
Truth table33%1/3
A || B
A= $param{'-file'}B= $ARGV[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 106 | my $output_format = $param{'-output_format'}; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 106 | my $writer = undef; | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 106 | ▶ | if( defined $output_format ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | ▶ | if( defined $param{'-writer'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $dummy = Bio::Root::Root->new(); | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $dummy->throw("Both writer and output format specified - not good"); | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | ▶ | if( $output_format =~ /^blast$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $output_format = 'TextResultWriter'; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | my $output_module = "Bio::SearchIO::Writer::".$output_format; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | $class->_load_module($output_module); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | $writer = $output_module->new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | push(@args,"-writer",$writer); | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | # normalize capitalization to lower case | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 106 | $format = "\L$format"; | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 106 | ▶ | return unless( $class->_load_format_module($format) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 106 | return "Bio::SearchIO::${format}"->new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 94 | ▶ | sub _initialize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_initialize: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 94 | my($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 94 | $self->{'_handler'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 225 | # not really necessary unless we put more in RootI | ||||||||||||||||||||||||||||||||||||||||||
| 226 | #$self->SUPER::_initialize(@args); | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | # initialize the IO part | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 94 | $self->_initialize_io(@args); | |||||||||||||||||||||||||||||||||||||||||
| 230 | 94 | $self->attach_EventHandler(Bio::SearchIO::SearchResultEventBuilder->new(@args)); | |||||||||||||||||||||||||||||||||||||||||
| 231 | 94 | $self->{'_reporttype'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 94 | $self->{_notfirsttime} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 94 | my ($min_qlen, $check_all, $overlap, $best, $it, $writer ) = | |||||||||||||||||||||||||||||||||||||||||
| 234 | $self->_rearrange([qw( | ||||||||||||||||||||||||||||||||||||||||||
| 235 | MIN_LENGTH | ||||||||||||||||||||||||||||||||||||||||||
| 236 | CHECK_ALL_HITS | ||||||||||||||||||||||||||||||||||||||||||
| 237 | OVERLAP | ||||||||||||||||||||||||||||||||||||||||||
| 238 | BEST | ||||||||||||||||||||||||||||||||||||||||||
| 239 | INCLUSION_THRESHOLD | ||||||||||||||||||||||||||||||||||||||||||
| 240 | WRITER)], @args); # note: $overlap isn't used for some reason | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 94 | ▶ | $writer && $self->writer( $writer ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | 94 | ▶ | defined $it && $self->inclusion_threshold($it); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 94 | ▶ | defined $min_qlen && $self->min_query_length($min_qlen); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 94 | ▶ | defined $best && $self->best_hit_only($best); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | 94 | ▶ | defined $check_all && $self->check_all_hits($check_all); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | =head2 newFh | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | Title : newFh | ||||||||||||||||||||||||||||||||||||||||||
| 252 | Usage : $fh = Bio::SearchIO->newFh(-file=>$filename, | ||||||||||||||||||||||||||||||||||||||||||
| 253 | -format=>'Format') | ||||||||||||||||||||||||||||||||||||||||||
| 254 | Function: does a new() followed by an fh() | ||||||||||||||||||||||||||||||||||||||||||
| 255 | Example : $fh = Bio::SearchIO->newFh(-file=>$filename, | ||||||||||||||||||||||||||||||||||||||||||
| 256 | -format=>'Format') | ||||||||||||||||||||||||||||||||||||||||||
| 257 | $result = <$fh>; # read a ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 258 | print $fh $result; # write a ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 259 | Returns : filehandle tied to the Bio::SearchIO::Fh class | ||||||||||||||||||||||||||||||||||||||||||
| 260 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | sub newFh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
newFh: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | return unless my $self = $class->new(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | return $self->fh; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | =head2 fh | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | Title : fh | ||||||||||||||||||||||||||||||||||||||||||
| 273 | Usage : $obj->fh | ||||||||||||||||||||||||||||||||||||||||||
| 274 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 275 | Example : $fh = $obj->fh; # make a tied filehandle | ||||||||||||||||||||||||||||||||||||||||||
| 276 | $result = <$fh>; # read a ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 277 | print $fh $result; # write a ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 278 | Returns : filehandle tied to the Bio::SearchIO::Fh class | ||||||||||||||||||||||||||||||||||||||||||
| 279 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | sub fh { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fh: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | my $class = ref($self) || $self; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $s = Symbol::gensym; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | tie $$s,$class,$self; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | return $s; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | =head2 format | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | Title : format | ||||||||||||||||||||||||||||||||||||||||||
| 296 | Usage : $format = $obj->format() | ||||||||||||||||||||||||||||||||||||||||||
| 297 | Function: Get the search format | ||||||||||||||||||||||||||||||||||||||||||
| 298 | Returns : search format | ||||||||||||||||||||||||||||||||||||||||||
| 299 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | # format() method inherited from Bio::Root::IO | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | =head2 attach_EventHandler | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | Title : attach_EventHandler | ||||||||||||||||||||||||||||||||||||||||||
| 309 | Usage : $parser->attatch_EventHandler($handler) | ||||||||||||||||||||||||||||||||||||||||||
| 310 | Function: Adds an event handler to listen for events | ||||||||||||||||||||||||||||||||||||||||||
| 311 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 312 | Args : Bio::SearchIO::EventHandlerI | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | See L<Bio::SearchIO::EventHandlerI> | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 139 | ▶ | sub attach_EventHandler{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attach_EventHandler: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 139 | my ($self,$handler) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 320 | 139 | ▶ | return if( ! $handler ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 139 | ▶ | if( ! $handler->isa('Bio::SearchIO::EventHandlerI') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $self->warn("Ignoring request to attatch handler ".ref($handler). ' because it is not a Bio::SearchIO::EventHandlerI'); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 139 | $self->{'_handler'} = $handler; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 139 | return; | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | =head2 _eventHandler | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | Title : _eventHandler | ||||||||||||||||||||||||||||||||||||||||||
| 331 | Usage : private | ||||||||||||||||||||||||||||||||||||||||||
| 332 | Function: Get the EventHandler | ||||||||||||||||||||||||||||||||||||||||||
| 333 | Returns : Bio::SearchIO::EventHandlerI | ||||||||||||||||||||||||||||||||||||||||||
| 334 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | See L<Bio::SearchIO::EventHandlerI> | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 3970 | ▶ | sub _eventHandler{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_eventHandler: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 3970 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 3970 | return $self->{'_handler'}; | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | =head2 next_result | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | Title : next_result | ||||||||||||||||||||||||||||||||||||||||||
| 348 | Usage : $result = stream->next_result | ||||||||||||||||||||||||||||||||||||||||||
| 349 | Function: Reads the next ResultI object from the stream and returns it. | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | Certain driver modules may encounter entries in the stream that | ||||||||||||||||||||||||||||||||||||||||||
| 352 | are either misformatted or that use syntax not yet understood | ||||||||||||||||||||||||||||||||||||||||||
| 353 | by the driver. If such an incident is recoverable, e.g., by | ||||||||||||||||||||||||||||||||||||||||||
| 354 | dismissing a feature of a feature table or some other non-mandatory | ||||||||||||||||||||||||||||||||||||||||||
| 355 | part of an entry, the driver will issue a warning. In the case | ||||||||||||||||||||||||||||||||||||||||||
| 356 | of a non-recoverable situation an exception will be thrown. | ||||||||||||||||||||||||||||||||||||||||||
| 357 | Do not assume that you can resume parsing the same stream after | ||||||||||||||||||||||||||||||||||||||||||
| 358 | catching the exception. Note that you can always turn recoverable | ||||||||||||||||||||||||||||||||||||||||||
| 359 | errors into exceptions by calling $stream->verbose(2) (see | ||||||||||||||||||||||||||||||||||||||||||
| 360 | Bio::Root::RootI POD page). | ||||||||||||||||||||||||||||||||||||||||||
| 361 | Returns : A Bio::Search::Result::ResultI object | ||||||||||||||||||||||||||||||||||||||||||
| 362 | Args : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | See L<Bio::Root::RootI> | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub next_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_result: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | $self->throw_not_implemented; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | =head2 write_result | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | Title : write_result | ||||||||||||||||||||||||||||||||||||||||||
| 376 | Usage : $stream->write_result($result_result, @other_args) | ||||||||||||||||||||||||||||||||||||||||||
| 377 | Function: Writes data from the $result_result object into the stream. | ||||||||||||||||||||||||||||||||||||||||||
| 378 | : Delegates to the to_string() method of the associated | ||||||||||||||||||||||||||||||||||||||||||
| 379 | : WriterI object. | ||||||||||||||||||||||||||||||||||||||||||
| 380 | Returns : 1 for success and 0 for error | ||||||||||||||||||||||||||||||||||||||||||
| 381 | Args : Bio::Search:Result::ResultI object, | ||||||||||||||||||||||||||||||||||||||||||
| 382 | : plus any other arguments for the Writer | ||||||||||||||||||||||||||||||||||||||||||
| 383 | Throws : Bio::Root::Exception if a Writer has not been set. | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | See L<Bio::Root::Exception> | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 5 | ▶ | sub write_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_result: called CC=6 SCAR=19.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 5 | my ($self, $result, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 5 | ▶ | if( not ref($self->{'_result_writer'}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | $self->throw("ResultWriter not defined."); | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 5 | ▶ | @args = $self->{'_notfirsttime'} unless( @args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 5 | my $str = $self->writer->to_string( $result, @args); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 5 | $self->{'_notfirsttime'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 399 | 5 | ▶ | $self->_print( "$str" ) if defined $str; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 5 | ▶ | $self->flush if $self->_flush_on_write && defined $self->_fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_flush_on_write and defined $self->_fh
MC/DC0%0/2
$self->_flush_on_write and defined $self->_fh
$self->_flush_on_write
defined $self->_fh
Truth table33%1/3
A and B
A= $self->_flush_on_writeB= defined $self->_fh
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | =head2 write_report | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | Title : write_report | ||||||||||||||||||||||||||||||||||||||||||
| 408 | Usage : $stream->write_report(SearchIO stream, @other_args) | ||||||||||||||||||||||||||||||||||||||||||
| 409 | Function: Writes data directly from the SearchIO stream object into the | ||||||||||||||||||||||||||||||||||||||||||
| 410 | : writer. This is mainly useful if one has multiple ResultI objects | ||||||||||||||||||||||||||||||||||||||||||
| 411 | : in a SearchIO stream and you don't want to reiterate header/footer | ||||||||||||||||||||||||||||||||||||||||||
| 412 | : between each call. | ||||||||||||||||||||||||||||||||||||||||||
| 413 | Returns : 1 for success and 0 for error | ||||||||||||||||||||||||||||||||||||||||||
| 414 | Args : Bio::SearchIO stream object, | ||||||||||||||||||||||||||||||||||||||||||
| 415 | : plus any other arguments for the Writer | ||||||||||||||||||||||||||||||||||||||||||
| 416 | Throws : Bio::Root::Exception if a Writer has not been set. | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | See L<Bio::Root::Exception> | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | sub write_report { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_report: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my ($self, $result, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if( not ref($self->{'_result_writer'}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | $self->throw("ResultWriter not defined."); | |||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | @args = $self->{'_notfirsttime'} unless( @args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my $str = $self->writer->to_string( $result, @args); | |||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $self->{'_notfirsttime'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | $self->_print( "$str" ) if defined $str; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | $self->flush if $self->_flush_on_write && defined $self->_fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_flush_on_write and defined $self->_fh
MC/DC0%0/2
$self->_flush_on_write and defined $self->_fh
$self->_flush_on_write
defined $self->_fh
Truth table0%0/3
A and B
A= $self->_flush_on_writeB= defined $self->_fh
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | =head2 writer | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | Title : writer | ||||||||||||||||||||||||||||||||||||||||||
| 441 | Usage : $writer = $stream->writer; | ||||||||||||||||||||||||||||||||||||||||||
| 442 | Function: Sets/Gets a SearchWriterI object to be used for this searchIO. | ||||||||||||||||||||||||||||||||||||||||||
| 443 | Returns : 1 for success and 0 for error | ||||||||||||||||||||||||||||||||||||||||||
| 444 | Args : Bio::SearchIO::SearchWriterI object (when setting) | ||||||||||||||||||||||||||||||||||||||||||
| 445 | Throws : Bio::Root::Exception if a non-Bio::SearchIO::SearchWriterI object | ||||||||||||||||||||||||||||||||||||||||||
| 446 | is passed in. | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 325 | ▶ | sub writer { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
writer: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 451 | 325 | my ($self, $writer) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 452 | 325 | ▶ | if( ref($writer) and $writer->isa( 'Bio::SearchIO::SearchWriterI' )) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
ref $writer and $writer->isa("Bio::SearchIO::SearchWriterI")
MC/DC50%1/2
ref $writer and $writer->isa("Bio::SearchIO::SearchWriterI")
ref $writer
$writer->isa("Bio::SearchIO::SearchWriterI")
Truth table66%2/3
A and B
A= ref $writerB= $writer->isa("Bio::SearchIO::SearchWriterI")
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 5 | $self->{'_result_writer'} = $writer; | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | elsif( defined $writer ) { | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $self->throw("Can't set ResultWriter. Not a Bio::SearchIO::SearchWriterI: $writer"); | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 325 | return $self->{'_result_writer'}; | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | =head2 result_count | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | Title : result_count | ||||||||||||||||||||||||||||||||||||||||||
| 464 | Usage : $num = $stream->result_count; | ||||||||||||||||||||||||||||||||||||||||||
| 465 | Function: Gets the number of Blast results that have been successfully parsed | ||||||||||||||||||||||||||||||||||||||||||
| 466 | at the point of the method call. This is not the total # of results | ||||||||||||||||||||||||||||||||||||||||||
| 467 | in the file. | ||||||||||||||||||||||||||||||||||||||||||
| 468 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 469 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 470 | Throws : none | ||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | sub result_count { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
result_count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | $self->throw_not_implemented; | |||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | =head2 inclusion_threshold | ||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | Title : inclusion_threshold | ||||||||||||||||||||||||||||||||||||||||||
| 482 | Usage : my $incl_thresh = $isreb->inclusion_threshold; | ||||||||||||||||||||||||||||||||||||||||||
| 483 | : $isreb->inclusion_threshold(1e-5); | ||||||||||||||||||||||||||||||||||||||||||
| 484 | Function: Get/Set the e-value threshold for inclusion in the PSI-BLAST | ||||||||||||||||||||||||||||||||||||||||||
| 485 | score matrix model (blastpgp) that was used for generating the reports | ||||||||||||||||||||||||||||||||||||||||||
| 486 | being parsed. | ||||||||||||||||||||||||||||||||||||||||||
| 487 | Returns : number (real) | ||||||||||||||||||||||||||||||||||||||||||
| 488 | Default value: $Bio::SearchIO::IteratedSearchResultEventBuilder::DEFAULT_INCLUSION_THRESHOLD | ||||||||||||||||||||||||||||||||||||||||||
| 489 | Args : number (real) (e.g., 0.0001 or 1e-4 ) | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | # Delegates to the event handler. | ||||||||||||||||||||||||||||||||||||||||||
| 494 | 42 | ▶ | sub inclusion_threshold { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inclusion_threshold: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 42 | shift->_eventHandler->inclusion_threshold(@_); | |||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | =head2 max_significance | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | Usage : $obj->max_significance(); | ||||||||||||||||||||||||||||||||||||||||||
| 501 | Purpose : Set/Get the P or Expect value used as significance screening cutoff. | ||||||||||||||||||||||||||||||||||||||||||
| 502 | This is the value of the -signif parameter supplied to new(). | ||||||||||||||||||||||||||||||||||||||||||
| 503 | Hits with P or E-value above this are skipped. | ||||||||||||||||||||||||||||||||||||||||||
| 504 | Returns : Scientific notation number with this format: 1.0e-05. | ||||||||||||||||||||||||||||||||||||||||||
| 505 | Argument : Scientific notation number or float (when setting) | ||||||||||||||||||||||||||||||||||||||||||
| 506 | Comments : Screening of significant hits uses the data provided on the | ||||||||||||||||||||||||||||||||||||||||||
| 507 | : description line. For NCBI BLAST1 and WU-BLAST, this data | ||||||||||||||||||||||||||||||||||||||||||
| 508 | : is P-value. for NCBI BLAST2 it is an Expect value. | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | sub max_significance { shift->{'_handler_cache'}->max_significance(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_significance: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | =head2 signif | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | Synonym for L<max_significance()|max_significance> | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | sub signif { shift->max_significance(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signif: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | =head2 min_score | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | Usage : $obj->min_score(); | ||||||||||||||||||||||||||||||||||||||||||
| 525 | Purpose : Set/Get the Blast score used as screening cutoff. | ||||||||||||||||||||||||||||||||||||||||||
| 526 | This is the value of the -score parameter supplied to new(). | ||||||||||||||||||||||||||||||||||||||||||
| 527 | Hits with scores below this are skipped. | ||||||||||||||||||||||||||||||||||||||||||
| 528 | Returns : Integer or scientific notation number. | ||||||||||||||||||||||||||||||||||||||||||
| 529 | Argument : Integer or scientific notation number (when setting) | ||||||||||||||||||||||||||||||||||||||||||
| 530 | Comments : Screening of significant hits uses the data provided on the | ||||||||||||||||||||||||||||||||||||||||||
| 531 | : description line. | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | sub min_score { shift->{'_handler_cache'}->min_score(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min_score: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | =head2 min_query_length | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | Usage : $obj->min_query_length(); | ||||||||||||||||||||||||||||||||||||||||||
| 540 | Purpose : Gets the query sequence length used as screening criteria. | ||||||||||||||||||||||||||||||||||||||||||
| 541 | This is the value of the -min_query_len parameter supplied to new(). | ||||||||||||||||||||||||||||||||||||||||||
| 542 | Hits with sequence length below this are skipped. | ||||||||||||||||||||||||||||||||||||||||||
| 543 | Returns : Integer | ||||||||||||||||||||||||||||||||||||||||||
| 544 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | ▶ | sub min_query_length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min_query_length: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | my $min_qlen = shift; | |||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | if ( $min_qlen =~ /\D/ or $min_qlen <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$min_qlen =~ /\D/ or $min_qlen <= 0
MC/DC0%0/2
$min_qlen =~ /\D/ or $min_qlen <= 0
$min_qlen =~ /\D/
$min_qlen <= 0
Truth table0%0/3
A or B
A= $min_qlen =~ /\D/B= $min_qlen <= 0
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $self->throw( | |||||||||||||||||||||||||||||||||||||||||
| 554 | -class => 'Bio::Root::BadParameter', | ||||||||||||||||||||||||||||||||||||||||||
| 555 | -text => "Invalid minimum query length value: $min_qlen\n" | ||||||||||||||||||||||||||||||||||||||||||
| 556 | . "Value must be an integer > 0. Value not set.", | ||||||||||||||||||||||||||||||||||||||||||
| 557 | -value => $min_qlen | ||||||||||||||||||||||||||||||||||||||||||
| 558 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->{'_confirm_qlength'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $self->{'_min_query_length'} = $min_qlen; | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | return $self->{'_min_query_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | =head2 best_hit_only | ||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | Title : best_hit_only | ||||||||||||||||||||||||||||||||||||||||||
| 570 | Usage : print "only getting best hit.\n" if $obj->best_hit_only; | ||||||||||||||||||||||||||||||||||||||||||
| 571 | Purpose : Set/Get the indicator for whether or not to process only | ||||||||||||||||||||||||||||||||||||||||||
| 572 | : the best BlastHit. | ||||||||||||||||||||||||||||||||||||||||||
| 573 | Returns : Boolean (1 | 0) | ||||||||||||||||||||||||||||||||||||||||||
| 574 | Argument : Boolean (1 | 0) (when setting) | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | sub best_hit_only { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
best_hit_only: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | if (@_) { $self->{'_best'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $self->{'_best'}; | |||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | =head2 check_all_hits | ||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | Title : check_all_hits | ||||||||||||||||||||||||||||||||||||||||||
| 587 | Usage : print "checking all hits.\n" if $obj->check_all_hits; | ||||||||||||||||||||||||||||||||||||||||||
| 588 | Purpose : Set/Get the indicator for whether or not to process all hits. | ||||||||||||||||||||||||||||||||||||||||||
| 589 | : If false, the parser will stop processing hits after the | ||||||||||||||||||||||||||||||||||||||||||
| 590 | : the first non-significance hit or the first hit that fails | ||||||||||||||||||||||||||||||||||||||||||
| 591 | : any hit filter. | ||||||||||||||||||||||||||||||||||||||||||
| 592 | Returns : Boolean (1 | 0) | ||||||||||||||||||||||||||||||||||||||||||
| 593 | Argument : Boolean (1 | 0) (when setting) | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | sub check_all_hits { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_all_hits: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | ▶ | if (@_) { $self->{'_check_all'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $self->{'_check_all'}; | |||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | =head2 _load_format_module | ||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | Title : _load_format_module | ||||||||||||||||||||||||||||||||||||||||||
| 606 | Usage : *INTERNAL SearchIO stuff* | ||||||||||||||||||||||||||||||||||||||||||
| 607 | Function: Loads up (like use) a module at run time on demand | ||||||||||||||||||||||||||||||||||||||||||
| 608 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 609 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 610 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | 106 | ▶ | sub _load_format_module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_format_module: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 615 | 106 | my ($self,$format) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 616 | 106 | my $module = "Bio::SearchIO::" . $format; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 106 | my $ok; | |||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||
| 619 | 106 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 620 | 106 | $ok = $self->_load_module($module); | |||||||||||||||||||||||||||||||||||||||||
| 621 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 622 | 106 | ▶ | if ( $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | print STDERR <<END; | |||||||||||||||||||||||||||||||||||||||||
| 624 | $self: $format cannot be found | ||||||||||||||||||||||||||||||||||||||||||
| 625 | Exception $@ | ||||||||||||||||||||||||||||||||||||||||||
| 626 | For more information about the SearchIO system please see the SearchIO docs. | ||||||||||||||||||||||||||||||||||||||||||
| 627 | This includes ways of checking for formats at compile time, not run time | ||||||||||||||||||||||||||||||||||||||||||
| 628 | END | ||||||||||||||||||||||||||||||||||||||||||
| 629 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | 106 | return $ok; | |||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | =head2 _get_seq_identifiers | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | Title : _get_seq_identifiers | ||||||||||||||||||||||||||||||||||||||||||
| 637 | Usage : my ($gi, $acc,$ver) = &_get_seq_identifiers($id) | ||||||||||||||||||||||||||||||||||||||||||
| 638 | Function: Private function to get the gi, accession, version data | ||||||||||||||||||||||||||||||||||||||||||
| 639 | for an ID (if it is in NCBI format) | ||||||||||||||||||||||||||||||||||||||||||
| 640 | Returns : 3-pule of gi, accession, version | ||||||||||||||||||||||||||||||||||||||||||
| 641 | Args : ID string to process (NCBI format) | ||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | 1062 | ▶ | sub _get_seq_identifiers { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_seq_identifiers: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 647 | 1062 | my ($self, $id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | 1062 | ▶ | return unless defined $id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 650 | 1060 | my ($gi, $acc, $version ); | |||||||||||||||||||||||||||||||||||||||||
| 651 | 1060 | ▶ | if ( $id =~ /^gi\|(\d+)\|/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 123 | $gi = $1; | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 1060 | ▶ | if ( $id =~ /(gb|emb|dbj|sp|pdb|bbs|ref|lcl)\|(.*)\|(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 655 | 520 | ( $acc, $version ) = split /\./, $2; | |||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | elsif ( $id =~ /(pir|prf|pat|gnl)\|(.*)\|(.*)/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 658 | 4 | ( $acc, $version ) = split /\./, $3; | |||||||||||||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||||||||||||
| 660 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | #punt, not matching the db's at ftp://ftp.ncbi.nih.gov/blast/db/README | ||||||||||||||||||||||||||||||||||||||||||
| 663 | #Database Name Identifier Syntax | ||||||||||||||||||||||||||||||||||||||||||
| 664 | #============================ ======================== | ||||||||||||||||||||||||||||||||||||||||||
| 665 | #GenBank gb|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 666 | #EMBL Data Library emb|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 667 | #DDBJ, DNA Database of Japan dbj|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 668 | #NBRF PIR pir||entry | ||||||||||||||||||||||||||||||||||||||||||
| 669 | #Protein Research Foundation prf||name | ||||||||||||||||||||||||||||||||||||||||||
| 670 | #SWISS-PROT sp|accession|entry name | ||||||||||||||||||||||||||||||||||||||||||
| 671 | #Brookhaven Protein Data Bank pdb|entry|chain | ||||||||||||||||||||||||||||||||||||||||||
| 672 | #Patents pat|country|number | ||||||||||||||||||||||||||||||||||||||||||
| 673 | #GenInfo Backbone Id bbs|number | ||||||||||||||||||||||||||||||||||||||||||
| 674 | #General database identifier gnl|database|identifier | ||||||||||||||||||||||||||||||||||||||||||
| 675 | #NCBI Reference Sequence ref|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 676 | #Local Sequence identifier lcl|identifier | ||||||||||||||||||||||||||||||||||||||||||
| 677 | 536 | $acc = $id; | |||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||
| 679 | 1060 | return ($gi, $acc, $version ); | |||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||
| 682 | =head2 _guess_format | ||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||
| 684 | Title : _guess_format | ||||||||||||||||||||||||||||||||||||||||||
| 685 | Usage : $obj->_guess_format($filename) | ||||||||||||||||||||||||||||||||||||||||||
| 686 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 687 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 688 | Returns : guessed format of filename (lower case) | ||||||||||||||||||||||||||||||||||||||||||
| 689 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | 24 | ▶ | sub _guess_format { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_guess_format: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 694 | 24 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 695 | 24 | ▶ | return unless $_ = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 696 | 24 | ▶ | return 'blast' if (/\.(blast|t?bl\w)$/i ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 697 | 19 | ▶ | return 'fasta' if (/\. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | (?: t? fas (?:ta)? | | ||||||||||||||||||||||||||||||||||||||||||
| 699 | m\d+ | | ||||||||||||||||||||||||||||||||||||||||||
| 700 | (?: t? (?: fa | fx | fy | ff | fs ) ) | | ||||||||||||||||||||||||||||||||||||||||||
| 701 | (?: (?:ss | os | ps) (?:earch)? )) | ||||||||||||||||||||||||||||||||||||||||||
| 702 | $/ix ); | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 10 | ▶ | return 'blastxml' if ( /\.(blast)?xml$/i); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 704 | 8 | ▶ | return 'exonerate' if ( /\.exon(erate)?/i ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||
| 707 | 305 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | 305 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | 305 | ▶ | if( $self->writer ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 711 | 5 | $self->_print($self->writer->end_report()); | |||||||||||||||||||||||||||||||||||||||||
| 712 | 5 | $self->{'_result_writer'}= undef; | |||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||
| 714 | 305 | $self->SUPER::close(@_); | |||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | 106 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 718 | 106 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 719 | 106 | ▶ | $self->close() if defined $self->_fh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | 106 | $self->SUPER::DESTROY; | |||||||||||||||||||||||||||||||||||||||||
| 721 | } | ||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | sub TIEHANDLE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHANDLE: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | return bless {processor => shift}, $class; | |||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | ▶ | sub READLINE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
READLINE: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | return $self->{'processor'}->next_result() || undef unless wantarray; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{'processor'}->next_result || undef
MC/DC0%0/1
$self->{'processor'}->next_result || undef
$self->{'processor'}->next_result
Truth table0%0/2
A
A= $self->{'processor'}->next_result
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | my (@list, $obj); | |||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | push @list, $obj while $obj = $self->{'processor'}->next_result(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | return @list; | |||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | ▶ | sub PRINT { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PRINT: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | $self->{'processor'}->write_result(@_); | |||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | 48 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | __END__ | ||||||||||||||||||||||||||||||||||||||||||