| 1 | #!/usr/bin/env perl | ||
| 2 | # PODNAME: mask-ali.pl | ||
| 3 | # ABSTRACT: Mask an ALI file according to BLOCKS file(s) | ||
| 4 | |||
| 5 | use Modern::Perl '2011'; | ||
| 6 | use autodie; | ||
| 7 | |||
| 8 | use File::Basename; | ||
| 9 | use Getopt::Euclid qw(:vars); | ||
| 10 | use Smart::Comments; | ||
| 11 | |||
| 12 | use Bio::MUST::Core; | ||
| 13 | use Bio::MUST::Core::Utils qw(insert_suffix); | ||
| 14 | use aliased 'Bio::MUST::Core::Ali'; | ||
| 15 | use aliased 'Bio::MUST::Core::SeqMask'; | ||
| 16 | |||
| 17 | |||
| 18 | ### Sequences taken from: $ARGV_alifile | ||
| 19 | my $ali = Ali->load($ARGV_alifile); | ||
| 20 | |||
| 21 | for my $infile (@ARGV_infiles) { | ||
| 22 | |||
| 23 | ### Processing: $infile | ||
| 24 | my $mask = SeqMask->load_blocks($infile); | ||
| 25 | my $masked = $mask->filtered_ali($ali); | ||
| 26 | |||
| 27 | # create suffix named after filename | ||
| 28 | my ($filename) = fileparse($infile, qr{\.[^.]*}xms); | ||
| 29 | my $outfile = insert_suffix($ARGV_alifile, "-$filename"); | ||
| 30 | ### Output alignment in: $outfile | ||
| 31 | $masked->store($outfile); | ||
| 32 | } | ||
| 33 | |||
| 34 | __END__ |