line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
$Bio::MUST::Drivers::ClustalO::VERSION = '0.210160'; |
5
|
6
|
|
|
6
|
|
4873272
|
use Moose; |
|
6
|
|
|
|
|
23
|
|
|
6
|
|
|
|
|
52
|
|
6
|
6
|
|
|
6
|
|
45402
|
use namespace::autoclean; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
66
|
|
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
642
|
use autodie; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
62
|
|
9
|
6
|
|
|
6
|
|
34489
|
use feature qw(say); |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
657
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# use Smart::Comments; |
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
74
|
use Carp; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
548
|
|
14
|
6
|
|
|
6
|
|
52
|
use IPC::System::Simple qw(system); |
|
6
|
|
|
|
|
30
|
|
|
6
|
|
|
|
|
368
|
|
15
|
6
|
|
|
6
|
|
52
|
use Module::Runtime qw(use_module); |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
61
|
|
16
|
6
|
|
|
6
|
|
566
|
use Path::Class qw(file); |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
514
|
|
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
6
|
|
65
|
use Bio::MUST::Core; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
377
|
|
19
|
|
|
|
|
|
|
extends 'Bio::FastParsers::Base'; |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
6
|
|
627
|
use Bio::MUST::Drivers::Utils qw(stringify_args); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
407
|
|
22
|
6
|
|
|
6
|
|
50
|
use aliased 'Bio::MUST::Core::Ali'; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
60
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub align_all { ## no critic (RequireArgUnpacking) |
26
|
|
|
|
|
|
|
#### in align_all |
27
|
0
|
|
|
0
|
0
|
|
return shift->_clustalo('align_all', @_); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub seqs2profile { ## no critic (RequireArgUnpacking) |
31
|
|
|
|
|
|
|
#### in seqs2profile |
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
carp '[BMD] Warning: align seqs before aligning on profile!' |
35
|
|
|
|
|
|
|
unless Ali->load( $self->file )->is_aligned; |
36
|
0
|
|
|
|
|
|
return $self->_clustalo('seqs2profile', @_); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub profile2profile { ## no critic (RequireArgUnpacking) |
40
|
|
|
|
|
|
|
#### in profile2profile |
41
|
0
|
|
|
0
|
0
|
|
return shift->_clustalo('profile2profile', @_); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _clustalo { |
45
|
|
|
|
|
|
|
#### in _clustalo |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
|
|
my $self = shift; |
48
|
0
|
|
|
|
|
|
my $mode = shift; |
49
|
0
|
|
|
|
|
|
my $profile; # conditional declaring is bad... |
50
|
0
|
0
|
|
|
|
|
$profile = shift unless $mode eq 'align_all'; |
51
|
0
|
|
0
|
|
|
|
my $args = shift // {}; |
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
|
0
|
|
|
|
|
$args->{ $mode eq 'profile2profile' ? '--p1' : '-i' } = $infile; |
63
|
0
|
0
|
|
|
|
|
$args->{ $mode eq 'profile2profile' ? '--p2' : '--p1' } = $profile |
|
|
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
|
0
|
|
|
|
|
if ($ret_code == 127) { |
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
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 NAME |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Bio::MUST::Drivers::ClustalO - Bio::MUST driver for running the Clustal Omega program |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 VERSION |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
version 0.210160 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SYNOPSIS |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# TODO |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 DESCRIPTION |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# TODO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Denis BAURAIN <denis.baurain@uliege.be> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 CONTRIBUTOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=for stopwords Amandine BERTRAND |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Amandine BERTRAND <amandine.bertrand@doct.uliege.be> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
128
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |