lib/Bio/MUST/Drivers/ClustalO.pm

filter: Statementstmt 57.8% 37 / 64 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 73.3% 11 / 15 Podpod 0.0% 0 / 3 totaltotal 49.4% 48 / 97 CC 8 SCAR 29.5
CC
8
Cov
47%
_clustalo
56.0
seqs2profile
6.0
align_all
2.0
CRAP 19.0
« lib/Bio/MUST/Drivers/Mafft.pm ↑ Summary lib/Bio/MUST/Drivers/Exonerate.pm »
1 package Bio::MUST::Drivers::ClustalO;
2 # ABSTRACT: Bio::MUST driver for running the Clustal Omega program
3 # CONTRIBUTOR: Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
4 6 $Bio::MUST::Drivers::ClustalO::VERSION = '0.252830';
5 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use feature qw(say);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # use Smart::Comments;
12  
13 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use IPC::System::Simple qw(system);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 6 ▶use Module::Runtime qw(use_module);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶use Path::Class qw(file);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 6 ▶use Bio::MUST::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 6 extends 'Bio::FastParsers::Base';
20  
21 6 ▶use Bio::MUST::Drivers::Utils qw(stringify_args);
Subroutine BEGIN: called CC=1 SCAR=0.0
22 6 ▶use aliased 'Bio::MUST::Core::Ali';
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24  
25 0 ▶sub align_all { ## no critic (RequireArgUnpacking)
Subroutine align_all: not called CC=1 SCAR=6.9
Pod undocumented
26 #### in align_all
27 0 return shift->_clustalo('align_all', @_);
28 }
29  
30 0 ▶sub seqs2profile { ## no critic (RequireArgUnpacking)
Subroutine seqs2profile: not called CC=2 SCAR=17.9
Pod undocumented
31 #### in seqs2profile
32 0 my $self = shift;
33  
34 0 ▶ carp '[BMD] Warning: align seqs before aligning on profile!'
Branch: 1 branch
BranchTrueFalseTotal
unless "Bio::MUST::Core::Ali"->load($self->file)->is_aligned 0 0 0
35 unless Ali->load( $self->file )->is_aligned;
36 0 return $self->_clustalo('seqs2profile', @_);
37 }
38  
39 0 ▶sub profile2profile { ## no critic (RequireArgUnpacking)
Subroutine profile2profile: not called CC=1 SCAR=6.9
Pod undocumented
40 #### in profile2profile
41 0 return shift->_clustalo('profile2profile', @_);
42 }
43  
44 0 ▶sub _clustalo {
Subroutine _clustalo: not called CC=7 SCAR=40.3
45 #### in _clustalo
46  
47 0 my $self = shift;
48 0 my $mode = shift;
49 0 my $profile; # conditional declaring is bad...
50 0 ▶ $profile = shift unless $mode eq 'align_all';
Branch: 1 branch
BranchTrueFalseTotal
unless $mode eq "align_all" 0 0 0
51 0 ▶ my $args = shift // {};
Condition0%0/2
shift() // {}
l!l
00
MC/DC0%0/1
shift() // {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
52  
53 # provision executable
54 0 my $app = use_module('Bio::MUST::Provision::ClustalO')->new;
55 0 $app->meet();
56  
57 # setup input/output files
58 0 my $infile = $self->filename;
59 0 my $outfile = $infile . '.clustalo';
60  
61 0 $args->{-o} = $outfile;
62 0 ▶ $args->{ $mode eq 'profile2profile' ? '--p1' : '-i' } = $infile;
Branch: 1 branch
BranchTrueFalseTotal
$mode eq 'profile2profile' ? : 0 0 0
63 0 ▶ $args->{ $mode eq 'profile2profile' ? '--p2' : '--p1' } = $profile
Branch: 2 branches
BranchTrueFalseTotal
if $profile 0 0 0
$mode eq 'profile2profile' ? : 0 0 0
64 if $profile;
65  
66 0 my $args_str = stringify_args($args);
67  
68 # create clustalo command
69 0 my $pgm = 'clustalo';
70 0 my $cmd = join q{ }, $pgm, $args_str, '2> /dev/null';
71 #### $cmd
72  
73 # try to robustly execute clustalo
74 0 my $ret_code = system( [ 0, 127 ], $cmd);
75 0 ▶ if ($ret_code == 127) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ret_code == 127) 0 0 0
76 0 carp "[BMD] Warning: cannot execute $pgm command; returning nothing!";
77 0 return;
78 }
79  
80 0 my $out = Ali->load($outfile);
81 # TODO: try to bypass shell (need for absolute path to executable then)
82  
83 # unlink temp file
84 0 file($outfile)->remove;
85  
86 # return Ali
87 0 return $out;
88 }
89  
90 6 __PACKAGE__->meta->make_immutable;
91 6 1;
92  
93 __END__
« lib/Bio/MUST/Drivers/Mafft.pm ↑ Summary lib/Bio/MUST/Drivers/Exonerate.pm »