| 1 | # $Id$ | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # BioPerl module for Bio::Tools::Run::Alignment::DBA | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | # Copyright Shawn Hoon | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||
| 8 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | Bio::Tools::Run::Alignment::DBA - Object for the alignment of two | ||||||||||||||||||||||||||||
| 13 | sequences using the DNA Block Aligner program. | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | use Bio::Tools::Run::Alignment::DBA; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # Build a dba alignment factory | ||||||||||||||||||||||||||||
| 20 | my @params = ('matchA' => 0.75, | ||||||||||||||||||||||||||||
| 21 | 'matchB' => '0.55', | ||||||||||||||||||||||||||||
| 22 | 'dymem' =>'linear'); | ||||||||||||||||||||||||||||
| 23 | my $factory = Bio::Tools::Run::Alignment::DBA->new(@params); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # Pass the factory a filename with 2 sequences to be aligned. | ||||||||||||||||||||||||||||
| 26 | $inputfilename = 't/data/dbaseq.fa'; | ||||||||||||||||||||||||||||
| 27 | # @hsps is an array of GenericHSP objects | ||||||||||||||||||||||||||||
| 28 | my @hsps = $factory->align($inputfilename); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # or | ||||||||||||||||||||||||||||
| 31 | my @files = ('t/data/dbaseq1.fa','t/data/dbaseq2.fa'); | ||||||||||||||||||||||||||||
| 32 | my @hsps = $factory->align(\@files); | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # or where @seq_array is an array of Bio::Seq objects | ||||||||||||||||||||||||||||
| 35 | $seq_array_ref = \@seq_array; | ||||||||||||||||||||||||||||
| 36 | my @hsps = $factory->align($seq_array_ref); | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | DNA Block Aligner program (DBA) was developed by Ewan Birney. DBA | ||||||||||||||||||||||||||||
| 41 | is part of the Wise package available at | ||||||||||||||||||||||||||||
| 42 | L<http://www.sanger.ac.uk/software/wise2>. | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | You will need to enable dba to find the dba program. This can | ||||||||||||||||||||||||||||
| 45 | be done in a few different ways: | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1. Define an environmental variable WISEDIR: | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | export WISEDIR =/usr/local/share/wise2.2.0 | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2. Include a definition of an environmental variable WISEDIR in | ||||||||||||||||||||||||||||
| 52 | every script that will use DBA.pm: | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | $ENV{WISEDIR} = '/usr/local/share/wise2.2.20'; | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 3. Make sure that the dba application is in your PATH. | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 63 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||
| 64 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 67 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =head2 Support | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 76 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 77 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 78 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 83 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||
| 84 | web: | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | http://redmine.open-bio.org/projects/bioperl/ | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =head1 AUTHOR - Shawn Hoon | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Email shawnh@fugu-sg.org | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||
| 95 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =cut | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | package Bio::Tools::Run::Alignment::DBA; | ||||||||||||||||||||||||||||
| 100 | 1 | use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR $PROGRAMNAME | |||||||||||||||||||||||||||
| 101 | 1 | ▶ | @DBA_SWITCHES @DBA_PARAMS @OTHER_SWITCHES %OK_FIELD); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 102 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 103 | 1 | ▶ | use Bio::SeqIO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 104 | 1 | ▶ | use Bio::SimpleAlign; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 105 | 1 | ▶ | use Bio::AlignIO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 107 | 1 | ▶ | use Bio::Root::IO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 108 | 1 | ▶ | use Bio::Factory::ApplicationFactoryI; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 109 | 1 | ▶ | use Bio::Search::HSP::GenericHSP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 110 | 1 | ▶ | use Bio::Tools::Run::WrapperBase; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 1 | @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase); | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | BEGIN { | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 1 | ▶ | @DBA_PARAMS = qw(MATCHA MATCHB MATCHC MATCHD GAP BLOCKOPEN UMATCH SINGLE | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 117 | NOMATCHN PARAMS KBYTE DYMEM DYDEBUG ERRORLOG); | ||||||||||||||||||||||||||||
| 118 | 1 | @OTHER_SWITCHES = qw(OUTFILE); | |||||||||||||||||||||||||||
| 119 | 1 | @DBA_SWITCHES = qw(HELP SILENT QUIET ERROROFFSTD ALIGN LABEL); | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | # Authorize attribute fields | ||||||||||||||||||||||||||||
| 122 | 1 | foreach my $attr ( @DBA_PARAMS, @DBA_SWITCHES, | |||||||||||||||||||||||||||
| 123 | 21 | @OTHER_SWITCHES) { $OK_FIELD{$attr}++; } | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | =head2 program_name | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | Title : program_name | ||||||||||||||||||||||||||||
| 129 | Usage : $factory>program_name() | ||||||||||||||||||||||||||||
| 130 | Function: holds the program name | ||||||||||||||||||||||||||||
| 131 | Returns: string | ||||||||||||||||||||||||||||
| 132 | Args : None | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =cut | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | sub program_name { | ||||||||||||||||||||||||||||
| 137 | 6 | ▶ | return 'dba'; | ||||||||||||||||||||||||||
|
Subroutine
program_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | =head2 program_dir | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | Title : program_dir | ||||||||||||||||||||||||||||
| 143 | Usage : $factory->program_dir(@params) | ||||||||||||||||||||||||||||
| 144 | Function: returns the program directory, obtained from ENV variable. | ||||||||||||||||||||||||||||
| 145 | Returns: string | ||||||||||||||||||||||||||||
| 146 | Args : | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =cut | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | sub program_dir { | ||||||||||||||||||||||||||||
| 151 | 3 | ▶ | return Bio::Root::IO->catfile($ENV{WISEDIR},"/src/bin") if $ENV{WISEDIR}; | ||||||||||||||||||||||||||
|
Subroutine
program_dir: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | sub new { | ||||||||||||||||||||||||||||
| 155 | 1 | ▶ | my ($class, @args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||
| 156 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 1 | my ($attr, $value); | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 1 | ▶ | while (@args) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | 3 | $attr = shift @args; | |||||||||||||||||||||||||||
| 162 | 3 | $value = shift @args; | |||||||||||||||||||||||||||
| 163 | 3 | ▶ | next if( $attr =~ /^-/ ); # don't want named parameters | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 3 | ▶ | if ($attr =~/'PROGRAM'/i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | $self->executable($value); | |||||||||||||||||||||||||||
| 166 | 0 | next; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | 3 | $self->$attr($value); | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | 1 | return $self; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | sub AUTOLOAD { | ||||||||||||||||||||||||||||
| 174 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 175 | 3 | my $attr = $AUTOLOAD; | |||||||||||||||||||||||||||
| 176 | 3 | $attr =~ s/.*:://; | |||||||||||||||||||||||||||
| 177 | 3 | $attr = uc $attr; | |||||||||||||||||||||||||||
| 178 | 3 | ▶ | $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 179 | 3 | ▶ | $self->{$attr} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 3 | return $self->{$attr}; | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | =head2 version | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | Title : version | ||||||||||||||||||||||||||||
| 186 | Usage : exit if $prog->version() < 1.8 | ||||||||||||||||||||||||||||
| 187 | Function: Determine the version number of the program | ||||||||||||||||||||||||||||
| 188 | Example : | ||||||||||||||||||||||||||||
| 189 | Returns : float or undef | ||||||||||||||||||||||||||||
| 190 | Args : none | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =cut | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | sub version { | ||||||||||||||||||||||||||||
| 195 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
version: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | 0 | my $exe = $self->executable(); | |||||||||||||||||||||||||||
| 198 | 0 | ▶ | return undef unless defined $exe; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | my $string = `$exe -- ` ; | |||||||||||||||||||||||||||
| 200 | 0 | $string =~ /\(([\d.]+)\)/; | |||||||||||||||||||||||||||
| 201 | 0 | ▶ | return $1 || undef; | ||||||||||||||||||||||||||
|
Condition0%0/2
$1 || undef
MC/DC0%0/1
$1 || undef
$1
Truth table0%0/2
A
A= $1
| |||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | =head2 align | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | Title : align | ||||||||||||||||||||||||||||
| 207 | Usage : | ||||||||||||||||||||||||||||
| 208 | $inputfilename = 't/data/seq.fa'; | ||||||||||||||||||||||||||||
| 209 | @hsps = $factory->align($inputfilename); | ||||||||||||||||||||||||||||
| 210 | or | ||||||||||||||||||||||||||||
| 211 | #@seq_array is array of Seq objs | ||||||||||||||||||||||||||||
| 212 | $seq_array_ref = \@seq_array; | ||||||||||||||||||||||||||||
| 213 | @hsps = $factory->align($seq_array_ref); | ||||||||||||||||||||||||||||
| 214 | or | ||||||||||||||||||||||||||||
| 215 | my @files = ('t/data/seq1.fa','t/data/seq2.fa'); | ||||||||||||||||||||||||||||
| 216 | @hsps = $factory->align(\@files); | ||||||||||||||||||||||||||||
| 217 | Function: Perform a DBA alignment | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | Returns : An array of Bio::Search::HSP::GenericHSP objects | ||||||||||||||||||||||||||||
| 221 | Args : Name of a file containing a set of 2 fasta sequences | ||||||||||||||||||||||||||||
| 222 | or else a reference to an array to 2 Bio::Seq objects. | ||||||||||||||||||||||||||||
| 223 | or else a reference to an array of 2 file | ||||||||||||||||||||||||||||
| 224 | names containing 1 fasta sequence each | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | Throws an exception if argument is not either a string (eg a | ||||||||||||||||||||||||||||
| 227 | filename) or a reference to an array of 2 Bio::Seq objects. If | ||||||||||||||||||||||||||||
| 228 | argument is string, throws exception if file corresponding to string | ||||||||||||||||||||||||||||
| 229 | name can not be found. If argument is Bio::Seq array, throws | ||||||||||||||||||||||||||||
| 230 | exception if less than two sequence objects are in array. | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | sub align { | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my ($self,$input) = @_; | ||||||||||||||||||||||||||
|
Subroutine
align: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 237 | 0 | my ($temp,$infile1, $infile2, $seq); | |||||||||||||||||||||||||||
| 238 | 0 | my ($attr, $value, $switch); | |||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | # Create input file pointer | ||||||||||||||||||||||||||||
| 241 | 0 | ($infile1,$infile2)= $self->_setinput($input); | |||||||||||||||||||||||||||
| 242 | 0 | ▶ | if (!($infile1 && $infile2)) {$self->throw("Bad input data (sequences need an id ) or less than 2 sequences in $input !");} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$infile1 and $infile2
MC/DC0%0/2
$infile1 and $infile2
$infile1
$infile2
Truth table0%0/3
A and B
A= $infile1B= $infile2
| |||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | # Create parameter string to pass to dba program | ||||||||||||||||||||||||||||
| 245 | 0 | my $param_string = $self->_setparams(); | |||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | # run dba | ||||||||||||||||||||||||||||
| 248 | 0 | my @hsps = $self->_run($infile1,$infile2,$param_string); | |||||||||||||||||||||||||||
| 249 | 0 | return @hsps; | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | ################################################# | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =head2 _run | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | Title : _run | ||||||||||||||||||||||||||||
| 257 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 258 | Function: makes actual system call to dba program | ||||||||||||||||||||||||||||
| 259 | Example : | ||||||||||||||||||||||||||||
| 260 | Returns : nothing; dba output is written to a temp file | ||||||||||||||||||||||||||||
| 261 | Args : Name of a file containing a set of unaligned fasta sequences | ||||||||||||||||||||||||||||
| 262 | and hash of parameters to be passed to dba | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | =cut | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | sub _run { | ||||||||||||||||||||||||||||
| 267 | 0 | ▶ | my ($self,$infile1,$infile2,$param_string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_run: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 268 | 0 | my $instring; | |||||||||||||||||||||||||||
| 269 | 0 | $self->debug( "Program ".$self->executable."\n"); | |||||||||||||||||||||||||||
| 270 | 0 | ▶ | unless( $self->outfile){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | 0 | my ($tfh, $outfile) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 272 | 0 | close($tfh); | |||||||||||||||||||||||||||
| 273 | 0 | undef $tfh; | |||||||||||||||||||||||||||
| 274 | 0 | $self->outfile($outfile); | |||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | 0 | my $outfile = $self->outfile(); | |||||||||||||||||||||||||||
| 277 | 0 | my $commandstring = $self->executable." $param_string -pff $infile1 $infile2 > $outfile"; | |||||||||||||||||||||||||||
| 278 | 0 | $self->debug( "dba command = $commandstring"); | |||||||||||||||||||||||||||
| 279 | 0 | my $status = system($commandstring); | |||||||||||||||||||||||||||
| 280 | 0 | ▶ | $self->throw( "DBA call ($commandstring) crashed: $? \n") unless $status==0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 281 | #parse pff format and return a Bio::Search::HSP::GenericHSP array | ||||||||||||||||||||||||||||
| 282 | 0 | my $hsps = $self->_parse_results($outfile); | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 0 | return @{$hsps}; | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | =head2 _parse_results | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | Title : __parse_results | ||||||||||||||||||||||||||||
| 290 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 291 | Function: Parses dba output | ||||||||||||||||||||||||||||
| 292 | Example : | ||||||||||||||||||||||||||||
| 293 | Returns : an reference to an array of GenericHSPs | ||||||||||||||||||||||||||||
| 294 | Args : the name of the output file | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | =cut | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | sub _parse_results { | ||||||||||||||||||||||||||||
| 299 | 0 | ▶ | my ($self,$outfile) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_parse_results: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||
| 300 | 0 | ▶ | $outfile||$self->throw("No outfile specified"); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 301 | 0 | my ($start,$end,$name,$seqname,$seq,$seqchar,$tempname,%align); | |||||||||||||||||||||||||||
| 302 | 0 | my $count = 0; | |||||||||||||||||||||||||||
| 303 | 0 | my @hsps; | |||||||||||||||||||||||||||
| 304 | 0 | open(OUT,$outfile); | |||||||||||||||||||||||||||
| 305 | 0 | my (%query,%subject); | |||||||||||||||||||||||||||
| 306 | 0 | ▶ | while(my $entry = <OUT>){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 307 | 0 | ▶ | if($entry =~ /^>(.+)/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 308 | 0 | $tempname = $1; | |||||||||||||||||||||||||||
| 309 | 0 | ▶ | if( defined $name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if($count == 0){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 311 | 0 | my @parse = split("\t",$name); | |||||||||||||||||||||||||||
| 312 | 0 | $query{seqname} = $parse[0]; | |||||||||||||||||||||||||||
| 313 | 0 | $query{start} = $parse[3]; | |||||||||||||||||||||||||||
| 314 | 0 | $query{end} = $parse[4]; | |||||||||||||||||||||||||||
| 315 | 0 | $query{score} = $parse[5]; | |||||||||||||||||||||||||||
| 316 | 0 | ▶ | $query{strand} = ($parse[6] eq '+') ? 1 : -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | 0 | my @tags = split(";",$parse[8]); | |||||||||||||||||||||||||||
| 318 | 0 | foreach my $tag(@tags){ | |||||||||||||||||||||||||||
| 319 | 0 | $tag =~/(\S+)\s+(\S+)/; | |||||||||||||||||||||||||||
| 320 | 0 | $query{$1} = $2; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | 0 | $query{seq} = $seqchar; | |||||||||||||||||||||||||||
| 323 | 0 | $count++; | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | elsif ($count == 1){ | ||||||||||||||||||||||||||||
| 326 | 0 | my @parse = split("\t",$name); | |||||||||||||||||||||||||||
| 327 | 0 | $subject{seqname} = $parse[0]; | |||||||||||||||||||||||||||
| 328 | 0 | $subject{start} = $parse[3]; | |||||||||||||||||||||||||||
| 329 | 0 | $subject{end} = $parse[4]; | |||||||||||||||||||||||||||
| 330 | 0 | $subject{score} = $parse[5]; | |||||||||||||||||||||||||||
| 331 | 0 | ▶ | $subject{strand} = ($parse[6] eq '+') ? 1:-1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | 0 | my @tags = split(";",$parse[8]); | |||||||||||||||||||||||||||
| 333 | 0 | foreach my $tag(@tags){ | |||||||||||||||||||||||||||
| 334 | 0 | $tag =~/(\S+)\s+(\S+)/; | |||||||||||||||||||||||||||
| 335 | 0 | $subject{$1} = $2; | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | 0 | $subject{seq} = $seqchar; | |||||||||||||||||||||||||||
| 338 | #create homology string | ||||||||||||||||||||||||||||
| 339 | 0 | my $xor = $query{seq}^$subject{seq}; | |||||||||||||||||||||||||||
| 340 | 0 | my $identical = $xor=~tr/\c@/*/; | |||||||||||||||||||||||||||
| 341 | 0 | $xor=~tr/*/ /c; | |||||||||||||||||||||||||||
| 342 | my $hsp= Bio::Search::HSP::GenericHSP->new(-algorithm =>'DBA', | ||||||||||||||||||||||||||||
| 343 | -score =>$query{score}, | ||||||||||||||||||||||||||||
| 344 | -hsp_length =>length($query{seq}), | ||||||||||||||||||||||||||||
| 345 | -query_gaps =>$query{gaps}, | ||||||||||||||||||||||||||||
| 346 | -hit_gaps =>$subject{gaps}, | ||||||||||||||||||||||||||||
| 347 | -query_name =>$query{seqname}, | ||||||||||||||||||||||||||||
| 348 | -query_start =>$query{start}, | ||||||||||||||||||||||||||||
| 349 | -query_end =>$query{end}, | ||||||||||||||||||||||||||||
| 350 | -hit_name =>$subject{seqname}, | ||||||||||||||||||||||||||||
| 351 | -hit_start =>$subject{start}, | ||||||||||||||||||||||||||||
| 352 | -hit_end =>$subject{end}, | ||||||||||||||||||||||||||||
| 353 | -hit_length =>length($self->_subject_seq->seq), | ||||||||||||||||||||||||||||
| 354 | -query_length =>length($self->_query_seq->seq), | ||||||||||||||||||||||||||||
| 355 | -query_seq =>$query{seq}, | ||||||||||||||||||||||||||||
| 356 | -hit_seq =>$subject{seq}, | ||||||||||||||||||||||||||||
| 357 | 0 | -conserved =>$identical, | |||||||||||||||||||||||||||
| 358 | -identical =>$identical, | ||||||||||||||||||||||||||||
| 359 | -homology_seq =>$xor); | ||||||||||||||||||||||||||||
| 360 | 0 | push @hsps, $hsp; | |||||||||||||||||||||||||||
| 361 | 0 | $count = 0; | |||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||
| 364 | 0 | $name = $tempname; | |||||||||||||||||||||||||||
| 365 | 0 | $seqchar = ""; | |||||||||||||||||||||||||||
| 366 | 0 | next; | |||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||
| 368 | 0 | $entry =~ s/[^A-Za-z\.\-]//g; | |||||||||||||||||||||||||||
| 369 | 0 | $seqchar .= $entry; | |||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||
| 371 | #do for the last entry | ||||||||||||||||||||||||||||
| 372 | 0 | ▶ | if($count == 1){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 373 | 0 | my @parse = split("\t",$name); | |||||||||||||||||||||||||||
| 374 | 0 | $subject{seqname} = $parse[1]; | |||||||||||||||||||||||||||
| 375 | 0 | $subject{start} = $parse[3]; | |||||||||||||||||||||||||||
| 376 | 0 | $subject{end} = $parse[4]; | |||||||||||||||||||||||||||
| 377 | 0 | $subject{score} = $parse[5]; | |||||||||||||||||||||||||||
| 378 | 0 | ▶ | $subject{strand} = ($parse[6] eq '+') ? 1:-1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 379 | 0 | my @tags = split(";",$parse[8]); | |||||||||||||||||||||||||||
| 380 | 0 | foreach my $tag(@tags){ | |||||||||||||||||||||||||||
| 381 | 0 | $tag =~/(\S+)\s+(\S+)/; | |||||||||||||||||||||||||||
| 382 | 0 | $subject{$1} = $2; | |||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||
| 384 | 0 | $subject{seq} = $seqchar; | |||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | #create homology string | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | 0 | my $xor = $query{seq}^$subject{seq}; | |||||||||||||||||||||||||||
| 389 | 0 | my $identical = $xor=~tr/\c@/*/; | |||||||||||||||||||||||||||
| 390 | 0 | $xor=~tr/*/ /c; | |||||||||||||||||||||||||||
| 391 | my $hsp= Bio::Search::HSP::GenericHSP->new(-algorithm =>'DBA', | ||||||||||||||||||||||||||||
| 392 | -score =>$query{score}, | ||||||||||||||||||||||||||||
| 393 | -hsp_length =>length($query{seq}), | ||||||||||||||||||||||||||||
| 394 | -query_gaps =>$query{gaps}, | ||||||||||||||||||||||||||||
| 395 | -hit_gaps =>$subject{gaps}, | ||||||||||||||||||||||||||||
| 396 | -query_name =>$query{seqname}, | ||||||||||||||||||||||||||||
| 397 | -query_start =>$query{start}, | ||||||||||||||||||||||||||||
| 398 | -query_end =>$query{end}, | ||||||||||||||||||||||||||||
| 399 | -hit_name =>$subject{seqname}, | ||||||||||||||||||||||||||||
| 400 | -hit_start =>$subject{start}, | ||||||||||||||||||||||||||||
| 401 | -hit_end =>$subject{end}, | ||||||||||||||||||||||||||||
| 402 | -hit_length =>length($self->_subject_seq->seq), | ||||||||||||||||||||||||||||
| 403 | -query_length =>length($self->_query_seq->seq), | ||||||||||||||||||||||||||||
| 404 | -query_seq =>$query{seq}, | ||||||||||||||||||||||||||||
| 405 | -hit_seq =>$subject{seq}, | ||||||||||||||||||||||||||||
| 406 | 0 | -conserved =>$identical, | |||||||||||||||||||||||||||
| 407 | -identical =>$identical, | ||||||||||||||||||||||||||||
| 408 | -homology_seq =>$xor); | ||||||||||||||||||||||||||||
| 409 | 0 | push @hsps, $hsp; | |||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 0 | return \@hsps; | |||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | =head2 _setinput() | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | Title : _setinput | ||||||||||||||||||||||||||||
| 419 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 420 | Function: Create input file for dba program | ||||||||||||||||||||||||||||
| 421 | Example : | ||||||||||||||||||||||||||||
| 422 | Returns : name of file containing dba data input | ||||||||||||||||||||||||||||
| 423 | Args : Seq or Align object reference or input file name | ||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||
| 425 | =cut | ||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||
| 427 | sub _setinput { | ||||||||||||||||||||||||||||
| 428 | 0 | ▶ | my ($self, $input, $suffix) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_setinput: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||
| 429 | 0 | my ($infilename, $seq, $temp, $tfh1,$tfh2,$outfile1,$outfile2); | |||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | #there is gotta be some repetition here...need to clean up | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if (ref($input) ne "ARRAY"){ #a single file containg 2 seqeunces | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 434 | 0 | $infilename = $input; | |||||||||||||||||||||||||||
| 435 | 0 | ▶ | unless(-e $input){return 0;} | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 436 | 0 | my $in = Bio::SeqIO->new(-file => $infilename , '-format' => 'Fasta'); | |||||||||||||||||||||||||||
| 437 | 0 | ($tfh1,$outfile1) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 438 | 0 | ($tfh2,$outfile2) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 0 | my $out1 = Bio::SeqIO->new(-fh=> $tfh1 , '-format' => 'Fasta','-flush'=>1); | |||||||||||||||||||||||||||
| 441 | 0 | my $out2 = Bio::SeqIO->new(-fh=> $tfh2 , '-format' => 'Fasta','-flush'=>1); | |||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | 0 | ▶ | my $seq1 = $in->next_seq() || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$in->next_seq || (return 0)
MC/DC0%0/1
$in->next_seq || (return 0)
$in->next_seq
Truth table0%0/2
A
A= $in->next_seq
| |||||||||||||||||||||||||||||
| 444 | 0 | ▶ | my $seq2 = $in->next_seq() || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$in->next_seq || (return 0)
MC/DC0%0/1
$in->next_seq || (return 0)
$in->next_seq
Truth table0%0/2
A
A= $in->next_seq
| |||||||||||||||||||||||||||||
| 445 | 0 | $out1->write_seq($seq1); | |||||||||||||||||||||||||||
| 446 | 0 | $out2->write_seq($seq2); | |||||||||||||||||||||||||||
| 447 | 0 | $self->_query_seq($seq1); | |||||||||||||||||||||||||||
| 448 | 0 | $self->_subject_seq($seq2); | |||||||||||||||||||||||||||
| 449 | 0 | $out1->close(); | |||||||||||||||||||||||||||
| 450 | 0 | $out2->close(); | |||||||||||||||||||||||||||
| 451 | 0 | close($tfh1); | |||||||||||||||||||||||||||
| 452 | 0 | close($tfh2); | |||||||||||||||||||||||||||
| 453 | 0 | undef $tfh1; | |||||||||||||||||||||||||||
| 454 | 0 | undef $tfh2; | |||||||||||||||||||||||||||
| 455 | 0 | return $outfile1,$outfile2; | |||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||
| 457 | else { | ||||||||||||||||||||||||||||
| 458 | 0 | ▶ | scalar(@{$input}) == 2 || $self->throw("dba alignment can only be run on 2 sequences not."); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 459 | 0 | ▶ | if(ref($input->[0]) eq ""){#passing in two file names | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 460 | 0 | my $in1 = Bio::SeqIO->new(-file => $input->[0], '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 461 | 0 | my $in2 = Bio::SeqIO->new(-file => $input->[1], '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | 0 | ($tfh1,$outfile1) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 464 | 0 | ($tfh2,$outfile2) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | 0 | my $out1 = Bio::SeqIO->new(-fh=> $tfh1 , '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 467 | 0 | my $out2 = Bio::SeqIO->new(-fh=> $tfh2 , '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | 0 | ▶ | my $seq1 = $in1->next_seq() || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$in1->next_seq || (return 0)
MC/DC0%0/1
$in1->next_seq || (return 0)
$in1->next_seq
Truth table0%0/2
A
A= $in1->next_seq
| |||||||||||||||||||||||||||||
| 470 | 0 | ▶ | my $seq2 = $in2->next_seq() || return 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$in2->next_seq || (return 0)
MC/DC0%0/1
$in2->next_seq || (return 0)
$in2->next_seq
Truth table0%0/2
A
A= $in2->next_seq
| |||||||||||||||||||||||||||||
| 471 | 0 | $out1->write_seq($seq1); | |||||||||||||||||||||||||||
| 472 | 0 | $out2->write_seq($seq2); | |||||||||||||||||||||||||||
| 473 | 0 | $self->_query_seq($seq1); | |||||||||||||||||||||||||||
| 474 | 0 | $self->_subject_seq($seq2); | |||||||||||||||||||||||||||
| 475 | 0 | close($tfh1); | |||||||||||||||||||||||||||
| 476 | 0 | close($tfh2); | |||||||||||||||||||||||||||
| 477 | 0 | undef $tfh1; | |||||||||||||||||||||||||||
| 478 | 0 | undef $tfh2; | |||||||||||||||||||||||||||
| 479 | 0 | return $outfile1,$outfile2; | |||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||
| 481 | ▶ | elsif($input->[0]->isa("Bio::PrimarySeqI") && $input->[1]->isa("Bio::PrimarySeqI")) { | |||||||||||||||||||||||||||
|
Condition0%0/3
$input->[0]->isa("Bio::PrimarySeqI") and $input->[1]->isa("Bio::PrimarySeqI")
MC/DC0%0/2
$input->[0]->isa("Bio::PrimarySeqI") and $input->[1]->isa("Bio::PrimarySeqI")
$input->[0]->isa("Bio::PrimarySeqI")
$input->[1]->isa("Bio::PrimarySeqI")
Truth table0%0/3
A and B
A= $input->[0]->isa("Bio::PrimarySeqI")B= $input->[1]->isa("Bio::PrimarySeqI")
| |||||||||||||||||||||||||||||
| 482 | 0 | ($tfh1,$outfile1) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 483 | 0 | ($tfh2,$outfile2) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | 0 | my $out1 = Bio::SeqIO->new(-fh=> $tfh1 , '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 486 | 0 | my $out2 = Bio::SeqIO->new(-fh=> $tfh2 , '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | 0 | $out1->write_seq($input->[0]); | |||||||||||||||||||||||||||
| 489 | 0 | $out2->write_seq($input->[1]); | |||||||||||||||||||||||||||
| 490 | 0 | $self->_query_seq($input->[0]); | |||||||||||||||||||||||||||
| 491 | 0 | $self->_subject_seq($input->[1]); | |||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 0 | close($tfh1); | |||||||||||||||||||||||||||
| 494 | 0 | close($tfh2); | |||||||||||||||||||||||||||
| 495 | 0 | undef $tfh1; | |||||||||||||||||||||||||||
| 496 | 0 | undef $tfh2; | |||||||||||||||||||||||||||
| 497 | 0 | return $outfile1,$outfile2; | |||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||
| 499 | else { | ||||||||||||||||||||||||||||
| 500 | 0 | return 0; | |||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||
| 503 | 0 | return 0; | |||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | =head2 _setparams() | ||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | Title : _setparams | ||||||||||||||||||||||||||||
| 509 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 510 | Function: Create parameter inputs for dba program | ||||||||||||||||||||||||||||
| 511 | Example : | ||||||||||||||||||||||||||||
| 512 | Returns : parameter string to be passed to dba | ||||||||||||||||||||||||||||
| 513 | during align or profile_align | ||||||||||||||||||||||||||||
| 514 | Args : name of calling object | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | =cut | ||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | sub _setparams { | ||||||||||||||||||||||||||||
| 519 | 0 | ▶ | my ($attr, $value, $self); | ||||||||||||||||||||||||||
|
Subroutine
_setparams: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | 0 | $self = shift; | |||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | 0 | my $param_string = ""; | |||||||||||||||||||||||||||
| 524 | 0 | for $attr ( @DBA_PARAMS ) { | |||||||||||||||||||||||||||
| 525 | 0 | $value = $self->$attr(); | |||||||||||||||||||||||||||
| 526 | 0 | ▶ | next unless (defined $value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 527 | # next if $attr =~/outfile/i; | ||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||
| 529 | 0 | my $attr_key = lc $attr; #put params in format expected by dba | |||||||||||||||||||||||||||
| 530 | 0 | ▶ | if($attr_key =~ /match([ABCDabcd])/i){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 531 | 0 | $attr_key = "match".uc($1); | |||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||
| 533 | 0 | $attr_key = ' -'.$attr_key; | |||||||||||||||||||||||||||
| 534 | 0 | $param_string .= $attr_key.' '.$value; | |||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||
| 536 | 0 | for $attr ( @DBA_SWITCHES) { | |||||||||||||||||||||||||||
| 537 | 0 | $value = $self->$attr(); | |||||||||||||||||||||||||||
| 538 | 0 | ▶ | next unless ($value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 539 | 0 | my $attr_key = lc $attr; #put switches in format expected by dba | |||||||||||||||||||||||||||
| 540 | 0 | $attr_key = ' -'.$attr_key; | |||||||||||||||||||||||||||
| 541 | 0 | $param_string .= $attr_key ; | |||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||
| 543 | 0 | return $param_string; | |||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | =head2 _query_seq() | ||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | Title : _query_seq | ||||||||||||||||||||||||||||
| 549 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 550 | Function: get/set for the query sequence | ||||||||||||||||||||||||||||
| 551 | Example : | ||||||||||||||||||||||||||||
| 552 | Returns : | ||||||||||||||||||||||||||||
| 553 | Args : | ||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||
| 555 | =cut | ||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | sub _query_seq { | ||||||||||||||||||||||||||||
| 558 | 0 | ▶ | my ($self,$seq) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_query_seq: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 559 | 0 | ▶ | if(defined $seq){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 560 | 0 | $self->{'_query_seq'} = $seq; | |||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||
| 562 | 0 | return $self->{'_query_seq'}; | |||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||
| 565 | =head2 _subject_seq() | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | Title : _subject_seq | ||||||||||||||||||||||||||||
| 568 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 569 | Function: get/set for the subject sequence | ||||||||||||||||||||||||||||
| 570 | Example : | ||||||||||||||||||||||||||||
| 571 | Returns : | ||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||
| 573 | Args : | ||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||
| 575 | =cut | ||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||
| 577 | sub _subject_seq { | ||||||||||||||||||||||||||||
| 578 | 0 | ▶ | my ($self,$seq) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_subject_seq: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 579 | 0 | ▶ | if(defined $seq){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 580 | 0 | $self->{'_subject_seq'} = $seq; | |||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||
| 582 | 0 | return $self->{'_subject_seq'}; | |||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||
| 584 | 1 | 1; # Needed to keep compiler happy | |||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||