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

Annotation of /FigKernelScripts/load_peg_mapping.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : efrank 1.1 # -*- perl -*-
2 :    
3 :     ###########################################
4 :     use strict;
5 :     use FIG;
6 :     use DBrtns;
7 : parrello 1.5 use Tracer;
8 : efrank 1.1
9 :     my $fig = new FIG;
10 :    
11 :     my $temp_dir = "$FIG_Config::temp";
12 : parrello 1.5 my($organisms_dir) = "$FIG_Config::organisms";
13 : efrank 1.1
14 : overbeek 1.4 my($peg,$syns,$peg_id,$peg_ln,@syns,$syn_id,$syn_ln,$syn,$line);
15 : efrank 1.1
16 :     # usage: load_peg_mapping
17 : parrello 1.5 Trace("Parsing peg synonyms.") if T(2);
18 :     Open(\*REL, "| sort -T $temp_dir >$temp_dir/tmpfeat$$");
19 :     Open(\*SYN, "<$FIG_Config::global/peg.synonyms");
20 : overbeek 1.4 while (defined($line = <SYN>))
21 : efrank 1.1 {
22 : overbeek 1.4 chomp $line;
23 :     ($peg,$syns) = split(/\t/,$line);
24 : efrank 1.1 ($peg_id,$peg_ln) = split(/,/,$peg);
25 :     @syns = map { [split(/,/,$_)] } split(/;/,$syns);
26 :     foreach $syn (@syns)
27 :     {
28 : overbeek 1.4 ($syn_id,$syn_ln) = @$syn;
29 :     if ((! $peg_id) || ($peg_ln !~ /^[123456789]\d*/) || (! $syn_id) || ($syn_ln !~ /^[123456789]\d*/))
30 :     {
31 : parrello 1.5 Trace("Invalid line in peg.synonyms: $line") if T(0);
32 : overbeek 1.4 }
33 :     else
34 :     {
35 : parrello 1.5 my $record = join("\t",($peg_id,$peg_ln,$syn_id,$syn_ln));
36 :     print REL "$record\n";
37 : overbeek 1.4 }
38 : efrank 1.1 }
39 :     }
40 :     close(REL);
41 :    
42 : parrello 1.5 $fig->reload_table('all', 'peg_synonyms',
43 :     "maps_to varchar(32), maps_to_ln INTEGER, syn_id varchar(32), syn_ln INTEGER",
44 :     { peg_ids_ix => "syn_id", peg_maps_to_ix => "maps_to" },
45 :     "$temp_dir/tmpfeat$$" );
46 : efrank 1.1 unlink("$temp_dir/tmpfeat$$");
47 : parrello 1.5 Trace("Peg mappings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3