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

Annotation of /FigKernelScripts/assign_synonym_ids.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.1 #
2 :     # Walk the peg.synonyms file assigning each entry a unique synonym id.
3 :     #
4 :     # The current principal synonym is moved to the front of the list of other synonyms.
5 :     #
6 :    
7 :     use strict;
8 :    
9 :     my $usage = "assign_synonym_ids peg.synonyms new.peg.synonyms id_map";
10 :    
11 :     if (@ARGV != 3)
12 :     {
13 :     die $usage;
14 :     }
15 :    
16 :     my $input = shift;
17 :     my $output = shift;
18 :     my $map = shift;
19 :    
20 :     open(FH, "<$input") or die "Cannot open $input: $!\n";
21 :     open(OUT, ">$output") or die "Cannot open $output for writing: $!\n";
22 :     open(MAP, ">$map") or die "Cannot open $map for writing: $!\n";
23 :    
24 :     my $next_id = 1;
25 :    
26 :     while (<FH>)
27 :     {
28 :     my $syn_id = sprintf("xxx%08d", $next_id++);
29 :    
30 :     print "$.\n" if $. % 100000 == 0;
31 :    
32 :     chomp;
33 :     my($f1, $list) = split(/\t/);
34 :    
35 :     my($pri_syn, $pri_len) = split(/,/, $f1);
36 :    
37 :     print OUT "$syn_id,$pri_len\t$f1;$list\n";
38 :     print MAP "$pri_syn\t$syn_id\n";
39 :     }
40 :    
41 :     close(OUT);
42 :     close(MAP);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3