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

View of /FigKernelScripts/assign_synonym_ids.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Sep 27 16:02:54 2005 UTC (14 years, 8 months ago) by olson
Branch: MAIN
CVS Tags: caBIG-dataload-0, caBIG-00-00-00
Scripts for assigning xxx numbers to peg.syn and friends.

#
# Walk the peg.synonyms file assigning each entry a unique synonym id.
#
# The current principal synonym is moved to the front of the list of other synonyms.
#

use strict;

my $usage = "assign_synonym_ids peg.synonyms new.peg.synonyms id_map";

if (@ARGV != 3)
{
    die $usage;
}

my $input = shift;
my $output = shift;
my $map = shift;

open(FH, "<$input") or die "Cannot open $input: $!\n";
open(OUT, ">$output") or die "Cannot open $output for writing: $!\n";
open(MAP, ">$map") or die "Cannot open $map for writing: $!\n";

my $next_id = 1;

while (<FH>)
{
    my $syn_id = sprintf("xxx%08d", $next_id++);

    print "$.\n" if $. % 100000 == 0;

    chomp;
    my($f1, $list) = split(/\t/);

    my($pri_syn, $pri_len) = split(/,/, $f1);

    print OUT "$syn_id,$pri_len\t$f1;$list\n";
    print MAP "$pri_syn\t$syn_id\n";
}

close(OUT);
close(MAP);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3