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

Diff of /FigKernelScripts/load_features.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20, Mon Dec 5 18:56:37 2005 UTC revision 1.21, Fri Jan 13 20:22:40 2006 UTC
# Line 22  Line 22 
22  my $fig = new FIG;  my $fig = new FIG;
23    
24  use Tracer;  use Tracer;
25    if ($ENV{'VERBOSE'}) { TSetup("3 FIG DBKernel","TEXT") }
26    
27  Trace("Preparing to load features.") if T(2);  Trace("Preparing to load features.") if T(2);
28  my ($mode, @genomes) = FIG::parse_genome_args(@ARGV);  my ($mode, @genomes) = FIG::parse_genome_args(@ARGV);
# Line 34  Line 35 
35    
36  Open(\*REL, ">$temp_dir/tmpfeat$$");  Open(\*REL, ">$temp_dir/tmpfeat$$");
37  Open(\*ALIAS, "| sort -T $temp_dir -u > $temp_dir/tmpalias$$");  Open(\*ALIAS, "| sort -T $temp_dir -u > $temp_dir/tmpalias$$");
38    Open(\*DELFIDS,"| sort -u > $temp_dir/tmpdel$$");
39    Open(\*REPFIDS,"| sort -u > $temp_dir/tmprel$$");
40    
41  if ($mode eq 'all') {  if ($mode eq 'all') {
42    
43        # Process any remaining deleted.fids or replaced.fids in Global
44        if (open(GLOBDEL,"<$FIG_Config::global/deleted.fids"))
45        {
46            while (defined($_ = <GLOBDEL>) && ($_ =~ /^fig\|(\d+\.\d+)/))
47            {
48                print DELFIDS "$1\t$_";
49            }
50        }
51        close(GLOBDEL);
52    
53        if (open(GLOBREP,"<$FIG_Config::global/replaced.fids"))
54        {
55            while (defined($_ = <GLOBREP>) && ($_ =~ /^fig\|(\d+\.\d+)/))
56            {
57                print REPFIDS "$1\t$_";
58            }
59        }
60        close(GLOBREP);
61    
62    
63    
64      # Here we extract external aliases from the peg.synonyms table, when they can be inferred      # Here we extract external aliases from the peg.synonyms table, when they can be inferred
65      # accurately.      # accurately.
66          Trace("Extracting external aliases from the peg.synonyms table.") if T(2);          Trace("Extracting external aliases from the peg.synonyms table.") if T(2);
67      open(\*SYN, "<$FIG_Config::global/peg.synonyms");      Open(\*SYN, "<$FIG_Config::global/peg.synonyms");
68      while (defined($_ = <SYN>))      while (defined($_ = <SYN>))
69      {      {
70                  chop;                  chop;
# Line 88  Line 111 
111    
112      foreach $type (@types)      foreach $type (@types)
113      {      {
114            if ((-s "$organisms_dir/$genome/Features/$type/deleted.fids") &&
115                open(TMP,"<$organisms_dir/$genome/Features/$type/deleted.fids"))
116            {
117                while (defined($_ = <TMP>) && ($_ =~ /^fig\|(\d+\.\d+)/))
118                {
119                    print DELFIDS "$1\t$_";
120                }
121                close(TMP);
122            }
123    
124            if ((-s "$organisms_dir/$genome/Features/$type/replaced.fids") &&
125                open(TMP,"<$organisms_dir/$genome/Features/$type/replaced.fids"))
126            {
127                while (defined($_ = <TMP>) && ($_ =~ /^fig\|(\d+\.\d+)/))
128                {
129                    print REPFIDS "$1\t$_";
130                }
131                close(TMP);
132            }
133    
134          if ((-s "$organisms_dir/$genome/Features/$type/tbl") &&          if ((-s "$organisms_dir/$genome/Features/$type/tbl") &&
135              open(TBL,"<$organisms_dir/$genome/Features/$type/tbl"))              open(TBL,"<$organisms_dir/$genome/Features/$type/tbl"))
136          {          {
# Line 149  Line 192 
192          }          }
193      }      }
194  }  }
195    close(REPFIDS);
196    close(DELFIDS);
197  close(REL);  close(REL);
198  close(ALIAS);  close(ALIAS);
199  Open(\*ALIASIN, "<$temp_dir/tmpalias$$");  Open(\*ALIASIN, "<$temp_dir/tmpalias$$");
# Line 187  Line 232 
232  close(ALIASOUT);  close(ALIASOUT);
233  unlink("$temp_dir/tmpalias$$");  unlink("$temp_dir/tmpalias$$");
234    
235    $fig->reload_table($mode, 'deleted_fids',"genome varchar(16), fid varchar(32)",
236                                             { deleted_fids_fid_ix => 'fid', deleted_fids_genome_ix => 'genome' },
237                                             "$temp_dir/tmpdel$$",\@genomes);
238    
239    unlink("$temp_dir/tmpdel$$");
240    
241    $fig->reload_table($mode, 'replaced_fids',"genome varchar(16), from_fid varchar(32), to_fid varchar(32)",
242                                             { replaced_fids_from_ix => 'from_fid',
243                                               replaced_fids_to_ix => 'to_fid',
244                                               replaced_fids_genome_ix => 'genome'
245                                             },
246                                             "$temp_dir/tmprep$$",\@genomes);
247    
248    unlink("$temp_dir/tmprep$$");
249    
250  $fig->reload_table($mode, 'features',  $fig->reload_table($mode, 'features',
251                                     "id varchar(32), idN INTEGER, type varchar(16),genome varchar(16),"  .                                     "id varchar(32), idN INTEGER, type varchar(16),genome varchar(16),"  .
252                                      "location TEXT,"  .                                      "location TEXT,"  .

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3