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

View of /FigKernelScripts/load_peg_mapping.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Thu Jun 9 05:51:06 2005 UTC (14 years, 9 months ago) by parrello
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Changes since 1.4: +13 -28 lines
*** empty log message ***

# -*- perl -*-

###########################################
use strict;
use FIG;
use DBrtns;
use Tracer;

my $fig = new FIG;

my $temp_dir = "$FIG_Config::temp";
my($organisms_dir) = "$FIG_Config::organisms";

my($peg,$syns,$peg_id,$peg_ln,@syns,$syn_id,$syn_ln,$syn,$line);

# usage: load_peg_mapping
Trace("Parsing peg synonyms.") if T(2);
Open(\*REL, "| sort -T $temp_dir >$temp_dir/tmpfeat$$");
Open(\*SYN, "<$FIG_Config::global/peg.synonyms");
while (defined($line = <SYN>))
{
    chomp $line;
    ($peg,$syns) = split(/\t/,$line);
    ($peg_id,$peg_ln) = split(/,/,$peg);
    @syns = map { [split(/,/,$_)] } split(/;/,$syns);
    foreach $syn (@syns)
    {
        ($syn_id,$syn_ln) = @$syn;
        if ((! $peg_id) || ($peg_ln !~ /^[123456789]\d*/) || (! $syn_id) || ($syn_ln !~ /^[123456789]\d*/))
        {
            Trace("Invalid line in peg.synonyms: $line") if T(0);
        }
        else
        {
            my $record = join("\t",($peg_id,$peg_ln,$syn_id,$syn_ln));
            print REL "$record\n";
        }
    }
}
close(REL);

$fig->reload_table('all', 'peg_synonyms',
					"maps_to varchar(32), maps_to_ln INTEGER, syn_id varchar(32), syn_ln INTEGER",
					{ peg_ids_ix => "syn_id", peg_maps_to_ix => "maps_to" },
					"$temp_dir/tmpfeat$$" );
unlink("$temp_dir/tmpfeat$$");
Trace("Peg mappings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3