script/change-ids-ali.pl untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 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: change-ids-ali.pl
3 # ABSTRACT: Abbreviate or restore the org component of 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 ### Mapping organisms from: $ARGV_org_mapper
18 my $org_mapper = IdMapper->load($ARGV_org_mapper);
19  
20 for my $infile (@ARGV_infiles) {
21  
22 ### Processing: $infile
23 my $ali = Ali->load($infile);
24 $ali->dont_guess if $ARGV_noguessing;
25  
26 # build id_mapper and change ids
27 my $id_mapper;
28  
29 if ($ARGV_mode eq 'long2abbr') {
30 $id_mapper = $ali->org_mapper_from_long_ids($org_mapper);
31 $ali->shorten_ids($id_mapper);
32 }
33 else { # 'abbr2long'
34 $id_mapper = $ali->org_mapper_from_abbr_ids($org_mapper);
35 $ali->restore_ids($id_mapper);
36 }
37  
38 my $outfile = secure_outfile($infile, $ARGV_out_suffix);
39 $ali->store($outfile);
40  
41 # optionally store the id mapper
42 if ($ARGV_store_id_mapper) {
43 my $idmfile = change_suffix($outfile, '.idm');
44 $id_mapper->store($idmfile);
45 }
46 }
47  
48 __END__