| 1 | # | ||||||||||
| 2 | # BioPerl module for Bio::Search::HSP::PSLHSP | ||||||||||
| 3 | # | ||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||
| 5 | # | ||||||||||
| 6 | # Cared for by Jason Stajich <jason-at-bioperl-dot-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::Search::HSP::PSLHSP - A HSP for PSL output | ||||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | # get a PSLHSP somehow (SearchIO::psl) | ||||||||||
| 21 | |||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||
| 23 | |||||||||||
| 24 | This is a HSP for PSL output so we can handle seq_inds differently. | ||||||||||
| 25 | |||||||||||
| 26 | =head1 FEEDBACK | ||||||||||
| 27 | |||||||||||
| 28 | =head2 Mailing Lists | ||||||||||
| 29 | |||||||||||
| 30 | User feedback is an integral part of the evolution of this and other | ||||||||||
| 31 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||
| 32 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||
| 33 | |||||||||||
| 34 | bioperl-l@bioperl.org - General discussion | ||||||||||
| 35 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||
| 36 | |||||||||||
| 37 | =head2 Support | ||||||||||
| 38 | |||||||||||
| 39 | Please direct usage questions or support issues to the mailing list: | ||||||||||
| 40 | |||||||||||
| 41 | I<bioperl-l@bioperl.org> | ||||||||||
| 42 | |||||||||||
| 43 | rather than to the module maintainer directly. Many experienced and | ||||||||||
| 44 | reponsive experts will be able look at the problem and quickly | ||||||||||
| 45 | address it. Please include a thorough description of the problem | ||||||||||
| 46 | with code and data examples if at all possible. | ||||||||||
| 47 | |||||||||||
| 48 | =head2 Reporting Bugs | ||||||||||
| 49 | |||||||||||
| 50 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||
| 51 | of the bugs and their resolution. Bug reports can be submitted via | ||||||||||
| 52 | the web: | ||||||||||
| 53 | |||||||||||
| 54 | https://github.com/bioperl/bioperl-live/issues | ||||||||||
| 55 | |||||||||||
| 56 | =head1 AUTHOR - Jason Stajich | ||||||||||
| 57 | |||||||||||
| 58 | Email jason-at-bioperl-dot-org | ||||||||||
| 59 | |||||||||||
| 60 | =head1 APPENDIX | ||||||||||
| 61 | |||||||||||
| 62 | The rest of the documentation details each of the object methods. | ||||||||||
| 63 | Internal methods are usually preceded with a _ | ||||||||||
| 64 | |||||||||||
| 65 | =cut | ||||||||||
| 66 | |||||||||||
| 67 | |||||||||||
| 68 | # Let the code begin... | ||||||||||
| 69 | |||||||||||
| 70 | |||||||||||
| 71 | package Bio::Search::HSP::PSLHSP; | ||||||||||
| 72 | 2 | $Bio::Search::HSP::PSLHSP::VERSION = '1.7.8'; | |||||||||
| 73 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 74 | |||||||||||
| 75 | # Object preamble - inherits from Bio::Root::Root | ||||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | 2 | ▶ | use base qw(Bio::Search::HSP::GenericHSP); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 79 | |||||||||||
| 80 | =head2 new | ||||||||||
| 81 | |||||||||||
| 82 | Title : new | ||||||||||
| 83 | Usage : my $obj = Bio::Search::HSP::PSLHSP->new(); | ||||||||||
| 84 | Function: Builds a new Bio::Search::HSP::PSLHSP object | ||||||||||
| 85 | Returns : an instance of Bio::Search::HSP::PSLHSP | ||||||||||
| 86 | Args : -gapblocks => arrayref of gap locations which are [start,length] | ||||||||||
| 87 | of gaps | ||||||||||
| 88 | |||||||||||
| 89 | |||||||||||
| 90 | =cut | ||||||||||
| 91 | |||||||||||
| 92 | 5 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||
| 93 | 5 | my ($class,@args) = @_; | |||||||||
| 94 | 5 | my $self = $class->SUPER::new(@args); | |||||||||
| 95 | 5 | my ($qgaplocs, | |||||||||
| 96 | $hgaplocs, | ||||||||||
| 97 | $mismatches) = $self->_rearrange([qw(QUERY_GAPBLOCKS | ||||||||||
| 98 | HIT_GAPBLOCKS | ||||||||||
| 99 | MISMATCHES)], | ||||||||||
| 100 | @args); | ||||||||||
| 101 | 5 | ▶ | $self->gap_blocks('query',$qgaplocs) if defined $qgaplocs; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 102 | 5 | ▶ | $self->gap_blocks('hit', $hgaplocs) if defined $hgaplocs; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 103 | 5 | ▶ | $self->mismatches($mismatches) if defined $mismatches; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 104 | 5 | return $self; | |||||||||
| 105 | } | ||||||||||
| 106 | |||||||||||
| 107 | =head2 gap_blocks | ||||||||||
| 108 | |||||||||||
| 109 | Title : gap_blocks | ||||||||||
| 110 | Usage : $obj->gap_blocks($seqtype,$blocks) | ||||||||||
| 111 | Function: Get/Set the gap blocks | ||||||||||
| 112 | Returns : value of gap_blocks (a scalar) | ||||||||||
| 113 | Args : sequence type - 'query' or 'hit' | ||||||||||
| 114 | blocks - arrayref of block start,length | ||||||||||
| 115 | |||||||||||
| 116 | |||||||||||
| 117 | =cut | ||||||||||
| 118 | |||||||||||
| 119 | 14 | ▶ | sub gap_blocks { | ||||||||
|
Subroutine
gap_blocks: called CC=5 SCAR=17.1
Pod
documented
| |||||||||||
| 120 | 14 | my ($self,$seqtype,$blocks) = @_; | |||||||||
| 121 | 0 | ▶ | if( ! defined $seqtype ) { $seqtype = 'query' } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 122 | 14 | $seqtype = lc($seqtype); | |||||||||
| 123 | 14 | ▶ | $seqtype = 'hit' if $seqtype eq 'sbjct'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 124 | 14 | ▶ | if( $seqtype !~ /query|hit/i ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 125 | 0 | $self->warn("Expect either 'query' or 'hit' as argument 1 for gap_blocks"); | |||||||||
| 126 | } | ||||||||||
| 127 | |||||||||||
| 128 | 14 | ▶ | unless( defined $blocks ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 129 | 4 | return $self->{'_gap_blocks'}->{$seqtype}; | |||||||||
| 130 | } else { | ||||||||||
| 131 | 10 | return $self->{'_gap_blocks'}->{$seqtype} = $blocks; | |||||||||
| 132 | } | ||||||||||
| 133 | } | ||||||||||
| 134 | |||||||||||
| 135 | =head2 mismatches | ||||||||||
| 136 | |||||||||||
| 137 | Title : mismatches | ||||||||||
| 138 | Usage : $obj->mismatches($newval) | ||||||||||
| 139 | Function: Get/Set the number of mismatches | ||||||||||
| 140 | Returns : value of mismatches (a scalar) | ||||||||||
| 141 | Args : on set, new value (a scalar or undef, optional) | ||||||||||
| 142 | |||||||||||
| 143 | |||||||||||
| 144 | =cut | ||||||||||
| 145 | |||||||||||
| 146 | 5 | ▶ | sub mismatches{ | ||||||||
|
Subroutine
mismatches: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||
| 147 | 5 | my $self = shift; | |||||||||
| 148 | 5 | ▶ | return $self->{'mismatches'} = shift if @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 149 | 0 | return $self->{'mismatches'}; | |||||||||
| 150 | } | ||||||||||
| 151 | |||||||||||
| 152 | 2 | 1; | |||||||||