| 1 | # |
| 2 | # Perl Module for HMMResults |
| 3 | # |
| 4 | # Please direct questions and support issues to <[email protected]> |
| 5 | # |
| 6 | # Cared for by Ewan Birney <[email protected]> |
| 7 | # |
| 8 | #Copyright Genome Research Limited (1997). |
| 9 | |
| 10 | =head1 NAME |
| 11 | |
| 12 | Bio::Tools::HMMER::Results - Object representing HMMER output results |
| 13 | |
| 14 | =head1 SYNOPSIS |
| 15 | |
| 16 | # parse a hmmsearch file (can also parse a hmmpfam file) |
| 17 | $res = Bio::Tools::HMMER::Results->new( -file => 'output.hmm' , |
| 18 | -type => 'hmmsearch'); |
| 19 | |
| 20 | # print out the results for each sequence |
| 21 | foreach $seq ( $res->each_Set ) { |
| 22 | print "Sequence bit score is",$seq->bits,"\n"; |
| 23 | foreach $domain ( $seq->each_Domain ) { |
| 24 | print " Domain start ",$domain->start," end ",$domain->end, |
| 25 | " score ",$domain->bits,"\n"; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | # new result object on a sequence/domain cutoff of |
| 30 | # 25 bits sequence, 15 bits domain |
| 31 | $newresult = $res->filter_on_cutoff(25,15); |
| 32 | |
| 33 | # alternative way of getting out all domains directly |
| 34 | foreach $domain ( $res->each_Domain ) { |
| 35 | print "Domain on ",$domain->seq_id," with score ", |
| 36 | $domain->bits," evalue ",$domain->evalue,"\n"; |
| 37 | } |
| 38 | |
| 39 | =head1 DESCRIPTION |
| 40 | |
| 41 | This object represents HMMER output, either from hmmsearch or |
| 42 | hmmpfam. For hmmsearch, a series of HMMER::Set objects are made, one |
| 43 | for each sequence, which have the the bits score for the object. For |
| 44 | hmmpfam searches, only one Set object is made. |
| 45 | |
| 46 | |
| 47 | These objects come from the original HMMResults modules used |
| 48 | internally in Pfam, written by Ewan Birney. Ewan then converted them to |
| 49 | BioPerl objects in 1999. That conversion is meant to be backwardly |
| 50 | compatible, but may not be (caveat emptor). |
| 51 | |
| 52 | =head1 FEEDBACK |
| 53 | |
| 54 | =head2 Mailing Lists |
| 55 | |
| 56 | User feedback is an integral part of the evolution of this and other |
| 57 | Bioperl modules. Send your comments and suggestions preferably to one |
| 58 | of the Bioperl mailing lists. Your participation is much appreciated. |
| 59 | |
| 60 | [email protected] - General discussion |
| 61 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
| 62 | |
| 63 | =head2 Support |
| 64 | |
| 65 | Please direct usage questions or support issues to the mailing list: |
| 66 | |
| 67 | I<[email protected]> |
| 68 | |
| 69 | rather than to the module maintainer directly. Many experienced and |
| 70 | reponsive experts will be able look at the problem and quickly |
| 71 | address it. Please include a thorough description of the problem |
| 72 | with code and data examples if at all possible. |
| 73 | |
| 74 | =head2 Reporting Bugs |
| 75 | |
| 76 | Report bugs to the Bioperl bug tracking system to help us keep track |
| 77 | the bugs and their resolution. Bug reports can be submitted via the |
| 78 | web: |
| 79 | |
| 80 | https://github.com/bioperl/bioperl-live/issues |
| 81 | |
| 82 | =head1 AUTHOR - Ewan Birney |
| 83 | |
| 84 | Email [email protected] |
| 85 | |
| 86 | =head1 CONTRIBUTORS |
| 87 | |
| 88 | Jason Stajich, jason-at-bioperl.org |
| 89 | |
| 90 | =head1 APPENDIX |
| 91 | |
| 92 | The rest of the documentation details each of the object |
| 93 | methods. Internal methods are usually preceded with a _ |
| 94 | |
| 95 | =cut |
| 96 | |
| 97 | package Bio::Tools::HMMER::Resultsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/; |
| 98 | $Bio::Tools::HMMER::Results::VERSIONscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$VERSION. = '1.7.3'; |
| 99 | use strictscip-perl cpan Bio-SearchIO-hmmer 1.7.3 strict/; |
| 100 | |
| 101 | use Bio::Tools::HMMER::Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/; |
| 102 | use Bio::Tools::HMMER::Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/; |
| 103 | use Symbolscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Symbol/; |
| 104 | |
| 105 | use basescip-perl cpan Bio-SearchIO-hmmer 1.7.3 base/ qw(Bio::Root::Root Bio::Root::IO Bio::SeqAnalysisParserI); |
| 106 | |
| 107 | sub newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/new(). { |
| 108 | my($class,@args) = @_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/`@_`.; |
| 109 | |
| 110 | my $self = $class->SUPER::newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/`SUPER::new`().(@args); |
| 111 | |
| 112 | $self->{'domain'} = []; # array of HMMUnits |
| 113 | $self->{'seq'} = {}; |
| 114 | |
| 115 | my ($parsetype) = $self->_rearrangescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_rearrange().([qw(TYPE)],@args); |
| 116 | $self->_initialize_ioscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_initialize_io().(@args); |
| 117 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $parsetype ) { |
| 118 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("No parse type provided. should be hmmsearch or hmmpfam"); |
| 119 | } |
| 120 | $self->parsetypescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/parsetype().($parsetype); |
| 121 | if( definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $self->_fhscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_fh().() ) { |
| 122 | if( $parsetype eq 'hmmsearch' ) { |
| 123 | $self->_parse_hmmsearchscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_parse_hmmsearch().($self->_fhscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_fh().()); |
| 124 | } elsif ( $parsetype eq 'hmmpfam' ) { |
| 125 | $self->_parse_hmmpfamscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_parse_hmmpfam().($self->_fhscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_fh().()); |
| 126 | } else { |
| 127 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("Did not recoginise type $parsetype"); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | return $self; # success - we hope! |
| 132 | } |
| 133 | |
| 134 | |
| 135 | =head2 next_feature |
| 136 | |
| 137 | Title : next_feature |
| 138 | Usage : while( my $feat = $res->next_feature ) { # do something } |
| 139 | Function: SeqAnalysisParserI implementing function |
| 140 | Example : |
| 141 | Returns : A Bio::SeqFeatureI compliant object, in this case, |
| 142 | each DomainUnit object, ie, flattening the Sequence |
| 143 | aspect of this. |
| 144 | Args : None |
| 145 | |
| 146 | |
| 147 | =cut |
| 148 | |
| 149 | sub next_featurescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/next_feature().{ |
| 150 | my ($self) = @_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/`@_`.; |
| 151 | |
| 152 | if( $self->{'_started_next_feature'} == 1 ) { |
| 153 | return shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift(). @{$self->{'_next_feature_array'}}; |
| 154 | } else { |
| 155 | $self->{'_started_next_feature'} = 1; |
| 156 | my @array; |
| 157 | foreach my $seq ( $self->each_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Set().() ) { |
| 158 | foreach my $unit ( $seq->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().() ) { |
| 159 | pushscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/push().(@array,$unit); |
| 160 | } |
| 161 | } |
| 162 | my $res = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift(). @array; |
| 163 | $self->{'_next_feature_array'} = \@array; |
| 164 | return $res; |
| 165 | } |
| 166 | |
| 167 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("Should not reach here! Error!"); |
| 168 | } |
| 169 | |
| 170 | |
| 171 | =head2 number |
| 172 | |
| 173 | Title : number |
| 174 | Usage : print "There are ",$res->number," domains hit\n"; |
| 175 | Function: provides the number of domains in the HMMER report |
| 176 | |
| 177 | =cut |
| 178 | |
| 179 | sub numberscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/number(). { |
| 180 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 181 | my @val; |
| 182 | my $ref; |
| 183 | $ref = $self->{'domain'}; |
| 184 | |
| 185 | |
| 186 | @val = @{$self->{'domain'}}; |
| 187 | return scalarscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/scalar(). @val; |
| 188 | } |
| 189 | |
| 190 | =head2 seqfile |
| 191 | |
| 192 | Title : seqfile |
| 193 | Usage : $obj->seqfile($newval) |
| 194 | Function: |
| 195 | Example : |
| 196 | Returns : value of seqfile |
| 197 | Args : newvalue (optional) |
| 198 | |
| 199 | |
| 200 | =cut |
| 201 | |
| 202 | sub seqfilescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seqfile().{ |
| 203 | my ($self,$value) = @_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/`@_`.; |
| 204 | if( definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $value) { |
| 205 | $self->{'seqfile'} = $value; |
| 206 | } |
| 207 | return $self->{'seqfile'}; |
| 208 | |
| 209 | } |
| 210 | |
| 211 | =head2 hmmfile |
| 212 | |
| 213 | Title : hmmfile |
| 214 | Usage : $obj->hmmfile($newval) |
| 215 | Function: |
| 216 | Example : |
| 217 | Returns : value of hmmfile |
| 218 | Args : newvalue (optional) |
| 219 | |
| 220 | |
| 221 | =cut |
| 222 | |
| 223 | sub hmmfilescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmfile().{ |
| 224 | my ($self,$value) = @_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/`@_`.; |
| 225 | if( definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $value) { |
| 226 | $self->{'hmmfile'} = $value; |
| 227 | } |
| 228 | return $self->{'hmmfile'}; |
| 229 | |
| 230 | } |
| 231 | |
| 232 | =head2 add_Domain |
| 233 | |
| 234 | Title : add_Domain |
| 235 | Usage : $res->add_Domain($unit) |
| 236 | Function: adds a domain to the results array. Mainly used internally. |
| 237 | Args : A Bio::Tools::HMMER::Domain |
| 238 | |
| 239 | |
| 240 | =cut |
| 241 | |
| 242 | sub add_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Domain(). { |
| 243 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 244 | my $unit = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 245 | my $name; |
| 246 | |
| 247 | $name = $unit->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seq_id().(); |
| 248 | |
| 249 | if( ! existsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/exists(). $self->{'seq'}->{$name} ) { |
| 250 | $self->warnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/warn().("Adding a domain of $name but with no HMMSequence. Will be kept in domain array but not added to a HMMSequence"); |
| 251 | } else { |
| 252 | $self->{'seq'}->{$name}->add_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Domain().($unit); |
| 253 | } |
| 254 | pushscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/push().(@{$self->{'domain'}},$unit); |
| 255 | } |
| 256 | |
| 257 | |
| 258 | =head2 each_Domain |
| 259 | |
| 260 | Title : each_Domain |
| 261 | Usage : foreach $domain ( $res->each_Domain() ) |
| 262 | Function: array of Domain units which are held in this report |
| 263 | Returns : array |
| 264 | Args : none |
| 265 | |
| 266 | |
| 267 | =cut |
| 268 | |
| 269 | sub each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain(). { |
| 270 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 271 | my (@arr,$u); |
| 272 | |
| 273 | foreach $u ( @{$self->{'domain'}} ) { |
| 274 | pushscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/push().(@arr,$u); |
| 275 | } |
| 276 | |
| 277 | return @arr; |
| 278 | } |
| 279 | |
| 280 | |
| 281 | =head2 domain_bits_cutoff_from_evalue |
| 282 | |
| 283 | Title : domain_bits_cutoff_from_evalue |
| 284 | Usage : $cutoff = domain_bits_cutoff_from_evalue(0.01); |
| 285 | Function: return a bits cutoff from an evalue using the |
| 286 | scores here. Somewhat interesting logic: |
| 287 | Find the two bit score which straddle the evalue |
| 288 | if( 25 is between these two points) return 25 |
| 289 | else return the midpoint. |
| 290 | |
| 291 | This logic tries to ensure that with large signal to |
| 292 | noise separation one still has sensible 25 bit cutoff |
| 293 | Returns : |
| 294 | Args : |
| 295 | |
| 296 | =cut |
| 297 | |
| 298 | sub domain_bits_cutoff_from_evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/domain_bits_cutoff_from_evalue(). { |
| 299 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 300 | my $eval = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 301 | my ($dom,$prev,@doms,$cutoff,$sep,$seen); |
| 302 | |
| 303 | @doms = $self->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().; |
| 304 | |
| 305 | |
| 306 | @doms = mapscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/map(). { $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.->[0] } |
| 307 | sortscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sort(). { $bscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$b.->[1] <=> $ascip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$a.->[1] } |
| 308 | mapscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/map(). { [ $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_., $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().] } @doms; |
| 309 | $seen = 0; |
| 310 | foreach $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. ( @doms ) { |
| 311 | if( $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/evalue(). > $eval ) { |
| 312 | $seen = 1; |
| 313 | $dom = $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.; |
| 314 | last; |
| 315 | } |
| 316 | $prev = $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.; |
| 317 | } |
| 318 | |
| 319 | if( ! definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $prev || $seen == 0) { |
| 320 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("Evalue is either above or below the list..."); |
| 321 | return; |
| 322 | } |
| 323 | |
| 324 | $sep = $prev->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits(). - $dom->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits(). ; |
| 325 | |
| 326 | if( $sep < 1 ) { |
| 327 | return $prev->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 328 | } |
| 329 | if( $dom->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits(). < 25 && $prev->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits(). > 25 ) { |
| 330 | return 25; |
| 331 | } |
| 332 | |
| 333 | return intscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/int().( $dom->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits(). + $sep/2 ) ; |
| 334 | |
| 335 | } |
| 336 | |
| 337 | |
| 338 | sub dictate_hmm_accscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/dictate_hmm_acc(). { |
| 339 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 340 | my $acc = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 341 | my ($unit); |
| 342 | |
| 343 | |
| 344 | foreach $unit ( $self->eachHMMUnitscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMUnit().() ) { |
| 345 | $unit->hmmaccscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmacc().($acc); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | =head2 write_FT_output |
| 350 | |
| 351 | Title : write_FT_output |
| 352 | Usage : $res->write_FT_output(\*STDOUT,'DOMAIN') |
| 353 | Function: writes feature table output ala swissprot |
| 354 | Returns : |
| 355 | Args : |
| 356 | |
| 357 | |
| 358 | =cut |
| 359 | |
| 360 | sub write_FT_outputscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/write_FT_output(). { |
| 361 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 362 | my $file = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 363 | my $idt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 364 | my ($seq,$unit); |
| 365 | |
| 366 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $idt ) { |
| 367 | $idt = "DOMAIN"; |
| 368 | } |
| 369 | |
| 370 | foreach $seq ( $self->each_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Set().() ) { |
| 371 | printscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/print(). $file sprintfscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sprintf().("ID %s\n",$seq->namescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/name().()); |
| 372 | foreach $unit ( $seq->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().() ) { |
| 373 | printscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/print(). $file sprintfscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sprintf().("FT %s %d %d %s\n",$idt, |
| 374 | $unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().,$unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/end().,$unit->hmmnamescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmname().); |
| 375 | } |
| 376 | print $file "//\n"; |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | =head2 filter_on_cutoff |
| 381 | |
| 382 | Title : filter_on_cutoff |
| 383 | Usage : $newresults = $results->filter_on_cutoff(25,15); |
| 384 | Function: Produces a new HMMER::Results module which has |
| 385 | been trimmed at the cutoff. |
| 386 | Returns : a Bio::Tools::HMMER::Results module |
| 387 | Args : sequence cutoff and domain cutoff. in bits score |
| 388 | if you want one cutoff, simply use same number both places |
| 389 | |
| 390 | =cut |
| 391 | |
| 392 | sub filter_on_cutoffscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/filter_on_cutoff(). { |
| 393 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 394 | my $seqthr = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 395 | my $domthr = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 396 | my ($new,$seq,$unit,@array,@narray); |
| 397 | |
| 398 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $domthr ) { |
| 399 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("hmmresults filter on cutoff needs two arguments"); |
| 400 | } |
| 401 | |
| 402 | $new = Bio::Tools::HMMER::Results->newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/new().(-type => $self->parsetypescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/parsetype().); |
| 403 | |
| 404 | foreach $seq ( $self->each_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Set().()) { |
| 405 | next if( $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $seqthr ); |
| 406 | $new->add_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Set().($seq); |
| 407 | foreach $unit ( $seq->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().() ) { |
| 408 | next if( $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $domthr ); |
| 409 | $new->add_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Domain().($unit); |
| 410 | } |
| 411 | } |
| 412 | $new; |
| 413 | } |
| 414 | |
| 415 | =head2 write_ascii_out |
| 416 | |
| 417 | Title : write_ascii_out |
| 418 | Usage : $res->write_ascii_out(\*STDOUT) |
| 419 | Function: writes as |
| 420 | seq seq_start seq_end model-acc model_start model_end model_name |
| 421 | Returns : |
| 422 | Args : |
| 423 | |
| 424 | FIXME: Now that we have no modelacc, this is probably a bad thing. |
| 425 | |
| 426 | =cut |
| 427 | |
| 428 | # writes as seq sstart send modelacc hstart hend modelname |
| 429 | |
| 430 | sub write_ascii_outscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/write_ascii_out(). { |
| 431 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 432 | my $fh = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 433 | my ($unit,$seq); |
| 434 | |
| 435 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $fh) { |
| 436 | $fh = \*STDOUT; |
| 437 | } |
| 438 | |
| 439 | |
| 440 | foreach $seq ( $self->each_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Set().()) { |
| 441 | foreach $unit ( $seq->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().()) { |
| 442 | printscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/print(). $fh sprintfscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sprintf().("%s %4d %4d %s %4d %4d %4.2f %4.2g %s\n", |
| 443 | $unit->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seq_id().(),$unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().(),$unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/end().(), |
| 444 | $unit->hmmaccscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmacc().,$unit->hstartscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hstart().,$unit->hendscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hend()., |
| 445 | $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().,$unit->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/evalue().,$unit->hmmnamescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmname().); |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | } |
| 450 | |
| 451 | =head2 write_GDF_bits |
| 452 | |
| 453 | Title : write_GDF_bits |
| 454 | Usage : $res->write_GDF_bits(25,15,\*STDOUT) |
| 455 | Function: writes GDF format with a sequence,domain threshold |
| 456 | Returns : |
| 457 | Args : |
| 458 | |
| 459 | =cut |
| 460 | |
| 461 | sub write_GDF_bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/write_GDF_bits(). { |
| 462 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 463 | my $seqt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 464 | my $domt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 465 | my $file = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 466 | my $seq; |
| 467 | my $unit; |
| 468 | my (@array,@narray); |
| 469 | |
| 470 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $file ) { |
| 471 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("Attempting to use write_GDF_bits without passing in correct arguments!"); |
| 472 | return; |
| 473 | } |
| 474 | |
| 475 | foreach $seq ( $self->each_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Set().()) { |
| 476 | |
| 477 | if( $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $seqt ) { |
| 478 | next; |
| 479 | } |
| 480 | |
| 481 | foreach $unit ( $seq->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().() ) { |
| 482 | if( $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $domt ) { |
| 483 | next; |
| 484 | } |
| 485 | pushscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/push().(@array,$unit); |
| 486 | } |
| 487 | |
| 488 | } |
| 489 | |
| 490 | @narray = sortscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sort(). { my ($aa,$bb,$st_a,$st_b); |
| 491 | $aa = $ascip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$a.->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seq_id().(); |
| 492 | $bb = $bscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$b.->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seq_id().(); |
| 493 | if ( $aa eq $bb) { |
| 494 | $st_a = $ascip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$a.->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().(); |
| 495 | $st_b = $bscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$b.->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().(); |
| 496 | return $st_a <=> $st_b; |
| 497 | } |
| 498 | else { |
| 499 | return $aa cmp $bb; |
| 500 | } } @array; |
| 501 | |
| 502 | foreach $unit ( @narray ) { |
| 503 | printscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/print(). $file sprintfscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sprintf().("%-24s\t%6d\t%6d\t%15s\t%.1f\t%g\n",$unit->get_nsescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_nse().(),$unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().(),$unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/end().(),$unit->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seq_id().(),$unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(),$unit->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/evalue().); |
| 504 | } |
| 505 | |
| 506 | } |
| 507 | |
| 508 | sub write_scores_bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/write_scores_bits(). { |
| 509 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 510 | my $seqt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 511 | my $domt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 512 | my $file = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 513 | my $seq; |
| 514 | my $unit; |
| 515 | my (@array,@narray); |
| 516 | |
| 517 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $file ) { |
| 518 | $self->warnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/warn().("Attempting to use write_scores_bits without passing in correct arguments!"); |
| 519 | return; |
| 520 | } |
| 521 | |
| 522 | foreach $seq ( $self->eachHMMSequencescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMSequence().()) { |
| 523 | |
| 524 | if( $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $seqt ) { |
| 525 | next; |
| 526 | } |
| 527 | |
| 528 | foreach $unit ( $seq->eachHMMUnitscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMUnit().() ) { |
| 529 | if( $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $domt ) { |
| 530 | next; |
| 531 | } |
| 532 | pushscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/push().(@array,$unit); |
| 533 | } |
| 534 | |
| 535 | } |
| 536 | |
| 537 | @narray = sortscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sort(). { my ($aa,$bb,$st_a,$st_b); |
| 538 | $aa = $ascip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$a.->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 539 | $bb = $bscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$b.->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 540 | return $aa <=> $bb; |
| 541 | } @array; |
| 542 | |
| 543 | foreach $unit ( @narray ) { |
| 544 | printscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/print(). $file sprintfscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sprintf().("%4.2f %s\n",$unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(),$unit->get_nsescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_nse().()); |
| 545 | } |
| 546 | |
| 547 | } |
| 548 | |
| 549 | sub write_GDFscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/write_GDF(). { |
| 550 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 551 | my $file = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 552 | my $unit; |
| 553 | |
| 554 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $file ) { |
| 555 | $file = \*STDOUT; |
| 556 | } |
| 557 | |
| 558 | |
| 559 | foreach $unit ( $self->eachHMMUnitscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMUnit().() ) { |
| 560 | printscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/print(). $file sprintfscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/sprintf().("%-24s\t%6d\t%6d\t%15s\t%.1f\t%g\n",$unit->get_nsescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_nse().(),$unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().(),$unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/end().(),$unit->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seq_id().(),$unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(),$unit->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/evalue().); |
| 561 | } |
| 562 | |
| 563 | } |
| 564 | |
| 565 | sub highest_noisescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/highest_noise(). { |
| 566 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 567 | my $seqt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 568 | my $domt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 569 | my ($seq,$unit,$hseq,$hdom,$noiseseq,$noisedom); |
| 570 | |
| 571 | $hseq = $hdom = -100000; |
| 572 | |
| 573 | foreach $seq ( $self->eachHMMSequencescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMSequence().()) { |
| 574 | if( $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $seqt && $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() > $hseq ) { |
| 575 | $hseq = $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 576 | $noiseseq = $seq; |
| 577 | } |
| 578 | foreach $unit ( $seq->eachHMMUnitscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMUnit().() ) { |
| 579 | if( (($seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $seqt) || ($seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() > $seqt && $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits(). < $domt)) && $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() > $hdom ) { |
| 580 | $hdom = $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 581 | $noisedom = $unit; |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | |
| 587 | return ($noiseseq,$noisedom); |
| 588 | |
| 589 | } |
| 590 | |
| 591 | |
| 592 | sub lowest_truescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/lowest_true(). { |
| 593 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 594 | my $seqt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 595 | my $domt = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 596 | my ($seq,$unit,$lowseq,$lowdom,$trueseq,$truedom); |
| 597 | |
| 598 | if( ! definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $domt ) { |
| 599 | $self->warnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/warn().("lowest true needs at least a domain threshold cut-off"); |
| 600 | return (0,0); |
| 601 | } |
| 602 | |
| 603 | $lowseq = $lowdom = 100000; |
| 604 | |
| 605 | foreach $seq ( $self->eachHMMSequencescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMSequence().()) { |
| 606 | |
| 607 | if( $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() >= $seqt && $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $lowseq ) { |
| 608 | $lowseq = $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 609 | $trueseq = $seq; |
| 610 | } |
| 611 | if( $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $seqt ) { |
| 612 | next; |
| 613 | } |
| 614 | |
| 615 | foreach $unit ( $seq->eachHMMUnitscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/eachHMMUnit().() ) { |
| 616 | if( $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() >= $domt && $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().() < $lowdom ) { |
| 617 | $lowdom = $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/bits().(); |
| 618 | $truedom = $unit; |
| 619 | } |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | |
| 624 | return ($trueseq,$truedom); |
| 625 | |
| 626 | } |
| 627 | |
| 628 | |
| 629 | |
| 630 | =head2 add_Set |
| 631 | |
| 632 | Title : add_Set |
| 633 | Usage : Mainly internal function |
| 634 | Function: |
| 635 | Returns : |
| 636 | Args : |
| 637 | |
| 638 | |
| 639 | =cut |
| 640 | |
| 641 | sub add_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Set(). { |
| 642 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 643 | my $seq = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 644 | my $name; |
| 645 | |
| 646 | $name = $seq->namescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/name().(); |
| 647 | |
| 648 | if( existsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/exists(). $self->{'seq'}->{$name} ) { |
| 649 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("You alredy have $name in HMMResults!"); |
| 650 | } |
| 651 | $self->{'seq'}->{$name} = $seq; |
| 652 | } |
| 653 | |
| 654 | |
| 655 | =head2 each_Set |
| 656 | |
| 657 | Title : each_Set |
| 658 | Usage : |
| 659 | Function: |
| 660 | Returns : |
| 661 | Args : |
| 662 | |
| 663 | |
| 664 | =cut |
| 665 | |
| 666 | sub each_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Set(). { |
| 667 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 668 | my (@array,$name); |
| 669 | |
| 670 | |
| 671 | foreach $name ( keysscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/keys(). %{$self->{'seq'}} ) { |
| 672 | pushscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/push().(@array,$self->{'seq'}->{$name}); |
| 673 | } |
| 674 | return @array; |
| 675 | } |
| 676 | |
| 677 | |
| 678 | =head2 get_Set |
| 679 | |
| 680 | Title : get_Set |
| 681 | Usage : $set = $res->get_Set('sequence-name'); |
| 682 | Function: returns the Set for a particular sequence |
| 683 | Returns : a HMMER::Set object |
| 684 | Args : name of the sequence |
| 685 | |
| 686 | |
| 687 | =cut |
| 688 | |
| 689 | sub get_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_Set(). { |
| 690 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 691 | my $name = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 692 | |
| 693 | return $self->{'seq'}->{$name}; |
| 694 | } |
| 695 | |
| 696 | |
| 697 | =head2 _parse_hmmpfam |
| 698 | |
| 699 | Title : _parse_hmmpfam |
| 700 | Usage : $res->_parse_hmmpfam($filehandle) |
| 701 | Function: |
| 702 | Returns : |
| 703 | Args : |
| 704 | |
| 705 | |
| 706 | =cut |
| 707 | |
| 708 | sub _parse_hmmpfamscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_parse_hmmpfam(). { |
| 709 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 710 | my $file = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 711 | |
| 712 | my ($id,$sqfrom,$sqto,$hmmf,$hmmt,$sc,$ev, |
| 713 | $unit,$nd,$seq,$name,$seqname,$from, |
| 714 | $to,%hash,%acc,$acc); |
| 715 | my $count = 0; |
| 716 | |
| 717 | while(<$file>) { |
| 718 | if( /^HMM file:\s+(\S+)/ ) { $self->hmmfilescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmfile().($1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.); next; } |
| 719 | elsif( /^Sequence file:\s+(\S+)/ ) { $self->seqfilescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seqfile().($1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.); next } |
| 720 | elsif( /^Query(\s+sequence)?:\s+(\S+)/ ) { |
| 721 | |
| 722 | $seqname = $2scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$2.; |
| 723 | |
| 724 | $seq = Bio::Tools::HMMER::Set->newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/new().(); |
| 725 | |
| 726 | $seq ->namescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/name().($seqname); |
| 727 | $self->add_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Set().($seq); |
| 728 | %hash = (); |
| 729 | |
| 730 | while(<$file>){ |
| 731 | |
| 732 | if( /Accession:\s+(\S+)/ ) { $seq->accessionscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/accession().($1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.); next } |
| 733 | elsif( s/^Description:\s+// ) { chompscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/chomp().; $seq->descscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/desc().($_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.); next } |
| 734 | /^Parsed for domains/ && last; |
| 735 | |
| 736 | # This is to parse out the accession numbers in old Pfam format. |
| 737 | # now not support due to changes in HMMER. |
| 738 | |
| 739 | if( (($id,$acc, $sc, $ev, $nd) = /^\s*(\S+)\s+(\S+).+?\s(\S+)\s+(\S+)\s+(\d+)\s*$/)) { |
| 740 | $hash{$id} = $sc; # we need this for the sequence |
| 741 | # core of the domains below! |
| 742 | $acc {$id} = $acc; |
| 743 | |
| 744 | # this is the more common parsing routine |
| 745 | } elsif ( (($id,$sc, $ev, $nd) = |
| 746 | /^\s*(\S+).+?\s(\S+)\s+(\S+)\s+(\d+)\s*$/) ) { |
| 747 | |
| 748 | $hash{$id} = $sc; # we need this for the |
| 749 | # sequence score of hte domains below! |
| 750 | |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | while(<$file>) { |
| 755 | /^Align/ && last; |
| 756 | m{^//} && last; |
| 757 | # this is meant to match |
| 758 | |
| 759 | #Sequence Domain seq-f seq-t hmm-f hmm-t score E-value |
| 760 | #-------- ------- ----- ----- ----- ----- ----- ------- |
| 761 | #PF00621 1/1 198 372 .. 1 207 [] 281.6 1e-80 |
| 762 | |
| 763 | if( (($id, $sqfrom, $sqto, $hmmf,$hmmt,$sc, $ev) = |
| 764 | /(\S+)\s+\S+\s+(\d+)\s+(\d+).+?(\d+)\s+(\d+)\s+\S+\s+(\S+)\s+(\S+)\s*$/)) { |
| 765 | $unit = Bio::Tools::HMMER::Domain->newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/new().(); |
| 766 | $unit->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/seq_id(). ($seqname); |
| 767 | $unit->hmmnamescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hmmname(). ($id); |
| 768 | $unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/start(). ($sqfrom); |
| 769 | $unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/end(). ($sqto); |
| 770 | $unit->hstartscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hstart().($hmmf); |
| 771 | $unit->hendscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hend(). ($hmmt); |
| 772 | $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/bits(). ($sc); |
| 773 | $unit->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/evalue(). ($ev); |
| 774 | |
| 775 | if( !existsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/exists().($hash{$id}) ) { |
| 776 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("HMMResults parsing error in hmmpfam for $id - can't find sequecne score"); |
| 777 | } |
| 778 | |
| 779 | $unit->seqbitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/seqbits().($hash{$id}); |
| 780 | |
| 781 | if( definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $acc{$id} ) { |
| 782 | $unit->hmmaccscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hmmacc().($acc{$id}); |
| 783 | } |
| 784 | |
| 785 | # this should find it's own sequence! |
| 786 | $self->add_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Domain().($unit); |
| 787 | } |
| 788 | } |
| 789 | if( m{^//} ) { next; } |
| 790 | |
| 791 | $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. = <$file>; |
| 792 | # parses alignment lines. Icky as we have to break on the same line |
| 793 | # that we need to read to place the alignment lines with the unit. |
| 794 | |
| 795 | while(1) { |
| 796 | (!definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. || m{^//}) && last; |
| 797 | |
| 798 | # matches: |
| 799 | # PF00621: domain 1 of 1, from 198 to 372 |
| 800 | if( /^\s*(\S+):.*from\s+(\d+)\s+to\s+(\d+)/ ) { |
| 801 | |
| 802 | $name = $1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.; |
| 803 | $from = $2scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$2.; |
| 804 | $to = $3scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$3.; |
| 805 | |
| 806 | # find the HMMUnit which this alignment is from |
| 807 | |
| 808 | $unit = $self->get_unit_nsescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_unit_nse().($seqname,$name,$from,$to); |
| 809 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $unit ) { |
| 810 | $self->warnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/warn().("Could not find $name $from $to unit even though I am reading it in. ugh!"); |
| 811 | $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. = <$file>; |
| 812 | next; |
| 813 | } |
| 814 | while(<$file>) { |
| 815 | m{^//} && last; |
| 816 | /^\s*\S+:.*from\s+\d+\s+to\s+\d+/ && last; |
| 817 | $unit->add_alignment_linescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_alignment_line().($_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.); |
| 818 | } |
| 819 | } else { |
| 820 | $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. = <$file>; |
| 821 | } |
| 822 | } |
| 823 | |
| 824 | # back to main 'Query:' loop |
| 825 | } |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | # mainly internal function |
| 830 | |
| 831 | sub get_unit_nsescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_unit_nse(). { |
| 832 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 833 | my $seqname = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 834 | my $domname = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 835 | my $start = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 836 | my $end = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 837 | |
| 838 | my($seq,$unit); |
| 839 | |
| 840 | $seq = $self->get_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_Set().($seqname); |
| 841 | |
| 842 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $seq ) { |
| 843 | $self->throwscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/throw().("Could not get sequence name $seqname - so can't get its unit"); |
| 844 | } |
| 845 | |
| 846 | foreach $unit ( $seq->each_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/each_Domain().() ) { |
| 847 | if( $unit->hmmnamescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmname().() eq $domname && $unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/start().() == $start && $unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/end().() == $end ) { |
| 848 | return $unit; |
| 849 | } |
| 850 | } |
| 851 | |
| 852 | return; |
| 853 | } |
| 854 | |
| 855 | |
| 856 | =head2 _parse_hmmsearch |
| 857 | |
| 858 | Title : _parse_hmmsearch |
| 859 | Usage : $res->_parse_hmmsearch($filehandle) |
| 860 | Function: |
| 861 | Returns : |
| 862 | Args : |
| 863 | |
| 864 | |
| 865 | =cut |
| 866 | |
| 867 | sub _parse_hmmsearchscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/_parse_hmmsearch(). { |
| 868 | my $self = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 869 | my $file = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/shift().; |
| 870 | my ($id,$sqfrom,$sqto,$sc,$ev,$unit,$nd,$seq,$hmmf,$hmmt, |
| 871 | $hmmfname,$hmmacc, $hmmid, %seqh); |
| 872 | my $count = 0; |
| 873 | |
| 874 | while(<$file>) { |
| 875 | /^HMM file:\s+(\S+)/ and do { $self->hmmfilescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/hmmfile().($1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.); $hmmfname = $1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1. }; |
| 876 | /^Accession:\s+(\S+)/ and do { $hmmacc = $1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1. }; |
| 877 | /^Query HMM:\s+(\S+)/ and do { $hmmid = $1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1. }; |
| 878 | /^Sequence database:\s+(\S+)/ and do { $self->seqfilescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/seqfile().($1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.) }; |
| 879 | /^Scores for complete sequences/ && last; |
| 880 | } |
| 881 | |
| 882 | $hmmfname = "given" if not $hmmfname; |
| 883 | |
| 884 | while(<$file>) { |
| 885 | /^Parsed for domains/ && last; |
| 886 | if( (($id, $sc, $ev, $nd) = /(\S+).+?\s(\S+)\s+(\S+)\s+(\d+)\s*$/)) { |
| 887 | $seq = Bio::Tools::HMMER::Set->newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/new().(); |
| 888 | $seq->namescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/name().($id); |
| 889 | $seq->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/bits().($sc); |
| 890 | $seqh{$id} = $sc; |
| 891 | $seq->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/evalue().($ev); |
| 892 | $self->add_Setscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Set().($seq); |
| 893 | $seq->accessionscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Set/accession().($hmmacc); |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | while(<$file>) { |
| 898 | /^Alignments of top-scoring domains/ && last; |
| 899 | if( (($id, $sqfrom, $sqto, $hmmf, $hmmt, $sc, $ev) = /(\S+)\s+\S+\s+(\d+)\s+(\d+).+?(\d+)\s+(\d+)\s+\S+\s+(\S+)\s+(\S+)\s*$/)) { |
| 900 | $unit = Bio::Tools::HMMER::Domain->newscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/new().(); |
| 901 | |
| 902 | $unit->seq_idscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/seq_id().($id); |
| 903 | $unit->hmmnamescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hmmname().($hmmfname); |
| 904 | $unit->startscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/start().($sqfrom); |
| 905 | $unit->endscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/end().($sqto); |
| 906 | $unit->bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/bits().($sc); |
| 907 | $unit->hstartscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hstart().($hmmf); |
| 908 | $unit->hendscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/hend().($hmmt); |
| 909 | $unit->evaluescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/evalue().($ev); |
| 910 | $unit->seqbitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Domain/seqbits().($seqh{$id}); |
| 911 | $self->add_Domainscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_Domain().($unit); |
| 912 | $count++; |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. = <$file>; |
| 917 | |
| 918 | ## Recognize and store domain alignments |
| 919 | |
| 920 | while(1) { |
| 921 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. ) { |
| 922 | last; |
| 923 | } |
| 924 | /^Histogram of all scores/ && last; |
| 925 | |
| 926 | # matches: |
| 927 | # PF00621: domain 1 of 1, from 198 to 372 |
| 928 | if( /^\s*(\S+):.*from\s+(\d+)\s+to\s+(\d+)/ ) { |
| 929 | my $name = $1scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$1.; |
| 930 | my $from = $2scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$2.; |
| 931 | my $to = $3scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$3.; |
| 932 | |
| 933 | # find the HMMUnit which this alignment is from |
| 934 | $unit = $self->get_unit_nsescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/get_unit_nse().($name,$hmmfname,$from,$to); |
| 935 | |
| 936 | if( !definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $unit ) { |
| 937 | $self->warnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/warn().("Could not find $name $from $to unit even though I am reading it in. ugh!"); |
| 938 | next; |
| 939 | } |
| 940 | while(<$file>) { |
| 941 | /^Histogram of all scores/ && last; |
| 942 | /^\s*\S+:.*from\s+\d+\s+to\s+\d+/ && last; |
| 943 | $unit->add_alignment_linescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/add_alignment_line().($_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_.); |
| 944 | } |
| 945 | } |
| 946 | else { |
| 947 | $_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/$_. = <$file>; |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | return $count; |
| 952 | } |
| 953 | |
| 954 | =head2 parsetype |
| 955 | |
| 956 | Title : parsetype |
| 957 | Usage : $obj->parsetype($newval) |
| 958 | Function: |
| 959 | Returns : value of parsetype |
| 960 | Args : newvalue (optional) |
| 961 | |
| 962 | |
| 963 | =cut |
| 964 | |
| 965 | sub parsetypescip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/parsetype().{ |
| 966 | my ($self,$value) = @_scip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/`@_`.; |
| 967 | if( definedscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Tools/HMMER/Results/defined(). $value) { |
| 968 | $self->{'_parsetype'} = $value; |
| 969 | } |
| 970 | return $self->{'_parsetype'}; |
| 971 | } |
| 972 | |
| 973 | 1; # says use was ok |
| 974 | __END__ |
| 975 | |
| 976 |