Installer/PAML.pm

filter: Statementstmt 37.9% 22 / 58 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 63.6% 7 / 11 Podpod 100% 2 / 2 totaltotal 29.8% 31 / 104 SCAR 48.3
CC
16
Cov
25%
_tweak_paml_makefile
182.0
_execute_paml_makefile
20.0
get_default
2.0
CRAP 125.2
« Tools/Phylo/PAML/Result.pm ↑ Summary Tools/Phylo/PAML/ModelResult.pm »
1 package Bio::Installer::PAML;
2 1 $Bio::Installer::PAML::VERSION = '1.7.2';
3 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use vars qw(@ISA %DEFAULTS);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Bio::Root::Root;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Bio::Installer::Generic;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 @ISA = qw(Bio::Installer::Generic );
13  
14 # ABSTRACT: DESCRIPTION of Object
15 # AUTHOR: Albert Vilella <avilella@gmail.com>
16 # OWNER: Albert Vilella <avilella@gmail.com>
17 # LICENSE: Perl_5
18  
19  
20 BEGIN {
21 1 ▶ %DEFAULTS = ( 'ORIGIN_DOWNLOAD_DIR' => 'http://abacus.gene.ucl.ac.uk/software/',
Subroutine BEGIN: called CC=1 SCAR=0.0
22 'BIN_FOLDER' => 'src',
23 'DESTINATION_DOWNLOAD_DIR' => '/tmp',
24 'DESTINATION_INSTALL_DIR' => "$ENV{'HOME'}",
25 'PACKAGE_NAME' => 'paml4a.tar.gz',
26 'DIRECTORY_NAME' => 'paml4',
27 'ENV_NAME' => 'PAMLDIR',
28 );
29 }
30  
31  
32  
33 sub get_default {
34 0 ▶ my $self = shift;
Subroutine get_default: not called CC=1 SCAR=6.9
Pod documented
35 0 my $param = shift;
36 0 return $DEFAULTS{$param};
37 }
38  
39  
40  
41 sub install{
42 0 ▶ my ($self,@args) = @_;
Subroutine install: not called CC=1 SCAR=6.9
Pod documented
43 0 $self->_decompress;
44 0 $self->_tweak_paml_makefile;
45 0 $self->_execute_paml_makefile;
46 0 $self->_remember_env;
47 }
48  
49  
50  
51 sub _execute_paml_makefile{
52 0 ▶ my ($self,@args) = @_;
Subroutine _execute_paml_makefile: not called CC=4 SCAR=30.0
53 0 my $call;
54  
55 0 my $destination = $self->destination_install_dir . "/" . $self->directory_name . "/src";
56 0 ▶ chdir $destination or $self->throw("Cant cd to $destination");
Branch: 1 branch
BranchTrueFalseTotal
chdir $destination or $self->throw("Cant cd to $destination") 0 0 0
57 0 print "\n\nCompiling now... (this might take a while)\n\n";
58 0 ▶ if (($^O =~ /dec_osf|linux|unix|bsd|solaris|darwin/i)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /dec_osf|linux|unix|bsd|solaris|darwin/i) { } 0 0 0
59 0 $call = "make";
60 0 ▶ system("$call") == 0 or $self->throw("Error when trying to run make");
Branch: 1 branch
BranchTrueFalseTotal
system("$call") == 0 or $self->throw("Error when trying to run make") 0 0 0
61 } else {
62 0 $self->throw("_execute_paml_makefile not yet implemented in this platform");
63 }
64 }
65  
66  
67  
68 sub _tweak_paml_makefile{
69 0 ▶ my ($self,@args) = @_;
Subroutine _tweak_paml_makefile: not called CC=13 SCAR=52.0
70 0 my $gcc3;
71 0 my $return = qx/gcc -v 2>&1/;
72 0 ▶ if ($return =~ /version 3/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($return =~ /version 3/) 0 0 0
73 0 $return = `cat /proc/cpuinfo`;
74 0 ▶ if( ($return =~ /mmx/) || ($return =~ /3dnow/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($return =~ /mmx/ or $return =~ /3dnow/) 0 0 0
Condition0%0/3
$return =~ /mmx/ or $return =~ /3dnow/
l!l&&r!l&&!r
000
MC/DC0%0/2
$return =~ /mmx/ or $return =~ /3dnow/
$return =~ /mmx/ $return =~ /3dnow/
Truth table0%0/3
A or B
A= $return =~ /mmx/B= $return =~ /3dnow/
ABresult
1X1
011
000
75 0 my $destination = $self->destination_install_dir . "/" . $self->directory_name . "/src";
76 0 ▶ chdir $destination or $self->throw("Cant cd to $destination");
Branch: 1 branch
BranchTrueFalseTotal
chdir $destination or $self->throw("Cant cd to $destination") 0 0 0
77 0 my $new = "Makefile";
78 0 ▶ open(OLD, "< Makefile.UNIX") or $self->throw("can't open Makefile.UNIX");
Branch: 1 branch
BranchTrueFalseTotal
open OLD, "< Makefile.UNIX" or $self->throw("can't open Makefile.UNIX") 0 0 0
79 0 ▶ open(NEW, "> $new") or $self->throw("can't open $new");
Branch: 1 branch
BranchTrueFalseTotal
open NEW, "> $new" or $self->throw("can't open $new") 0 0 0
80 0 ▶ while (<OLD>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline OLD)) 0 0 0
81 # change $_, then...
82 0 $_ =~ s/CFLAGS = -O3/\# CFLAGS = -O3/g;
83 0 ▶ if( $return =~ /3dnow/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($return =~ /3dnow/) { } 0 0 0
elsif ($return =~ /mmx/) { } 0 0 0
84 0 $_ =~ s/#CFLAGS = -march=athlon -mcpu=athlon -O4 -funroll-loops -fomit-frame-pointer -finline-functions/CFLAGS = -march=athlon -mcpu=athlon -O4 -funroll-loops -fomit-frame-pointer -finline-functions/g;
85 } elsif( $return =~ /mmx/ ) {
86 0 $_ =~ s/#CFLAGS = -march=pentiumpro -mcpu=pentiumpro -O4 -funroll-loops -fomit-frame-pointer -finline-functions/CFLAGS = -march=pentiumpro -mcpu=pentiumpro -O4 -funroll-loops -fomit-frame-pointer -finline-functions/g;
87 }
88 0 ▶ print NEW $_ or $self->throw("can't write $new");
Branch: 1 branch
BranchTrueFalseTotal
print NEW $_ or $self->throw("can't write $new") 0 0 0
89 }
90 0 ▶ close(OLD) or $self->throw("can't close Makefile.UNIX");
Branch: 1 branch
BranchTrueFalseTotal
close OLD or $self->throw("can't close Makefile.UNIX") 0 0 0
91 0 ▶ close(NEW) or $self->throw("can't close $new");
Branch: 1 branch
BranchTrueFalseTotal
close NEW or $self->throw("can't close $new") 0 0 0
92 }
93 }
94  
95  
96 }
97  
98  
99 1 1;
100  
101 __END__
« Tools/Phylo/PAML/Result.pm ↑ Summary Tools/Phylo/PAML/ModelResult.pm »