| 1 | # $Id: Promoterwise.pm, | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # Cared for by Shawn Hoon | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright Shawn Hoon | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | Bio::Tools::Run::Promoterwise - Wrapper for aligning two sequences using | ||||||||||||||||||||||||||||||||||||||||||
| 15 | promoterwise | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | # Build a Promoterwise alignment factory | ||||||||||||||||||||||||||||||||||||||||||
| 20 | my @params = ('-s'=>1,'-query_start'=>10,'-dymem'=>1); | ||||||||||||||||||||||||||||||||||||||||||
| 21 | my $factory = Bio::Tools::Run::Promoterwise->new(@params); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | my (@fp)= $factory->run($seq1,$seq2); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | # each feature pair is a group of hsps | ||||||||||||||||||||||||||||||||||||||||||
| 26 | foreach my $fp(@fp){ | ||||||||||||||||||||||||||||||||||||||||||
| 27 | print "Hit Length: ".$fp->feature1->length."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | print "Hit Start: ".$fp->feature1->start."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | print "Hit End: ".$fp->feature1->end."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | print "Hsps: \n"; | ||||||||||||||||||||||||||||||||||||||||||
| 31 | my @first_hsp = $fp->feature1->sub_SeqFeature; | ||||||||||||||||||||||||||||||||||||||||||
| 32 | my @second_hsp = $fp->feature2->sub_SeqFeature; | ||||||||||||||||||||||||||||||||||||||||||
| 33 | for ($i..$#first_hsp){ | ||||||||||||||||||||||||||||||||||||||||||
| 34 | print $first_hsp[$i]->seq." ".$second_hsp[$i]->seq."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | print "end: ". $fp->feature2->start."\t".$fp->feature2->end."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | #Available parameters include: | ||||||||||||||||||||||||||||||||||||||||||
| 40 | #( S T U V QUERY_START QUERY_END TARGET_START | ||||||||||||||||||||||||||||||||||||||||||
| 41 | #TARGET_END LHWINDOW LHSEED LHALN LHSCORE LHREJECT | ||||||||||||||||||||||||||||||||||||||||||
| 42 | #LHREJECT LHMAX DYMEM KBYTE DYCACHE) | ||||||||||||||||||||||||||||||||||||||||||
| 43 | #For an explanation of these parameters, please see documentation | ||||||||||||||||||||||||||||||||||||||||||
| 44 | #from the Wise package. | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | Promoterwise is an alignment algorithm that relaxes the constraint | ||||||||||||||||||||||||||||||||||||||||||
| 49 | that local alignments have to be co-linear. Otherwise it provides a | ||||||||||||||||||||||||||||||||||||||||||
| 50 | similar model to DBA, which is designed for promoter sequence | ||||||||||||||||||||||||||||||||||||||||||
| 51 | alignments by Ewan Birney. It is part of the wise2 package available | ||||||||||||||||||||||||||||||||||||||||||
| 52 | at: http://www.sanger.ac.uk/software/wise2. | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 59 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||||||||||||||||
| 60 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 63 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 72 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 73 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 74 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 79 | the bugs and their resolution. Bug reports can be submitted via | ||||||||||||||||||||||||||||||||||||||||||
| 80 | the web: | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | http://redmine.open-bio.org/projects/bioperl/ | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | =head1 AUTHOR - Shawn Hoon | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | Email: shawnh@fugu-sg.org | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||||||||||||||||
| 92 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | package Bio::Tools::Run::Promoterwise; | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR $PROGRAMNAME | |||||||||||||||||||||||||||||||||||||||||
| 98 | @PROMOTERWISE_SWITCHES @PROMOTERWISE_PARAMS | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | ▶ | @OTHER_SWITCHES %OK_FIELD); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | use Bio::SeqIO; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | ▶ | use Bio::Tools::Run::WrapperBase; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | use Bio::Tools::Promoterwise; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase ); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | # Two ways to run the program ..... | ||||||||||||||||||||||||||||||||||||||||||
| 109 | # 1. define an environmental variable WISEDIR | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # export WISEDIR =/usr/local/share/wise2.2.0 | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # where the wise2.2.20 package is installed | ||||||||||||||||||||||||||||||||||||||||||
| 112 | # | ||||||||||||||||||||||||||||||||||||||||||
| 113 | # 2. include a definition of an environmental variable WISEDIR in | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # every script that will use DBA.pm | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # $ENV{WISEDIR} = '/usr/local/share/wise2.2.20'; | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | @PROMOTERWISE_PARAMS = qw( S T U V QUERY_START QUERY_END TARGET_START | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | TARGET_END LHWINDOW LHSEED LHALN LHSCORE LHREJECT | ||||||||||||||||||||||||||||||||||||||||||
| 120 | LHREJECT LHMAX DYMEM KBYTE DYCACHE); | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | @OTHER_SWITCHES = qw(SILENT QUIET ERROROFFSTD); | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | # Authorize attribute fields | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | foreach my $attr ( @PROMOTERWISE_PARAMS, @PROMOTERWISE_SWITCHES, | |||||||||||||||||||||||||||||||||||||||||
| 127 | 21 | @OTHER_SWITCHES) { $OK_FIELD{$attr}++; } | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | =head2 program_name | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | Title : program_name | ||||||||||||||||||||||||||||||||||||||||||
| 133 | Usage : $factory>program_name() | ||||||||||||||||||||||||||||||||||||||||||
| 134 | Function: holds the program name | ||||||||||||||||||||||||||||||||||||||||||
| 135 | Returns: string | ||||||||||||||||||||||||||||||||||||||||||
| 136 | Args : None | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | sub program_name { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 6 | ▶ | return 'promoterwise'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
program_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | =head2 program_dir | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | Title : program_dir | ||||||||||||||||||||||||||||||||||||||||||
| 147 | Usage : $factory->program_dir(@params) | ||||||||||||||||||||||||||||||||||||||||||
| 148 | Function: returns the program directory, obtained from ENV variable. | ||||||||||||||||||||||||||||||||||||||||||
| 149 | Returns: string | ||||||||||||||||||||||||||||||||||||||||||
| 150 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | sub program_dir { | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | ▶ | my ($class, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | my ($attr, $value); | |||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | $attr = shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | $value = shift @args; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | ▶ | next if( $attr =~ /^-/ ); # don't want named parameters | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | $self->$attr($value); | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | my $attr = $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | $attr =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | $attr = uc $attr; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 1 | ▶ | $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | $self->{$attr} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 1 | 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 | ▶ | return undef unless $self->executable; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $prog = $self->executable; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $string = `$prog -version`; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $string =~ /(Version *)/i; | |||||||||||||||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | =head2 run | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | Title : run | ||||||||||||||||||||||||||||||||||||||||||
| 209 | Usage : 2 sequence objects | ||||||||||||||||||||||||||||||||||||||||||
| 210 | @fp = $factory->run($seq1, $seq2); | ||||||||||||||||||||||||||||||||||||||||||
| 211 | Function: run | ||||||||||||||||||||||||||||||||||||||||||
| 212 | Returns : An array of <Bio::SeqFeature::FeaturePair> | ||||||||||||||||||||||||||||||||||||||||||
| 213 | Args : Name of a file containing a set of 2 fasta sequences | ||||||||||||||||||||||||||||||||||||||||||
| 214 | or else 2 Bio::Seq objects. | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | Throws an exception if argument is not either a string (eg a filename) | ||||||||||||||||||||||||||||||||||||||||||
| 217 | or 2 Bio::Seq objects. If arguments are strings, throws exception if | ||||||||||||||||||||||||||||||||||||||||||
| 218 | file corresponding to string name can not be found. | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | sub run{ | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | my ($self, $seq1, $seq2)=@_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my ($attr, $value, $switch); | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $self->io->_io_cleanup(); | |||||||||||||||||||||||||||||||||||||||||
| 226 | # Create input file pointer | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my ($infile1,$infile2)= $self->_setinput($seq1, $seq2); | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if (!($infile1 && $infile2)) | ||||||||||||||||||||||||||||||||||||||||
|
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
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | {$self->throw("Bad input data (sequences need an id ) ");} | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | # run promoterwise | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my @fp = $self->_run($infile1,$infile2); | |||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | return @fp; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | =head2 _run | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | Title : _run | ||||||||||||||||||||||||||||||||||||||||||
| 241 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||
| 242 | Function: makes actual system call to a promoterwise program | ||||||||||||||||||||||||||||||||||||||||||
| 243 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 244 | Returns : L<Bio::SeqFeature::FeaturePair> | ||||||||||||||||||||||||||||||||||||||||||
| 245 | Args : Name of a files containing 2 sequences in the order of peptide and genomic | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | sub _run { | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | my ($self,$infile1,$infile2) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_run: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my $instring; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->debug( "Program ".$self->executable."\n"); | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | unless ( $self->executable ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $self->throw("Cannot run Promoterwise unless the executable is found.". | |||||||||||||||||||||||||||||||||||||||||
| 255 | " Check your environment variables or make sure ". | ||||||||||||||||||||||||||||||||||||||||||
| 256 | "promoterwise is in your path."); | ||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my $paramstring = $self->_setparams; | |||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $commandstring = $self->executable." $infile1 $infile2 $paramstring"; | |||||||||||||||||||||||||||||||||||||||||
| 261 | # this is to capture STDERR messages which leak out when you run programs | ||||||||||||||||||||||||||||||||||||||||||
| 262 | # with open(FH, "... |"); | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | if( ( $self->silent && $self->quiet) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->silent and $self->quiet and not $^O =~ /os2|dos|MSWin32|amigaos/
$self->silent and $self->quiet
MC/DC0%0/3
$self->silent and $self->quiet and not $^O =~ /os2|dos|MSWin32|amigaos/
$self->silent
$self->quiet
not $^O =~ /os2|dos|MSWin32|amigaos/
Truth table0%0/4
A and B and not(C)
A= $self->silentB= $self->quietC= not $^O =~ /os2|dos|MSWin32|amigaos/
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | ($^O !~ /os2|dos|MSWin32|amigaos/) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # yeah, like promoterwise is really going to run on Windows... | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $commandstring .= ' -quiet -silent -erroroffstd 2> /dev/null'; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $self->debug( "promoterwise command = $commandstring"); | |||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | open(PW, "$commandstring |") || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | $self->throw( "Promoterwise call ($commandstring) crashed: $? \n"); | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my $pw_parser = Bio::Tools::Promoterwise->new(-fh=>\*PW, | |||||||||||||||||||||||||||||||||||||||||
| 272 | -query1_seq=>$self->_query1_seq, | ||||||||||||||||||||||||||||||||||||||||||
| 273 | -query2_seq=>$self->_query2_seq); | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my @fp; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | while (my $fp = $pw_parser->next_result){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | push @fp,$fp; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | return @fp; | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | sub _setinput { | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | my ($self, $seq1, $seq2) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_setinput: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my ($tfh1,$tfh2,$outfile1,$outfile2); | |||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | $self->throw("calling with not enough arguments") unless $seq1 && $seq2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$seq1 and $seq2
MC/DC0%0/2
$seq1 and $seq2
$seq1
$seq2
Truth table0%0/3
A and B
A= $seq1B= $seq2
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | # Not going to set _query_pep/_subject_dna_seq | ||||||||||||||||||||||||||||||||||||||||||
| 289 | # if you pass in a filename | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | unless( ref($seq1) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | unless( -e $seq1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $self->throw("Sequence1 is not a Bio::PrimarySeqI object nor file\n"); | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $outfile1 = $seq1; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ($tfh1,$outfile1) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my $out1 = Bio::SeqIO->new('-fh' => $tfh1, | |||||||||||||||||||||||||||||||||||||||||
| 300 | '-format' => 'fasta'); | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $out1->write_seq($seq1); | |||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $self->_query1_seq($seq1); | |||||||||||||||||||||||||||||||||||||||||
| 303 | # Make sure you close things - this is what creates | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # Out of filehandle errors | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | close($tfh1); | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | undef $tfh1; | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | unless( ref($seq2) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | unless( -e $seq2 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $self->throw("Sequence2 is not a Bio::PrimarySeqI object nor file\n"); | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $outfile2 = $seq2; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ($tfh2,$outfile2) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my $out2 = Bio::SeqIO->new('-fh' => $tfh2, | |||||||||||||||||||||||||||||||||||||||||
| 317 | '-format' => 'fasta'); | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $out2->write_seq($seq2); | |||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $self->_query2_seq($seq2); | |||||||||||||||||||||||||||||||||||||||||
| 321 | # Make sure you close things - this is what creates | ||||||||||||||||||||||||||||||||||||||||||
| 322 | # Out of filehandle errors | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | close($tfh2); | |||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | undef $tfh2; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return ($outfile1,$outfile2); | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | =head2 _setparams | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | Title : _setparams | ||||||||||||||||||||||||||||||||||||||||||
| 332 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||
| 333 | Function: creates a string of params to be used in the command string | ||||||||||||||||||||||||||||||||||||||||||
| 334 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 335 | Returns : string of params | ||||||||||||||||||||||||||||||||||||||||||
| 336 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | sub _setparams { | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_setparams: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $param_string; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | foreach my $attr(@PROMOTERWISE_PARAMS){ | |||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my $value = $self->$attr(); | |||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | next unless (defined $value); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $attr_key = ' -'.(lc $attr); | |||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $param_string .= $attr_key.' '.$value; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | foreach my $attr(@PROMOTERWISE_SWITCHES){ | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $value = $self->$attr(); | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | next unless (defined $value); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my $attr_key = ' -'.(lc $attr); | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $param_string .=$attr_key; | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $param_string = $param_string." -hitoutput tab"; #specify the output option | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return $param_string; | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | =head2 _query_pep_seq | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | Title : _query_pep_seq | ||||||||||||||||||||||||||||||||||||||||||
| 363 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||
| 364 | Function: get/set for the query sequence | ||||||||||||||||||||||||||||||||||||||||||
| 365 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 366 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 367 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | sub _query1_seq { | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | my ($self,$seq) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_query1_seq: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | if(defined $seq){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $self->{'_query1_seq'} = $seq; | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | return $self->{'_query1_seq'}; | |||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | =head2 _subject_dna_seq | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | Title : _subject_dna_seq | ||||||||||||||||||||||||||||||||||||||||||
| 382 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||
| 383 | Function: get/set for the subject sequence | ||||||||||||||||||||||||||||||||||||||||||
| 384 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 385 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | sub _query2_seq{ | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | my ($self,$seq) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_query2_seq: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | if(defined $seq){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $self->{'_query2_seq'} = $seq; | |||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | return $self->{'_query2_seq'}; | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||