File Coverage

blib/lib/Bio/MUST/Apps/TwoScalp/Profile2Profile.pm
Criterion Covered Total %
statement 54 72 75.0
branch 0 2 0.0
condition n/a
subroutine 18 19 94.7
pod 0 1 0.0
total 72 94 76.6


line stmt bran cond sub pod time code
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             $Bio::MUST::Apps::TwoScalp::Profile2Profile::VERSION = '0.201810';
5 1     1   8 use Moose;
  1         2  
  1         10  
6 1     1   7467 use namespace::autoclean;
  1         2  
  1         13  
7              
8 1     1   101 use autodie;
  1         3  
  1         9  
9 1     1   5621 use feature qw(say);
  1         3  
  1         108  
10              
11 1     1   8 use Smart::Comments '###';
  1         3  
  1         11  
12              
13 1     1   2172 use List::AllUtils qw(part);
  1         3  
  1         75  
14             #use Try::Tiny;
15             #use Try::Tiny::Warnings;
16              
17 1     1   7 use Bio::MUST::Core;
  1         3  
  1         34  
18 1     1   6 use Bio::MUST::Core::Constants qw(:gaps);
  1         2  
  1         180  
19 1     1   8 use Bio::MUST::Core::Utils qw(secure_outfile);
  1         2  
  1         53  
20              
21 1     1   7 use aliased 'Bio::MUST::Core::Ali';
  1         2  
  1         9  
22 1     1   232 use aliased 'Bio::MUST::Core::Seq';
  1         2  
  1         4  
23 1     1   184 use aliased 'Bio::MUST::Core::SeqId';
  1         2  
  1         5  
24 1     1   178 use aliased 'Bio::MUST::Core::SeqMask';
  1         3  
  1         4  
25 1     1   174 use aliased 'Bio::MUST::Drivers::Blast::Database::Temporary';
  1         2  
  1         4  
26             #use aliased 'Bio::MUST::Drivers::Blast::Query';
27 1     1   182 use aliased 'Bio::MUST::Drivers::Mafft';
  1         3  
  1         4  
28 1     1   176 use aliased 'Bio::MUST::Drivers::ClustalO';
  1         2  
  1         4  
29 1     1   169 use aliased 'Bio::MUST::Apps::SlaveAligner::Local';
  1         3  
  1         10  
30 1     1   189 use aliased 'Bio::MUST::Core::IdList';
  1         2  
  1         4  
31              
32              
33             has 'file1' => (
34             is => 'ro',
35             isa => 'Bio::MUST::Core::Ali',
36             required => 1,
37             coerce => 1,
38             );
39              
40             has 'file2' => (
41             is => 'ro',
42             isa => 'Bio::MUST::Core::Ali',
43             required => 1,
44             coerce => 1,
45             );
46              
47              
48             has 'ali' => (
49             is => 'ro',
50             isa => 'Bio::MUST::Core::Ali',
51             init_arg => undef,
52             writer => '_set_ali',
53             handles => qr{.*}xms,
54             );
55              
56              
57             sub BUILD {
58 0     0 0   my $self = shift;
59              
60             # idealize to avoid shared gapped for ClustalO
61 0           my $ali1 = $self->file1->idealize;
62 0           my $ali2 = $self->file2->idealize;
63              
64 0           my ($filename1, $id_mapper1) = $ali1->temp_fasta( {id_prefix => 'file1-'} );
65 0           my ($filename2, $id_mapper2) = $ali2->temp_fasta( {id_prefix => 'file2-'} );
66              
67 0           my %mapper = ( ali1 => $id_mapper1, ali2 => $id_mapper2 );
68              
69 0           my $mafft = Mafft->new( file => $filename1 );
70 0           my $ali_out = $mafft->profile2profile($filename2);
71              
72 0 0         unless (defined $ali_out){
73 0           ### Error mafft... using clustalo instead
  0            
74 0           my $clustalo = ClustalO->new( file => $filename1 );
75 0           $ali_out = $clustalo->profile2profile($filename2);
76             }
77              
78 0           $ali_out->dont_guess;
79 0           $ali_out->restore_ids($mapper{ali1});
80 0           $ali_out->restore_ids($mapper{ali2});
81              
82 0           $self->_set_ali($ali_out);
83              
84 0           return;
85             }
86              
87             __PACKAGE__->meta->make_immutable;
88             1;
89              
90             __END__
91              
92             =pod
93              
94             =head1 NAME
95              
96             Bio::MUST::Apps::TwoScalp::Profile2Profile - internal class for two-scalp tool
97              
98             =head1 VERSION
99              
100             version 0.201810
101              
102             =head1 SYNOPSIS
103              
104             # TODO
105              
106             =head1 DESCRIPTION
107              
108             # TODO
109              
110             =head1 AUTHOR
111              
112             Denis BAURAIN <denis.baurain@uliege.be>
113              
114             =head1 CONTRIBUTOR
115              
116             =for stopwords Amandine BERTRAND
117              
118             Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
119              
120             =head1 COPYRIGHT AND LICENSE
121              
122             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
123              
124             This is free software; you can redistribute it and/or modify it under
125             the same terms as the Perl 5 programming language system itself.
126              
127             =cut