| 1 | #!/usr/bin/env perl | ||
| 2 | # PODNAME: rest-ids-ali.pl | ||
| 3 | # ABSTRACT: Change (restore) full seq ids in ALI files | ||
| 4 | |||
| 5 | use Modern::Perl '2011'; | ||
| 6 | use autodie; | ||
| 7 | |||
| 8 | use Getopt::Euclid qw(:vars); | ||
| 9 | use Smart::Comments; | ||
| 10 | |||
| 11 | use Bio::MUST::Core; | ||
| 12 | use Bio::MUST::Core::Utils qw(change_suffix secure_outfile); | ||
| 13 | use aliased 'Bio::MUST::Core::Ali'; | ||
| 14 | use aliased 'Bio::MUST::Core::IdMapper'; | ||
| 15 | |||
| 16 | |||
| 17 | for my $infile (@ARGV_infiles) { | ||
| 18 | |||
| 19 | ### Processing: $infile | ||
| 20 | my $ali = Ali->load($infile); | ||
| 21 | $ali->dont_guess if $ARGV_noguessing; | ||
| 22 | |||
| 23 | $infile =~ s/$_//xms for @ARGV_in_strip; | ||
| 24 | my $idmfile = change_suffix($infile, '.idm'); | ||
| 25 | my $idm = IdMapper->load($idmfile); | ||
| 26 | ### Restoring seq ids from: $idmfile | ||
| 27 | $ali->restore_ids($idm); | ||
| 28 | |||
| 29 | my $outfile = secure_outfile($infile, $ARGV_out_suffix); | ||
| 30 | $ali->store($outfile); | ||
| 31 | } | ||
| 32 | |||
| 33 | __END__ |