script/tax-mask-ali.pl untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod n/a totaltotal 0.0% 0 / 53 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 # PODNAME: tax-mask-ali.pl
3 # ABSTRACT: Mask ALI files based on taxonomic filters
4  
5 use Modern::Perl '2011';
6 use autodie;
7  
8 use Config::Any;
9 use Getopt::Euclid qw(:vars);
10 use Smart::Comments;
11  
12 use Bio::MUST::Core;
13 use Bio::MUST::Core::Utils qw(secure_outfile);
14 use aliased 'Bio::MUST::Core::Ali';
15 use aliased 'Bio::MUST::Core::Taxonomy';
16  
17  
18 # read configuration file
19 my $config = Config::Any->load_files( {
20 files => [ $ARGV_config ],
21 flatten_to_hash => 1,
22 use_ext => 1,
23 } );
24 ### config: $config->{$ARGV_config}
25  
26 die "Error: no config file specified; aborting...\n"
27 unless $config;
28  
29 # build taxonomy and classifier objects
30 my $tax = Taxonomy->new_from_cache( tax_dir => $ARGV_taxdir );
31 my $classifier = $tax->tax_classifier( $config->{$ARGV_config} );
32  
33 for my $infile (@ARGV_infiles) {
34  
35 ### Processing: $infile
36 my $ali = Ali->load($infile);
37  
38 my $mask_for = $classifier->tax_masks($ali);
39 while (my ($cat_label, $mask) = each %{$mask_for} ) {
40 my $masked = $mask->filtered_ali($ali);
41 my $outfile = secure_outfile($infile, '_' . $cat_label);
42 ### Output alignment in: $outfile
43 $masked->store($outfile);
44 }
45 }
46  
47 __END__