| 1 | # BioPerl module for Bio::Tools::Run::Alignment::Lagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Cared for by Bioperl | ||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Copyright Bioperl, Stephen Montgomery <smontgom@bcgsc.bc.ca> | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Special thanks to Jason Stajich. | ||||||||||||||||||||||||||||||||||||||||||||||
| 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::Alignment::Lagan - Object for the local execution of the LAGAN suite of tools (including MLAGAN for multiple sequence alignments) | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | use Bio::Tools::Run::Alignment::Lagan; | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | @params = | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ('chaos' => "The contents of this string will be passed as args to chaos", | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | #Read you chaos README file for more info/This functionality | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | #has not been tested and will be integrated in future versions. | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 'order' => "\"-gs -7 -gc -2 -mt 2 -ms -1\"", | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | #Where gap start penalty of- 7, gap continue of -2, match of 2, | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | #and mismatch of -1. | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 'recurse' => "\"(12,25),(7,25),(4,30)"\", | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | #A list of (wordlength,score cutoff) pairs to be used in the | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | #recursive anchoring | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'tree' => "\"(sample1 (sample2 sample3))"\", | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | #Used by mlagan / tree can also be passed when calling mlagan directly | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | #SCORING PARAMETERS FOR MLAGAN: | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 'match' => 12, | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 'mismatch' => -8, | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 'gapstart' => -50, | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 'gapend' => -50, | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 'gapcont' => -2, | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | To run mlagan/lagan, you must have an environment variable that points to | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | the executable directory with files lagan.pl etc. | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | "LAGAN_DIR=/opt/lagan_executables/" | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | Simply having the executables in your path is not supported because the | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | executables themselves only work with the environment variable set. | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | All lagan and mlagan parameters listed in their Readmes can be set | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | except for the mfa flag which has been turned on by default to prevent | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | parsing of the alignment format. | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | TO USE LAGAN: | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | my $lagan = Bio::Tools::Run::Alignment::Lagan->new(@params); | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | my $report_out = $lagan->lagan($seq1, $seq2); | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | A SimpleAlign object is returned. | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | TO USE MLAGAN: | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | my $lagan = Bio::Tools::Run::Alignment::Lagan->new(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | my $tree = "(($seqname1 $seqname2) $seqname3)"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | my @sequence_objs; #an array of bioperl Seq objects | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ##If you use an unblessed seq array | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | my $seq_ref = \@sequence_objs; | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | bless $seq_ref, "ARRAY"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||
| 79 | my $report_out = $lagan->mlagan($seq_ref, $tree); | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | A SimpleAlign object is returned | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | Only basic mlagan/lagan functionality has been implemented due to the | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | iterative development of their project. Future maintenance upgrades | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | will include enhanced features and scoring. | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||
| 91 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||
| 99 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||
| 103 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | web: | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | http://redmine.open-bio.org/projects/bioperl/ | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | =head1 AUTHOR - Stephen Montgomery | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | Email smontgom@bcgsc.bc.ca | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||
| 122 | Genome Sciences Centre in beautiful Vancouver, British Columbia CANADA | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||
| 126 | MLagan/Lagan is the hard work of Michael Brudno et al. | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||
| 128 | Sendu Bala bix@sendu.me.uk | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||
| 137 | package Bio::Tools::Run::Alignment::Lagan; | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | ▶ | use Bio::Root::IO; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | use Bio::Seq; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | use Bio::SeqIO; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | ▶ | use Bio::AlignIO; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | use Bio::SimpleAlign; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | ▶ | use Bio::Matrix::IO; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | ▶ | use base qw(Bio::Tools::Run::WrapperBase); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 1 | our @LAGAN_PARAMS = qw(chaos order recurse mfa out lazy maskedonly | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | usebounds rc translate draft info fastreject); | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | our @OTHER_PARAMS = qw(outfile); | |||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | our @LAGAN_SWITCHES = qw(silent quiet); | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | our @MLAGAN_PARAMS = qw(nested postir translate lazy verbose tree match mismatch | |||||||||||||||||||||||||||||||||||||||||||||
| 156 | gapstart gapend gapcont out version); | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | #Not all of these parameters are useful in this context, care | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | #should be used in setting only standard ones | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | #The LAGAN_DIR environment variable must be set | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | ▶ | our $PROGRAM_DIR = $ENV{'LAGAN_DIR'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'LAGAN_DIR'} || ''
MC/DC0%0/1
$ENV{'LAGAN_DIR'} || ''
$ENV{'LAGAN_DIR'}
Truth table50%1/2
A
A= $ENV{'LAGAN_DIR'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1 | my($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | $self->_set_from_args(\@args, -methods => [@LAGAN_PARAMS, @OTHER_PARAMS, | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | @LAGAN_SWITCHES, @MLAGAN_PARAMS], | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | -create => 1); | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | my ($tfh, $tempfile) = $self->io->tempfile(); | |||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | my $outfile = $self->out || $self->outfile || $tempfile; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$self->out || $self->outfile || $tempfile
$self->out or $self->outfile
MC/DC0%0/3
$self->out || $self->outfile || $tempfile
$self->out
$self->outfile
$tempfile
Truth table25%1/4
A or B || C
A= $self->outB= $self->outfileC= $tempfile
| |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | $self->out($outfile); | |||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | close($tfh); | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | undef $tfh; | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | =head2 lagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | Runs the Lagan pairwise alignment algorithm | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | Inputs should be two PrimarySeq objects. | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | Returns an SimpleAlign object / preloaded with the tmp file of the | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | Lagan multifasta output. | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | sub lagan { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lagan: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my ($self, $input1, $input2) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->io->_io_cleanup(); | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $executable = 'lagan.pl'; | |||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | #my (undef, $tempfile) = $self->io->tempfile(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | #$self->out($tempfile); | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my ($infile1, $infile2) = $self->_setinput($executable, $input1, $input2); | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $lagan_report = &_generic_lagan( $self, | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | $executable, | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | $infile1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | $infile2 ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | =head2 mlagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | Runs the Mlagan multiple sequence alignment algorithm. | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | Inputs should be an Array of Primary Seq objects and a Phylogenetic Tree in | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | String format or as a Bio::Tree::TreeI compliant object. | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | Returns an SimpleAlign object / preloaded with the tmp file of the Mlagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 210 | multifasta output. | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub mlagan { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mlagan: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my ($self, $input1, $tree) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $self->io->_io_cleanup(); | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my $executable = 'mlagan'; | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | if ($tree && ref($tree) && $tree->isa('Bio::Tree::TreeI')) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tree and ref $tree and $tree->isa("Bio::Tree::TreeI")
$tree and ref $tree
MC/DC0%0/3
$tree and ref $tree and $tree->isa("Bio::Tree::TreeI")
$tree
ref $tree
$tree->isa("Bio::Tree::TreeI")
Truth table0%0/4
A and B and C
A= $treeB= ref $treeC= $tree->isa("Bio::Tree::TreeI")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 220 | # fiddle tree so mlagan will like it | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my %orig_ids; | |||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | foreach my $node ($tree->get_nodes) { | |||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $seq_id = $node->name('supplied'); | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | $seq_id = $seq_id ? shift @{$seq_id} : ($node->node_name ? $node->node_name : $node->id); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | $orig_ids{$seq_id} = $node->id; | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $node->id($seq_id); | |||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # convert to string | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my $tree_obj = $tree; | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $tree = $tree->simplify_to_leaves_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # more fiddling | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $tree =~ s/ /_/g; | |||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $tree =~ s/"//g; | |||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $tree =~ s/,/ /g; | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # unfiddle the tree object | ||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | foreach my $node ($tree_obj->get_nodes) { | |||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $node->id($orig_ids{$node->id}); | |||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $infiles; | |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ($infiles, $tree) = $self->_setinput($executable, $input1, $tree); | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $lagan_report = &_generic_lagan ( $self, | |||||||||||||||||||||||||||||||||||||||||||||
| 247 | $executable, | ||||||||||||||||||||||||||||||||||||||||||||||
| 248 | $infiles, | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | $tree ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =head2 nuc_matrix | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | Title : nuc_matrix | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | Usage : my $matrix_obj = $obj->nuc_matrix(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 256 | -or- | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | $obj->nuc_matrix($matrix_obj); | ||||||||||||||||||||||||||||||||||||||||||||||
| 258 | -or- | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | $obj->nuc_matrix($matrix_file); | ||||||||||||||||||||||||||||||||||||||||||||||
| 260 | Function: Get/set the substitution matrix for use by mlagan. By default the | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | file $LAGAN_DIR/nucmatrix.txt is used by mlagan. By default this | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | method returns a corresponding Matrix. | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | Returns : Bio::Matrix::Mlagan object | ||||||||||||||||||||||||||||||||||||||||||||||
| 264 | Args : none to get, OR to set: | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | Bio::Matrix::MLagan object | ||||||||||||||||||||||||||||||||||||||||||||||
| 266 | OR | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | filename of an mlagan substitution matrix file | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||
| 269 | NB: due to a bug in mlagan 2.0, the -nucmatrixfile option does not | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | work, so this Bioperl wrapper is unable to simply point mlagan to | ||||||||||||||||||||||||||||||||||||||||||||||
| 271 | your desired matrix file (or to a temp file generated from your | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | matrix object). Instead the $LAGAN_DIR/nucmatrix.txt file must | ||||||||||||||||||||||||||||||||||||||||||||||
| 273 | actually be replaced. This wrapper will make a back-up copy of that | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | file, write the new file in its place, then revert things back to the | ||||||||||||||||||||||||||||||||||||||||||||||
| 275 | way they were after the alignment has been produced. For this reason, | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | $LAGAN_DIR must be writable, as must $LAGAN_DIR/nucmatrix.txt. | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||
| 278 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub nuc_matrix { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nuc_matrix: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my ($self, $thing, $gap_open, $gap_continue) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | if ($thing) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if (-e $thing) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $min = Bio::Matrix::IO->new(-format => 'mlagan', | |||||||||||||||||||||||||||||||||||||||||||||
| 286 | -file => $thing); | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $self->{_nuc_matrix} = $min->next_matrix; | |||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ▶ | elsif (ref($thing) && $thing->isa('Bio::Matrix::Mlagan')) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $thing and $thing->isa("Bio::Matrix::Mlagan")
MC/DC0%0/2
ref $thing and $thing->isa("Bio::Matrix::Mlagan")
ref $thing
$thing->isa("Bio::Matrix::Mlagan")
Truth table0%0/3
A and B
A= ref $thingB= $thing->isa("Bio::Matrix::Mlagan")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $self->{_nuc_matrix} = $thing; | |||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $self->throw("Unknown kind of thing supplied, '$thing'"); | |||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $self->{_nuc_matrix_set} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | unless (defined $self->{_nuc_matrix}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # read the program default file | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my $min = Bio::Matrix::IO->new(-format => 'mlagan', | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | -file => File::Spec->catfile($PROGRAM_DIR, 'nucmatrix.txt')); | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $self->{_nuc_matrix} = $min->next_matrix; | |||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | $self->{_nuc_matrix_set} = 1 if defined wantarray; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | return $self->{_nuc_matrix}; | |||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||
| 310 | =head2 _setinput | ||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||
| 312 | Title : _setinput | ||||||||||||||||||||||||||||||||||||||||||||||
| 313 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | Function: Create input file(s) for Lagan executables | ||||||||||||||||||||||||||||||||||||||||||||||
| 315 | Returns : name of files containing Lagan data input / | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | or array of files and phylo tree for Mlagan data input | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub _setinput { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_setinput: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | my ($self, $executable, $input1, $input2) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my ($fh, $infile1, $infile2, $temp1, $temp2, $seq1, $seq2); | |||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $self->io->_io_cleanup(); | |||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||
| 326 | SWITCH: { | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | if (ref($input1) =~ /ARRAY/i) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||
| 329 | ##INPUTS TO MLAGAN / WILL hAVE TO BE CHANGED IF LAGAN EVER | ||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ##SUPPORTS MULTI-INPUT | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | my @infilearr; | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | foreach $seq1 (@$input1) { | |||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ($fh, $infile1) = $self->io->tempfile(); | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $temp = Bio::SeqIO->new( -fh => $fh, | |||||||||||||||||||||||||||||||||||||||||||||
| 335 | -format => 'Fasta' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | ▶ | unless ($seq1->isa("Bio::PrimarySeqI")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | $temp->write_seq($seq1); | |||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | undef $fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | push @infilearr, $infile1; | |||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $infile1 = \@infilearr; | |||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 347 | elsif ($input1->isa("Bio::PrimarySeqI")) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | ##INPUTS TO LAGAN | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ($fh, $infile1) = $self->io->tempfile(); | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | #Want to make sure their are no white spaces in sequence. | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | #Happens if input1 is taken from an alignment. | ||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $sequence = $input1->seq(); | |||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $sequence =~ s/\W+//g; | |||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $input1->seq($sequence); | |||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $temp1 = Bio::SeqIO->new( -fh => $fh, | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | -format => 'Fasta' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $temp1->write_seq($input1); | |||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | undef $fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | last SWITCH; | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | SWITCH2: { | ||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | if (ref($input2)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if ($input2->isa("Bio::PrimarySeqI")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ($fh, $infile2) = $self->io->tempfile(); | |||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||
| 370 | #Want to make sure their are no white spaces in | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | #sequence. Happens if input2 is taken from an | ||||||||||||||||||||||||||||||||||||||||||||||
| 372 | #alignment. | ||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $sequence = $input2->seq(); | |||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $sequence =~ s/\W+//g; | |||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $input2->seq($sequence); | |||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | $temp2 = Bio::SeqIO->new( -fh => $fh, | |||||||||||||||||||||||||||||||||||||||||||||
| 379 | -format => 'Fasta' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $temp2->write_seq($input2); | |||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | close $fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | undef $fh; | |||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | last SWITCH2; | |||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $infile2 = $input2; | |||||||||||||||||||||||||||||||||||||||||||||
| 387 | ##A tree as a scalar has been passed, pass it through | ||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return ($infile1, $infile2); | |||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||
| 393 | =head2 _generic_lagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||
| 395 | Title : _generic_lagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 396 | Usage : internal function not called directly | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | Returns : SimpleAlign object | ||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||
| 399 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | sub _generic_lagan { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generic_lagan: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my ($self, $executable, $input1, $input2) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $param_string = $self->_setparams($executable); | |||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $lagan_report = &_runlagan($self, $executable, $param_string, | |||||||||||||||||||||||||||||||||||||||||||||
| 406 | $input1, $input2); | ||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||
| 409 | =head2 _setparams | ||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||
| 411 | Title : _setparams | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||||||
| 413 | Function: Create parameter inputs for (m)Lagan program | ||||||||||||||||||||||||||||||||||||||||||||||
| 414 | Returns : parameter string to be passed to Lagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | Args : Reference to calling object and name of (m)Lagan executable | ||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||
| 417 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | sub _setparams { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_setparams: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | my ($self, $executable) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my (@execparams, $nucmatrixfile); | |||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if ($executable eq 'lagan.pl') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | @execparams = @LAGAN_PARAMS; | |||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | elsif ($executable eq 'mlagan') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | @execparams = @MLAGAN_PARAMS; | |||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if ($self->{_nuc_matrix_set}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # we create this file on every call because we have no way of | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # knowing if user altered the matrix object | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | (my $handle, $nucmatrixfile) = $self->io->tempfile(); | |||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $mout = Bio::Matrix::IO->new(-format => 'mlagan', | |||||||||||||||||||||||||||||||||||||||||||||
| 435 | -fh => $handle); | ||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | $mout->write_matrix($self->nuc_matrix); | |||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $self->{_nucmatrixfile} = $nucmatrixfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ##EXPAND OTHER LAGAN SUITE PROGRAMS HERE | ||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | my $param_string = $self->SUPER::_setparams(-params => [@execparams], | |||||||||||||||||||||||||||||||||||||||||||||
| 443 | -dash => 1); | ||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $param_string .= " -nucmatrixfile $nucmatrixfile" if $nucmatrixfile; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | return $param_string . " -mfa "; | |||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||
| 449 | =head2 _runlagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||
| 451 | Title : _runlagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 452 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||||||||||||||||||||
| 453 | Function: makes actual system call to (m)Lagan program | ||||||||||||||||||||||||||||||||||||||||||||||
| 454 | Example : | ||||||||||||||||||||||||||||||||||||||||||||||
| 455 | Returns : Report object in the SimpleAlign object | ||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||
| 457 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | sub _runlagan { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_runlagan: not called CC=26 SCAR=65.5
| |||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my ($self, $executable, $param_string, $input1, $input2) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my ($lagan_obj, $exe); | |||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | if ( ! ($exe = $self->executable($executable))) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my $version = $self->version; | |||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my $command_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | if ($executable eq 'lagan.pl') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $command_string = $exe . " " . $input1 . " " . $input2 . $param_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if ($executable eq 'mlagan') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $command_string = $exe; | |||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | foreach my $tempfile (@$input1) { | |||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $command_string .= " " . $tempfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | if (defined $input2) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | $command_string .= " -tree " . "\"" . $input2 . "\""; | |||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | $command_string .= " " . $param_string; | |||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | my $matrix_file = $self->{_nucmatrixfile}; | |||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | if ($version <= 3 && $matrix_file) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$version <= 3 and $matrix_file
MC/DC0%0/2
$version <= 3 and $matrix_file
$version <= 3
$matrix_file
Truth table0%0/3
A and B
A= $version <= 3B= $matrix_file
| |||||||||||||||||||||||||||||||||||||||||||||||
| 484 | # mlagan 2.0 bug-workaround | ||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $orig = File::Spec->catfile($PROGRAM_DIR, 'nucmatrix.txt'); | |||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | -e $orig || $self->throw("Strange, $orig doesn't seem to exist"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | system("cp $orig $orig.bk") && $self->throw("Backup of $orig failed: $!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | system("cp $matrix_file $orig") && $self->throw("Copy of $matrix_file -> $orig failed: $!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | if (($self->silent || $self->quiet) && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->silent || $self->quiet and not $^O =~ /os2|dos|MSWin32|amigaos/
$self->silent or $self->quiet
MC/DC0%0/3
$self->silent || $self->quiet and not $^O =~ /os2|dos|MSWin32|amigaos/
$self->silent
$self->quiet
not $^O =~ /os2|dos|MSWin32|amigaos/
Truth table0%0/5
A or B and not(C)
A= $self->silentB= $self->quietC= not $^O =~ /os2|dos|MSWin32|amigaos/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 493 | ($^O !~ /os2|dos|MSWin32|amigaos/)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $command_string .= " > $null 2> $null"; | |||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # will do brute-force clean up of junk files generated by lagan | ||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $cwd = cwd(); | |||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | opendir(my $cwd_dir, $cwd) || $self->throw("Could not open the current directory '$cwd'!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my %ok_files; | |||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | foreach my $thing (readdir($cwd_dir)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | if ($thing =~ /anch/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $ok_files{$thing} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | closedir($cwd_dir); | |||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $self->debug("$command_string\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | my $status = system(($version <= 3 ? '_POSIX2_VERSION=1 ' : '').$command_string); # temporary hack whilst lagan script 'rechaos.pl' uses obsolete sort syntax | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if ($version <= 1 && $self->{_nucmatrixfile}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$version <= 1 and $self->{"_nucmatrixfile"}
MC/DC0%0/2
$version <= 1 and $self->{"_nucmatrixfile"}
$version <= 1
$self->{"_nucmatrixfile"}
Truth table0%0/3
A and B
A= $version <= 1B= $self->{"_nucmatrixfile"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | my $orig = File::Spec->catfile($PROGRAM_DIR, 'nucmatrix.txt'); | |||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | system("mv $orig.bk $orig") && $self->warn("Restore of $orig from $orig.bk failed: $!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | opendir($cwd_dir, $cwd) || $self->throw("Could not open the current directory '$cwd'!"); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | foreach my $thing (readdir($cwd_dir)) { | |||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | if ($thing =~ /anch/) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | unlink($thing) unless $ok_files{$thing}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | closedir($cwd_dir); | |||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $outfile = $self->out(); | |||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my $align = Bio::AlignIO->new( '-file' => $outfile, | |||||||||||||||||||||||||||||||||||||||||||||
| 528 | '-format' => 'fasta' ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my $aln = $align->next_aln(); | |||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | return $aln; | |||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||
| 534 | =head2 executable | ||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||
| 536 | Title : executable | ||||||||||||||||||||||||||||||||||||||||||||||
| 537 | Usage : my $exe = $lagan->executable('mlagan'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 538 | Function: Finds the full path to the 'lagan' executable | ||||||||||||||||||||||||||||||||||||||||||||||
| 539 | Returns : string representing the full path to the exe | ||||||||||||||||||||||||||||||||||||||||||||||
| 540 | Args : [optional] name of executable to set path to | ||||||||||||||||||||||||||||||||||||||||||||||
| 541 | [optional] boolean flag whether or not warn when exe is not found | ||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||
| 543 | Thanks to Jason Stajich for providing the framework for this subroutine | ||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||
| 545 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 1 | ▶ | sub executable { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
executable: called CC=12 SCAR=30.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 1 | my ($self, $exename, $exe, $warn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 549 | 1 | ▶ | $exename = 'lagan.pl' unless defined $exename; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 1 | ▶ | if ( defined $exe && -x $exe ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $exe and -x $exe
MC/DC0%0/2
defined $exe and -x $exe
defined $exe
-x $exe
Truth table33%1/3
A and B
A= defined $exeB= -x $exe
| |||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $self->{'_pathtoexe'}->{$exename} = $exe; | |||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 1 | ▶ | unless ( defined $self->{'_pathtoexe'}->{$exename} ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 1 | my $f = $self->program_path($exename); | |||||||||||||||||||||||||||||||||||||||||||||
| 556 | 1 | ▶ | $exe = $self->{'_pathtoexe'}->{$exename} = $f if(-e $f && -x $f ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-e $f and -x $f
MC/DC0%0/2
-e $f and -x $f
-e $f
-x $f
Truth table33%1/3
A and B
A= -e $fB= -x $f
| |||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 1 | ▶ | unless( $exe ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 1 | ▶ | if ( ($exe = $self->io->exists_exe($exename)) && -x $exe ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$exe = $self->io->exists_exe($exename) and -x $exe
MC/DC0%0/2
$exe = $self->io->exists_exe($exename) and -x $exe
$exe = $self->io->exists_exe($exename)
-x $exe
Truth table33%1/3
A and B
A= $exe = $self->io->exists_exe($exename)B= -x $exe
| |||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | $self->{'_pathtoexe'}->{$exename} = $exe; | |||||||||||||||||||||||||||||||||||||||||||||
| 561 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 1 | ▶ | $self->warn("Cannot find executable for $exename") if $warn; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1 | $self->{'_pathtoexe'}->{$exename} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||||||
| 568 | # even if its executable, we still need the environment variable to have | ||||||||||||||||||||||||||||||||||||||||||||||
| 569 | # been set | ||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 1 | ▶ | if (! $PROGRAM_DIR) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | $self->warn("Environment variable LAGAN_DIR must be set, even if the lagan executables are in your path"); | |||||||||||||||||||||||||||||||||||||||||||||
| 572 | 1 | $self->{'_pathtoexe'}->{$exename} = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 1 | return $self->{'_pathtoexe'}->{$exename}; | |||||||||||||||||||||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||
| 578 | =head2 program_path | ||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||
| 580 | Title : program_path | ||||||||||||||||||||||||||||||||||||||||||||||
| 581 | Usage : my $path = $lagan->program_path(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 582 | Function: Builds path for executable | ||||||||||||||||||||||||||||||||||||||||||||||
| 583 | Returns : string representing the full path to the exe | ||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||
| 585 | Thanks to Jason Stajich for providing the framework for this subroutine | ||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||
| 587 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1 | ▶ | sub program_path { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
program_path: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | my ($self,$program_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | my @path; | |||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | ▶ | push @path, $self->program_dir if $self->program_dir; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | ▶ | push @path, $program_name .($^O =~ /mswin/i ?'':''); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 594 | # Option for Windows variants / None so far | ||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 1 | return Bio::Root::IO->catfile(@path); | |||||||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||
| 599 | =head2 program_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||
| 601 | Title : program_dir | ||||||||||||||||||||||||||||||||||||||||||||||
| 602 | Usage : my $dir = $lagan->program_dir(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 603 | Function: Abstract get method for dir of program. To be implemented | ||||||||||||||||||||||||||||||||||||||||||||||
| 604 | by wrapper. | ||||||||||||||||||||||||||||||||||||||||||||||
| 605 | Returns : string representing program directory | ||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||
| 607 | Thanks to Jason Stajich for providing the framework for this subroutine | ||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||
| 609 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 1 | ▶ | sub program_dir { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
program_dir: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 1 | $PROGRAM_DIR; | |||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||
| 615 | =head2 version | ||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||
| 617 | Title : version | ||||||||||||||||||||||||||||||||||||||||||||||
| 618 | Usage : my $version = $lagan->version; | ||||||||||||||||||||||||||||||||||||||||||||||
| 619 | Function: returns the program version | ||||||||||||||||||||||||||||||||||||||||||||||
| 620 | Returns : number | ||||||||||||||||||||||||||||||||||||||||||||||
| 621 | Args : none | ||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||
| 623 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | my $exe = $self->executable('mlagan') || return; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->executable('mlagan') || (return)
MC/DC0%0/1
$self->executable('mlagan') || (return)
$self->executable('mlagan')
Truth table0%0/2
A
A= $self->executable('mlagan')
| |||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | open(my $VER, "$exe -version 2>&1 |") || die "Could not open command '$exe -version'\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | my $version; | |||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | while (my $line = <$VER>) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | ($version) = $line =~ /(\d+\S+)/; | |||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | close($VER) || die "Could not complete command '$exe -version'\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | return $version; | |||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||