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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3