| 1 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # BioPerl module for Bio::Tools::Run::Phylo::Hyphy::REL | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # Cared for by Albert Vilella <avilella-at-gmail-dot-com> | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # Copyright Albert Vilella | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | Bio::Tools::Run::Phylo::Hyphy::REL - Wrapper around the Hyphy REL analysis | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | use Bio::Tools::Run::Phylo::Hyphy::REL; | ||||||||||||||||||||||||||||||||||||||||||
| 22 | use Bio::AlignIO; | ||||||||||||||||||||||||||||||||||||||||||
| 23 | use Bio::TreeIO; | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | my $alignio = Bio::AlignIO->new(-format => 'fasta', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | -file => 't/data/hyphy1.fasta'); | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | my $aln = $alignio->next_aln; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | my $treeio = Bio::TreeIO->new( | ||||||||||||||||||||||||||||||||||||||||||
| 31 | -format => 'newick', -file => 't/data/hyphy1.tree'); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | my $rel = Bio::Tools::Run::Phylo::Hyphy::REL->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | $rel->alignment($aln); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | $rel->tree($tree); | ||||||||||||||||||||||||||||||||||||||||||
| 36 | my ($rc,$results) = $rel->run(); | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | This is a wrapper around the REL analysis of HyPhy ([Hy]pothesis | ||||||||||||||||||||||||||||||||||||||||||
| 41 | Testing Using [Phy]logenies) package of Sergei Kosakowsky Pond, | ||||||||||||||||||||||||||||||||||||||||||
| 42 | Spencer V. Muse, Simon D.W. Frost and Art Poon. See | ||||||||||||||||||||||||||||||||||||||||||
| 43 | http://www.hyphy.org for more information. | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | This module will generate the correct list of options for interfacing | ||||||||||||||||||||||||||||||||||||||||||
| 46 | with TemplateBatchFiles/Ghostrides/Wrapper.bf. | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 53 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||
| 54 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 57 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 66 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 67 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 68 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 73 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 74 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | http://redmine.open-bio.org/projects/bioperl/ | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | =head1 AUTHOR - Albert Vilella | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | Email avilella-at-gmail-dot-com | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | Additional contributors names and emails here | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 89 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | package Bio::Tools::Run::Phylo::Hyphy::REL; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | ▶ | use vars qw(@ISA @VALIDVALUES $PROGRAMNAME $PROGRAM); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | ▶ | use Bio::AlignIO; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | ▶ | use Bio::TreeIO; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | use Bio::Tools::Run::Phylo::Hyphy::Base; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | ▶ | use Bio::Tools::Run::WrapperBase; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | @ISA = qw(Bio::Root::Root Bio::Tools::Run::Phylo::Hyphy::Base); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | =head2 Default Values | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | Valid and default values for REL are listed below. The default | ||||||||||||||||||||||||||||||||||||||||||
| 111 | values are always the first one listed. These descriptions are | ||||||||||||||||||||||||||||||||||||||||||
| 112 | essentially lifted from the python wrapper or provided by the author. | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | INCOMPLETE DOCUMENTATION OF ALL METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | ▶ | @VALIDVALUES = | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 121 | {'geneticCode' => [ "Universal","VertebratemtDNA","YeastmtDNA","Mold/ProtozoanmtDNA", | ||||||||||||||||||||||||||||||||||||||||||
| 122 | "InvertebratemtDNA","CiliateNuclear","EchinodermmtDNA","EuplotidNuclear", | ||||||||||||||||||||||||||||||||||||||||||
| 123 | "Alt.YeastNuclear","AscidianmtDNA","FlatwormmtDNA","BlepharismaNuclear"]}, | ||||||||||||||||||||||||||||||||||||||||||
| 124 | {'tempalnfile' => undef }, # aln file goes here | ||||||||||||||||||||||||||||||||||||||||||
| 125 | {'temptreefile' => undef }, # tree file goes here | ||||||||||||||||||||||||||||||||||||||||||
| 126 | {'Model' => [ "Null for Test 1", "Null for Test 2", "Alternative"]}, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 133 | Usage : my $obj = Bio::Tools::Run::Phylo::Hyphy::REL->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 134 | Function: Builds a new Bio::Tools::Run::Phylo::Hyphy::REL object | ||||||||||||||||||||||||||||||||||||||||||
| 135 | Returns : Bio::Tools::Run::Phylo::Hyphy::REL | ||||||||||||||||||||||||||||||||||||||||||
| 136 | Args : -alignment => the Bio::Align::AlignI object | ||||||||||||||||||||||||||||||||||||||||||
| 137 | -save_tempfiles => boolean to save the generated tempfiles and | ||||||||||||||||||||||||||||||||||||||||||
| 138 | NOT cleanup after onesself (default FALSE) | ||||||||||||||||||||||||||||||||||||||||||
| 139 | -tree => the Bio::Tree::TreeI object | ||||||||||||||||||||||||||||||||||||||||||
| 140 | -params => a hashref of parameters (all passed to set_parameter) | ||||||||||||||||||||||||||||||||||||||||||
| 141 | -executable => where the hyphy executable resides | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | See also: L<Bio::Tree::TreeI>, L<Bio::Align::AlignI> | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | ▶ | my($class,@args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=23.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 151 | 1 | my ($aln, $tree, $st, $params, $exe, | |||||||||||||||||||||||||||||||||||||||||
| 152 | $ubl) = $self->_rearrange([qw(ALIGNMENT TREE SAVE_TEMPFILES | ||||||||||||||||||||||||||||||||||||||||||
| 153 | PARAMS EXECUTABLE)], | ||||||||||||||||||||||||||||||||||||||||||
| 154 | @args); | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | ▶ | defined $aln && $self->alignment($aln); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | ▶ | defined $tree && $self->tree($tree); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | ▶ | defined $st && $self->save_tempfiles($st); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | ▶ | defined $exe && $self->executable($exe); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | $self->set_default_parameters(); | |||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | ▶ | if( defined $params ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if( ref($params) !~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $self->warn("Must provide a valid hash ref for parameter -FLAGS"); | |||||||||||||||||||||||||||||||||||||||||
| 164 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | map { $self->set_parameter($_, $$params{$_}) } keys %$params; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | =head2 run | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | Title : run | ||||||||||||||||||||||||||||||||||||||||||
| 175 | Usage : my ($rc,$results) = $rel->run($aln); | ||||||||||||||||||||||||||||||||||||||||||
| 176 | Function: run the rel analysis using the default or updated parameters | ||||||||||||||||||||||||||||||||||||||||||
| 177 | the alignment parameter must have been set | ||||||||||||||||||||||||||||||||||||||||||
| 178 | Returns : Return code, Hash | ||||||||||||||||||||||||||||||||||||||||||
| 179 | Args : L<Bio::Align::AlignI> object, | ||||||||||||||||||||||||||||||||||||||||||
| 180 | L<Bio::Tree::TreeI> object [optional] | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | sub run { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | my ($self,$aln,$tree) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | $self->prepare($aln,$tree) unless (defined($self->{'_prepared'})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my ($rc,$results) = (1); | |||||||||||||||||||||||||||||||||||||||||
| 190 | { | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $commandstring; | |||||||||||||||||||||||||||||||||||||||||
| 192 | my $exit_status; | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $tempdir = $self->tempdir; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $relexe = $self->executable(); | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | $self->throw("unable to find or run executable for 'HYPHY'") unless $relexe && -e $relexe && -x _; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$relexe and -e $relexe and -x _
$relexe and -e $relexe
MC/DC0%0/3
$relexe and -e $relexe and -x _
$relexe
-e $relexe
-x _
Truth table0%0/4
A and B and C
A= $relexeB= -e $relexeC= -x _
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $commandstring = $relexe . " BASEPATH=" . $self->program_dir . " " . $self->{'_wrapper'}; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | open(RUN, "$commandstring |") or $self->throw("Cannot open exe $relexe"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my @output = <RUN>; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $exit_status = close(RUN); | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $self->error_string(join('',@output)); | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if( (grep { /\berr(or)?: /io } @output) || !$exit_status) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
grep {/\berr(or)?: /io;} @output or not $exit_status
MC/DC0%0/2
grep {/\berr(or)?: /io;} @output or not $exit_status
grep {/\berr(or)?: /io;} @output
not $exit_status
Truth table0%0/3
A or not(B)
A= grep {/\berr(or)?: /io;} @outputB= not $exit_status
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $self->warn("There was an error - see error_string for the program output"); | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $rc = 0; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my $outfile = $self->outfile_name; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | open(OUTFILE, ">$outfile") or $self->throw("cannot open $outfile for writing"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | # FIXME -- needs output parsing -- ask hyphy to clean that up into a tsv? | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | foreach my $output (@output) { | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | print OUTFILE $output; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $results .= sprintf($output); | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | close(OUTFILE); | |||||||||||||||||||||||||||||||||||||||||
| 214 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if( $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $self->warn($self->error_string); | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | unless ( $self->save_tempfiles ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | unlink($self->{'_wrapper'}); | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $self->cleanup(); | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return ($rc,$results); | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =head2 create_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | Title : create_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 230 | Usage : $self->create_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 231 | Function: It will create the wrapper file that interfaces with the analysis bf file | ||||||||||||||||||||||||||||||||||||||||||
| 232 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 233 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 234 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | sub create_wrapper { | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_wrapper: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $batchfile = 'YangNielsenBranchSite2005.bf'; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $self->SUPER::create_wrapper($batchfile); | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | =head2 set_default_parameters | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | Title : set_default_parameters | ||||||||||||||||||||||||||||||||||||||||||
| 250 | Usage : $rel->set_default_parameters(0); | ||||||||||||||||||||||||||||||||||||||||||
| 251 | Function: (Re)set the default parameters from the defaults | ||||||||||||||||||||||||||||||||||||||||||
| 252 | (the first value in each array in the | ||||||||||||||||||||||||||||||||||||||||||
| 253 | %VALIDVALUES class variable) | ||||||||||||||||||||||||||||||||||||||||||
| 254 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 255 | Args : boolean: keep existing parameter values | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | sub set_default_parameters { | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 1 | ▶ | my ($self,$keepold) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_default_parameters: called CC=12 SCAR=35.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 1 | ▶ | $keepold = 0 unless defined $keepold; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | foreach my $elem (@VALIDVALUES) { | |||||||||||||||||||||||||||||||||||||||||
| 264 | 4 | my ($param,$val) = each %$elem; | |||||||||||||||||||||||||||||||||||||||||
| 265 | # skip if we want to keep old values and it is already set | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 4 | ▶ | if (ref($val)=~/ARRAY/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | ▶ | unless (ref($val->[0])=~/HASH/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | push @{ $self->{'_orderedparams'} }, {$param, $val->[0]}; | |||||||||||||||||||||||||||||||||||||||||
| 269 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $val = $val->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ▶ | if ( ref($val) =~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $prevparam; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | while (defined($val)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | last unless (ref($val) =~ /HASH/i); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | last unless (defined($param)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $prevparam = $param; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ($param,$val) = each %{$val}; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | push @{ $self->{'_orderedparams'} }, {$prevparam, $param}; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | push @{ $self->{'_orderedparams'} }, {$param, $val} if (defined($val)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | ▶ | } elsif (ref($val) !~ /HASH/i && ref($val) !~ /ARRAY/i) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref($val) =~ /HASH/i || ref($val) =~ /ARRAY/i
MC/DC50%1/2
ref($val) =~ /HASH/i || ref($val) =~ /ARRAY/i
ref($val) =~ /HASH/i
ref($val) =~ /ARRAY/i
Truth table66%2/3
A || B
A= ref($val) =~ /HASH/iB= ref($val) =~ /ARRAY/i
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 2 | push @{ $self->{'_orderedparams'} }, {$param, $val}; | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | =head1 Bio::Tools::Run::WrapperBase methods | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | =head2 no_param_checks | ||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | Title : no_param_checks | ||||||||||||||||||||||||||||||||||||||||||
| 297 | Usage : $obj->no_param_checks($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 298 | Function: Boolean flag as to whether or not we should | ||||||||||||||||||||||||||||||||||||||||||
| 299 | trust the sanity checks for parameter values | ||||||||||||||||||||||||||||||||||||||||||
| 300 | Returns : value of no_param_checks | ||||||||||||||||||||||||||||||||||||||||||
| 301 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | =head2 save_tempfiles | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | Title : save_tempfiles | ||||||||||||||||||||||||||||||||||||||||||
| 309 | Usage : $obj->save_tempfiles($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 310 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 311 | Returns : value of save_tempfiles | ||||||||||||||||||||||||||||||||||||||||||
| 312 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | =head2 tempdir | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | Title : tempdir | ||||||||||||||||||||||||||||||||||||||||||
| 320 | Usage : my $tmpdir = $self->tempdir(); | ||||||||||||||||||||||||||||||||||||||||||
| 321 | Function: Retrieve a temporary directory name (which is created) | ||||||||||||||||||||||||||||||||||||||||||
| 322 | Returns : string which is the name of the temporary directory | ||||||||||||||||||||||||||||||||||||||||||
| 323 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | =head2 cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | Title : cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 331 | Usage : $rel->cleanup(); | ||||||||||||||||||||||||||||||||||||||||||
| 332 | Function: Will cleanup the tempdir directory after a run | ||||||||||||||||||||||||||||||||||||||||||
| 333 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 334 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | =head2 io | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | Title : io | ||||||||||||||||||||||||||||||||||||||||||
| 342 | Usage : $obj->io($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 343 | Function: Gets a L<Bio::Root::IO> object | ||||||||||||||||||||||||||||||||||||||||||
| 344 | Returns : L<Bio::Root::IO> | ||||||||||||||||||||||||||||||||||||||||||
| 345 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | ▶ | my $self= shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | ▶ | unless ( $self->save_tempfiles ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 1 | $self->cleanup(); | |||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | $self->SUPER::DESTROY(); | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||