[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.7 - (view) (download) (as text)

1 : efrank 1.1 # -*- perl -*-
2 : olson 1.7 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : efrank 1.1
20 :     ###########################################
21 :     use strict;
22 :     use FIG;
23 :     use DBrtns;
24 : parrello 1.5 use Tracer;
25 : efrank 1.1
26 :     my $fig = new FIG;
27 :    
28 :     my $temp_dir = "$FIG_Config::temp";
29 : parrello 1.5 my($organisms_dir) = "$FIG_Config::organisms";
30 : efrank 1.1
31 : golsen 1.6 my( $peg, $syns, $peg_id, $peg_ln, @syns, $syn_id, $syn_ln, $syn, $line );
32 : efrank 1.1
33 :     # usage: load_peg_mapping
34 : golsen 1.6
35 : parrello 1.5 Trace("Parsing peg synonyms.") if T(2);
36 :     Open(\*REL, "| sort -T $temp_dir >$temp_dir/tmpfeat$$");
37 :     Open(\*SYN, "<$FIG_Config::global/peg.synonyms");
38 : overbeek 1.4 while (defined($line = <SYN>))
39 : efrank 1.1 {
40 : overbeek 1.4 chomp $line;
41 :     ($peg,$syns) = split(/\t/,$line);
42 : efrank 1.1 ($peg_id,$peg_ln) = split(/,/,$peg);
43 : golsen 1.6 @syns = map { [ split(/,/,$_) ] } split( /;/, $syns );
44 : efrank 1.1 foreach $syn (@syns)
45 :     {
46 : overbeek 1.4 ($syn_id,$syn_ln) = @$syn;
47 :     if ((! $peg_id) || ($peg_ln !~ /^[123456789]\d*/) || (! $syn_id) || ($syn_ln !~ /^[123456789]\d*/))
48 :     {
49 : parrello 1.5 Trace("Invalid line in peg.synonyms: $line") if T(0);
50 : overbeek 1.4 }
51 :     else
52 :     {
53 : golsen 1.6 my $record = join("\t", ($peg_id,$peg_ln,$syn_id,$syn_ln));
54 : parrello 1.5 print REL "$record\n";
55 : overbeek 1.4 }
56 : efrank 1.1 }
57 :     }
58 :     close(REL);
59 :    
60 : parrello 1.5 $fig->reload_table('all', 'peg_synonyms',
61 :     "maps_to varchar(32), maps_to_ln INTEGER, syn_id varchar(32), syn_ln INTEGER",
62 :     { peg_ids_ix => "syn_id", peg_maps_to_ix => "maps_to" },
63 :     "$temp_dir/tmpfeat$$" );
64 : efrank 1.1 unlink("$temp_dir/tmpfeat$$");
65 : golsen 1.6 Trace("Peg mappings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3