| 1 | # $Id$ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # BioPerl module for Bio::Tools::Run::Phylo::Hyphy::FEL | ||||||||||||||||||||||||||||||||||||||||||
| 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::FEL - Wrapper around the Hyphy FEL analysis | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | use Bio::Tools::Run::Phylo::Hyphy::FEL; | ||||||||||||||||||||||||||||||||||||||||||
| 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 $fel = Bio::Tools::Run::Phylo::Hyphy::FEL->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | $fel->alignment($aln); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | $fel->tree($tree); | ||||||||||||||||||||||||||||||||||||||||||
| 36 | my ($rc,$results) = $fel->run(); | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | This is a wrapper around the FEL 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::FEL; | ||||||||||||||||||||||||||||||||||||||||||
| 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::Tools::Run::Phylo::Hyphy::Base); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | =head2 Default Values | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | Valid and default values for FEL 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 | {'New/Restore' => [ "New Analysis", "Restore"]}, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | {'tempalnfile' => undef }, # aln file goes here | ||||||||||||||||||||||||||||||||||||||||||
| 126 | {'Model Options' => [ { "Custom" => '010010' }, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | { "Default" => undef } ] | ||||||||||||||||||||||||||||||||||||||||||
| 128 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 129 | {'temptreefile' => undef }, # tree file goes here | ||||||||||||||||||||||||||||||||||||||||||
| 130 | {'Model Fit Results' => [ '/dev/null'] }, # this will not work under Windows | ||||||||||||||||||||||||||||||||||||||||||
| 131 | {'dN/dS bias parameter' => [ { "Estimate dN/dS only" => undef }, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | { "Neutral" => undef }, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | { "Estimate" => undef }, | ||||||||||||||||||||||||||||||||||||||||||
| 134 | { "Estimate + CI" => undef }, | ||||||||||||||||||||||||||||||||||||||||||
| 135 | { "User" => '3' } ] }, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | {'Ancestor Counting' => [ 'Two rate FEL','Single Ancestor Counting','Weighted Ancestor Counting', | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 'Sample Ancestal States','Process Sampled Ancestal States', | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 'One rate FEL','Rate Distribution', | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 'Full site-by-site LRT','Multirate FEL'] }, | ||||||||||||||||||||||||||||||||||||||||||
| 140 | {'Significance level' => '0.05' }, | ||||||||||||||||||||||||||||||||||||||||||
| 141 | {'Branch Options' => ['Internal Only','All','A Subtree only','Custom subset'] }, | ||||||||||||||||||||||||||||||||||||||||||
| 142 | {'outfile' => undef }, # outfile goes here | ||||||||||||||||||||||||||||||||||||||||||
| 143 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | =head2 program_name | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | Title : program_name | ||||||||||||||||||||||||||||||||||||||||||
| 149 | Usage : $factory->program_name() | ||||||||||||||||||||||||||||||||||||||||||
| 150 | Function: holds the program name | ||||||||||||||||||||||||||||||||||||||||||
| 151 | Returns: string | ||||||||||||||||||||||||||||||||||||||||||
| 152 | Args : None | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | =head2 program_dir | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | Title : program_dir | ||||||||||||||||||||||||||||||||||||||||||
| 159 | Usage : ->program_dir() | ||||||||||||||||||||||||||||||||||||||||||
| 160 | Function: returns the program directory, obtained from ENV variable. | ||||||||||||||||||||||||||||||||||||||||||
| 161 | Returns: string | ||||||||||||||||||||||||||||||||||||||||||
| 162 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 169 | Usage : my $obj = Bio::Tools::Run::Phylo::Hyphy::FEL->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 170 | Function: Builds a new Bio::Tools::Run::Phylo::Hyphy::FEL object | ||||||||||||||||||||||||||||||||||||||||||
| 171 | Returns : Bio::Tools::Run::Phylo::Hyphy::FEL | ||||||||||||||||||||||||||||||||||||||||||
| 172 | Args : -alignment => the Bio::Align::AlignI object | ||||||||||||||||||||||||||||||||||||||||||
| 173 | -save_tempfiles => boolean to save the generated tempfiles and | ||||||||||||||||||||||||||||||||||||||||||
| 174 | NOT cleanup after onesself (default FALSE) | ||||||||||||||||||||||||||||||||||||||||||
| 175 | -tree => the Bio::Tree::TreeI object | ||||||||||||||||||||||||||||||||||||||||||
| 176 | -params => a hashref of parameters (all passed to set_parameter) | ||||||||||||||||||||||||||||||||||||||||||
| 177 | -executable => where the hyphy executable resides | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | See also: L<Bio::Tree::TreeI>, L<Bio::Align::AlignI> | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | sub new { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | my($class,@args) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=23.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | my ($aln, $tree, $st, $params, $exe, | |||||||||||||||||||||||||||||||||||||||||
| 188 | $ubl) = $self->_rearrange([qw(ALIGNMENT TREE SAVE_TEMPFILES | ||||||||||||||||||||||||||||||||||||||||||
| 189 | PARAMS EXECUTABLE)], | ||||||||||||||||||||||||||||||||||||||||||
| 190 | @args); | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | ▶ | defined $aln && $self->alignment($aln); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | ▶ | defined $tree && $self->tree($tree); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | ▶ | defined $st && $self->save_tempfiles($st); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | ▶ | defined $exe && $self->executable($exe); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | $self->set_default_parameters(); | |||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | ▶ | if( defined $params ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if( ref($params) !~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $self->warn("Must provide a valid hash ref for parameter -FLAGS"); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | map { $self->set_parameter($_, $$params{$_}) } keys %$params; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | =head2 run | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | Title : run | ||||||||||||||||||||||||||||||||||||||||||
| 211 | Usage : my ($rc,$results) = $fel->run($aln); | ||||||||||||||||||||||||||||||||||||||||||
| 212 | Function: run the fel analysis using the default or updated parameters | ||||||||||||||||||||||||||||||||||||||||||
| 213 | the alignment parameter must have been set | ||||||||||||||||||||||||||||||||||||||||||
| 214 | Returns : Return code, Hash | ||||||||||||||||||||||||||||||||||||||||||
| 215 | Args : L<Bio::Align::AlignI> object, | ||||||||||||||||||||||||||||||||||||||||||
| 216 | L<Bio::Tree::TreeI> object [optional] | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | sub run { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | my ($self,$aln,$tree) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | $self->prepare($aln,$tree) unless (defined($self->{'_prepared'})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my ($rc,$results) = (1); | |||||||||||||||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $commandstring; | |||||||||||||||||||||||||||||||||||||||||
| 228 | my $exit_status; | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $tempdir = $self->tempdir; | |||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my $felexe = $self->executable(); | |||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $self->throw("unable to find or run executable for 'HYPHY'") unless $felexe && -e $felexe && -x _; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$felexe and -e $felexe and -x _
$felexe and -e $felexe
MC/DC0%0/3
$felexe and -e $felexe and -x _
$felexe
-e $felexe
-x _
Truth table0%0/4
A and B and C
A= $felexeB= -e $felexeC= -x _
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $commandstring = $felexe . " BASEPATH=" . $self->program_dir . " " . $self->{'_wrapper'}; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | open(RUN, "$commandstring |") or $self->throw("Cannot open exe $felexe"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my @output = <RUN>; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $exit_status = close(RUN); | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $self->error_string(join('',@output)); | |||||||||||||||||||||||||||||||||||||||||
| 237 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $self->warn("There was an error - see error_string for the program output"); | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $rc = 0; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $outfile = $self->outfile_name; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | open(OUTFILE, "$outfile") or $self->throw("cannot open $outfile for reading"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $readed_header = 0; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my @elems; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | while (<OUTFILE>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if ($readed_header) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | # FEL results are csv | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my @values = split("\,",$_); | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | for my $i (0 .. (scalar(@values)-1)) { | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $elems[$i] =~ s/\n//g; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | push @{$results->{$elems[$i]}}, $values[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | @elems = split("\,",$_); | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $readed_header = 1; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if( $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $self->warn($self->error_string); | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | unless ( $self->save_tempfiles ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | unlink($self->{'_wrapper'}); | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $self->cleanup(); | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | return ($rc,$results); | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | =head2 create_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | Title : create_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 275 | Usage : $self->create_wrapper | ||||||||||||||||||||||||||||||||||||||||||
| 276 | Function: It will create the wrapper file that interfaces with the analysis bf file | ||||||||||||||||||||||||||||||||||||||||||
| 277 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 278 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 279 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | sub create_wrapper { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_wrapper: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $batchfile = 'QuickSelectionDetection.bf'; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $self->SUPER::create_wrapper($batchfile); | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | =head2 error_string | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | Title : error_string | ||||||||||||||||||||||||||||||||||||||||||
| 295 | Usage : $obj->error_string($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 296 | Function: Where the output from the last analysus run is stored. | ||||||||||||||||||||||||||||||||||||||||||
| 297 | Returns : value of error_string | ||||||||||||||||||||||||||||||||||||||||||
| 298 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | =head2 set_default_parameters | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | Title : set_default_parameters | ||||||||||||||||||||||||||||||||||||||||||
| 306 | Usage : $fel->set_default_parameters(0); | ||||||||||||||||||||||||||||||||||||||||||
| 307 | Function: (Re)set the default parameters from the defaults | ||||||||||||||||||||||||||||||||||||||||||
| 308 | (the first value in each array in the | ||||||||||||||||||||||||||||||||||||||||||
| 309 | %VALIDVALUES class variable) | ||||||||||||||||||||||||||||||||||||||||||
| 310 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 311 | Args : boolean: keep existing parameter values | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | sub set_default_parameters { | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | ▶ | my ($self,$keepold) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_default_parameters: called CC=12 SCAR=24.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 1 | ▶ | $keepold = 0 unless defined $keepold; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 1 | foreach my $elem (@VALIDVALUES) { | |||||||||||||||||||||||||||||||||||||||||
| 320 | 11 | my ($param,$val) = each %$elem; | |||||||||||||||||||||||||||||||||||||||||
| 321 | # skip if we want to keep old values and it is already set | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 11 | ▶ | if (ref($val)=~/ARRAY/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 7 | ▶ | unless (ref($val->[0])=~/HASH/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 5 | push @{ $self->{'_orderedparams'} }, {$param, $val->[0]}; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 2 | $val = $val->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 11 | ▶ | if ( ref($val) =~ /HASH/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | my $prevparam; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 2 | ▶ | while (defined($val)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 3 | ▶ | last unless (ref($val) =~ /HASH/i); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 2 | ▶ | last unless (defined($param)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 2 | $prevparam = $param; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 2 | ($param,$val) = each %{$val}; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 2 | push @{ $self->{'_orderedparams'} }, {$prevparam, $param}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 2 | ▶ | push @{ $self->{'_orderedparams'} }, {$param, $val} if (defined($val)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | ▶ | } 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
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 4 | push @{ $self->{'_orderedparams'} }, {$param, $val}; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | =head1 Bio::Tools::Run::WrapperBase methods | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | =head2 no_param_checks | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | Title : no_param_checks | ||||||||||||||||||||||||||||||||||||||||||
| 353 | Usage : $obj->no_param_checks($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 354 | Function: Boolean flag as to whether or not we should | ||||||||||||||||||||||||||||||||||||||||||
| 355 | trust the sanity checks for parameter values | ||||||||||||||||||||||||||||||||||||||||||
| 356 | Returns : value of no_param_checks | ||||||||||||||||||||||||||||||||||||||||||
| 357 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | =head2 save_tempfiles | ||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | Title : save_tempfiles | ||||||||||||||||||||||||||||||||||||||||||
| 366 | Usage : $obj->save_tempfiles($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 367 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 368 | Returns : value of save_tempfiles | ||||||||||||||||||||||||||||||||||||||||||
| 369 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | =head2 tempdir | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | Title : tempdir | ||||||||||||||||||||||||||||||||||||||||||
| 377 | Usage : my $tmpdir = $self->tempdir(); | ||||||||||||||||||||||||||||||||||||||||||
| 378 | Function: Retrieve a temporary directory name (which is created) | ||||||||||||||||||||||||||||||||||||||||||
| 379 | Returns : string which is the name of the temporary directory | ||||||||||||||||||||||||||||||||||||||||||
| 380 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | =head2 cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | Title : cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 388 | Usage : $fel->cleanup(); | ||||||||||||||||||||||||||||||||||||||||||
| 389 | Function: Will cleanup the tempdir directory after a run | ||||||||||||||||||||||||||||||||||||||||||
| 390 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 391 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | =head2 io | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | Title : io | ||||||||||||||||||||||||||||||||||||||||||
| 399 | Usage : $obj->io($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 400 | Function: Gets a L<Bio::Root::IO> object | ||||||||||||||||||||||||||||||||||||||||||
| 401 | Returns : L<Bio::Root::IO> | ||||||||||||||||||||||||||||||||||||||||||
| 402 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 1 | ▶ | my $self= shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | ▶ | unless ( $self->save_tempfiles ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 1 | $self->cleanup(); | |||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | $self->SUPER::DESTROY(); | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||