[Bio] / FigKernelScripts / merge_translation_rules.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/merge_translation_rules.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : efrank 1.1
2 :     $usage = "usage: merge_translation_rules Existing Proposed > Good 2> conflicts";
3 :    
4 :     (($existing = shift @ARGV) &&
5 :     ($proposed = shift @ARGV)
6 :     )
7 :     || die $usage;
8 :    
9 :     $trans = {};
10 :    
11 :     &load($existing,$trans);
12 :     &load($proposed,$trans);
13 :    
14 :     foreach $from (sort keys(%$trans))
15 :     {
16 :     print "$from\t$trans->{$from}\n";
17 :     }
18 :    
19 :     sub load {
20 :     my($file) = @_;
21 :    
22 :     open(TMP,"<$file") || die "could not open $file";
23 :     while (defined($_ = <TMP>))
24 :     {
25 :     chop;
26 :     ($from,$to) = split(/\t/,$_);
27 :     if ($trans->{$from} && ($trans->{$from} eq $to))
28 :     {
29 :     # print STDERR "exists: $from => $to\n\n";
30 :     }
31 :     elsif ($trans->{$from} && ($trans->{$from} ne $to))
32 :     {
33 :     print STDERR "conflict: $from => $to\n\t$trans->{$from}\n\n";
34 :     }
35 :     elsif ($trans->{$to} && ($new = $trans->{$to}))
36 :     {
37 :     print STDERR "BAD TO: $from => $to\n$new\n\n";
38 :     }
39 :     else
40 :     {
41 :     $trans->{$from} = $to;
42 :     }
43 :     }
44 :     }
45 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3