make cleanup_merge_map.pl executable
[migration-tools.git] / cleanup_merge_map.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 cleanup_merge_map.pl
9
10 =head2 SUMMARY
11
12 Little helper script used when consoldating
13 multiple merge maps.
14
15 =cut
16
17 my %bad_subs = ();
18 my %map = ();
19 while (<>) {
20     chomp;
21     my ($lead, $sub) = split /\t/, $_, -1;
22     next if exists $bad_subs{$sub};
23     if (exists $map{$sub}) {
24         $bad_subs{$sub}++;
25         delete $map{$sub};
26         next;
27     }
28     $map{$sub} = $lead;
29 }
30 foreach my $sub (sort keys %map) {
31     print "$map{$sub}\t$sub\n";
32 }
33
34