lib/Bio/MUST/Apps/TwoScalp/Profile2Profile.pm

filter: Statementstmt 76.1% 64 / 84 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.4% 19 / 21 Podpod 0.0% 0 / 1 totaltotal 75.4% 83 / 110 CC 3 SCAR 9.1
CC
3
Cov
73%
BUILD
12.0
__ANON__
2.0
BEGIN
1.0
CRAP 2.5
« script/two-scalp.pl ↑ Summary lib/Bio/MUST/Apps/TwoScalp/AlignAll.pm »
1 package Bio::MUST::Apps::TwoScalp::Profile2Profile;
2 # ABSTRACT: internal class for two-scalp tool
3 # CONTRIBUTOR: Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
4 # CONTRIBUTOR: Valerian LUPO <valerian.lupo@doct.uliege.be>
5 1 $Bio::MUST::Apps::TwoScalp::Profile2Profile::VERSION = '0.231010';
6 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use feature qw(say);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Smart::Comments '###';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use List::AllUtils qw(part);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use Bio::MUST::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Bio::MUST::Core::Constants qw(:gaps);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Bio::MUST::Core::Utils qw(secure_outfile);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use aliased 'Bio::MUST::Core::Ali';
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use aliased 'Bio::MUST::Core::Seq';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use aliased 'Bio::MUST::Core::SeqId';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use aliased 'Bio::MUST::Core::SeqMask';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use aliased 'Bio::MUST::Drivers::Blast::Database::Temporary';
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use aliased 'Bio::MUST::Drivers::Mafft';
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use aliased 'Bio::MUST::Drivers::ClustalO';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use aliased 'Bio::MUST::Apps::SlaveAligner::Local';
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use aliased 'Bio::MUST::Core::IdList';
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31  
32 1 has 'file1' => (
33 is => 'ro',
34 isa => 'Bio::MUST::Core::Ali',
35 required => 1,
36 coerce => 1,
37 );
38  
39 1 has 'file2' => (
40 is => 'ro',
41 isa => 'Bio::MUST::Core::Ali',
42 required => 1,
43 coerce => 1,
44 );
45  
46 1 has 'ali' => (
47 is => 'ro',
48 isa => 'Bio::MUST::Core::Ali',
49 init_arg => undef,
50 writer => '_set_ali',
51 handles => qr{.*}xms,
52 );
53  
54 has 'options' => (
55 traits => ['Hash'],
56 is => 'ro',
57 isa => 'HashRef',
58 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 1 );
60  
61  
62 sub BUILD {
63 0 ▶ my $self = shift;
Subroutine BUILD: not called CC=3 SCAR=24.8
Pod undocumented
64  
65 # idealize to avoid shared gapped for ClustalO
66 0 my $ali1 = $self->file1->idealize;
67 0 my $ali2 = $self->file2->idealize;
68 0 my $opt = $self->options;
69  
70 0 my ($filename1, $id_mapper1) = $ali1->temp_fasta( {id_prefix => 'file1-'} );
71 0 my ($filename2, $id_mapper2) = $ali2->temp_fasta( {id_prefix => 'file2-'} );
72  
73 0 my %mapper = ( ali1 => $id_mapper1, ali2 => $id_mapper2 );
74  
75 0 my $mafft = Mafft->new( file => $filename1 );
76 0 my $ali_out = $mafft->profile2profile($filename2, $opt);
77  
78 0 ▶ unless (defined $ali_out){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $ali_out) 0 0 0
79 0 carp 'Note: cannot align with mafft; using clustalo instead!';
80 0 my %clustal_opt;
81 $clustal_opt{ '--threads' } = $opt->{ '--thread' }
82 0 ▶ if $opt->{ '--thread' }; # Adapt arg to clustalo syntax
Branch: 1 branch
BranchTrueFalseTotal
if $opt->{"--thread"} 0 0 0
83 0 my $clustalo = ClustalO->new( file => $filename1 );
84 0 $ali_out = $clustalo->profile2profile($filename2, \%clustal_opt);
85 }
86  
87 0 $ali_out->restore_ids($mapper{ali1});
88 0 $ali_out->restore_ids($mapper{ali2});
89  
90 0 $self->_set_ali($ali_out);
91  
92 0 return;
93 }
94  
95 1 __PACKAGE__->meta->make_immutable;
96 1 1;
97  
98 __END__
99  
100 =pod
101  
102 =head1 NAME
103  
104 Bio::MUST::Apps::TwoScalp::Profile2Profile - internal class for two-scalp tool
105  
106 =head1 VERSION
107  
108 version 0.231010
109  
110 =head1 SYNOPSIS
111  
112 # TODO
113  
114 =head1 DESCRIPTION
115  
116 # TODO
117  
118 =head1 AUTHOR
119  
120 Denis BAURAIN <denis.baurain@uliege.be>
121  
122 =head1 CONTRIBUTORS
123  
124 =for stopwords Amandine BERTRAND Valerian LUPO
125  
126 =over 4
127  
128 =item *
129  
130 Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
131  
132 =item *
133  
134 Valerian LUPO <valerian.lupo@doct.uliege.be>
135  
136 =back
137  
138 =head1 COPYRIGHT AND LICENSE
139  
140 This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
141  
142 This is free software; you can redistribute it and/or modify it under
143 the same terms as the Perl 5 programming language system itself.
144  
145 =cut
« script/two-scalp.pl ↑ Summary lib/Bio/MUST/Apps/TwoScalp/AlignAll.pm »