Bio-MUST-Core
view release on metacpan or search on metacpan
bin/change-ids-ali.pl view on Meta::CPAN
#!/usr/bin/env perl
# PODNAME: change-ids-ali.pl
# ABSTRACT: Abbreviate or restore the org component of full seq ids in ALI files
use Modern::Perl '2011';
use autodie;
use Getopt::Euclid qw(:vars);
use Smart::Comments;
use Bio::MUST::Core;
use Bio::MUST::Core::Utils qw(change_suffix secure_outfile);
use aliased 'Bio::MUST::Core::Ali';
use aliased 'Bio::MUST::Core::IdMapper';
### Mapping organisms from: $ARGV_org_mapper
my $org_mapper = IdMapper->load($ARGV_org_mapper);
for my $infile (@ARGV_infiles) {
### Processing: $infile
my $ali = Ali->load($infile);
$ali->dont_guess if $ARGV_noguessing;
# build id_mapper and change ids
my $id_mapper;
if ($ARGV_mode eq 'long2abbr') {
$id_mapper = $ali->org_mapper_from_long_ids($org_mapper);
$ali->shorten_ids($id_mapper);
}
else { # 'abbr2long'
$id_mapper = $ali->org_mapper_from_abbr_ids($org_mapper);
$ali->restore_ids($id_mapper);
}
my $outfile = secure_outfile($infile, $ARGV_out_suffix);
$ali->store($outfile);
# optionally store the id mapper
if ($ARGV_store_id_mapper) {
my $idmfile = change_suffix($outfile, '.idm');
$id_mapper->store($idmfile);
}
}
__END__
=pod
=head1 NAME
change-ids-ali.pl - Abbreviate or restore the org component of full seq ids in ALI files
=head1 VERSION
version 0.252040
=head1 USAGE
change-ids-ali.pl <infiles> --org-mapper=<file> --mode=<dir>
[optional arguments]
=head1 REQUIRED ARGUMENTS
( run in 0.790 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )