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

Diff of /FigKernelScripts/load_external_orgs.pl

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

revision 1.1, Mon Dec 1 20:46:40 2003 UTC revision 1.2, Thu Jun 9 05:51:06 2005 UTC
# Line 3  Line 3 
3  ###########################################  ###########################################
4  use strict;  use strict;
5  use FIG;  use FIG;
6  use DBrtns;  use Tracer;
7    
8  my $fig = new FIG;  my $fig = new FIG;
 my $dbf = $fig->{_dbf};  
9    
10  my($temp_dir,$prot,$org);  my($temp_dir,$prot,$org);
11    
12  # usage: load_extaernal_orgs  # usage: load_extaernal_orgs
13    
 $dbf->drop_table( tbl => "external_orgs" );  
 $dbf->create_table( tbl  => "external_orgs",  
                     flds => "prot varchar(32),"  .  
                             "org varchar(64)"  
                   );  
14    
15  $temp_dir = $FIG_Config::temp;  $temp_dir = $FIG_Config::temp;
16  open(TAB,">$temp_dir/tmp$$") || die "could not open $temp_dir/tmp$$";  my $orgFile = "$temp_dir/tmp$$";
17  open(SPORG,"<$FIG_Config::global/ext_org.table") || die "could not open ext_org.table";  Open(\*TAB, ">$orgFile");
18  while (defined($_ = <SPORG>))  Open(\*SPORG, "<$FIG_Config::global/ext_org.table");
19  {  Trace("Copying external organism file.") if T(2);
20    while (defined($_ = <SPORG>)) {
21      chop;      chop;
22      ($prot,$org) = split(/\t/,$_);      ($prot,$org) = split(/\t/,$_);
23      if (defined($prot) && defined($org) && (length($org) < 64))      if (defined($prot) && defined($org) && (length($org) < 64)) {
     {  
24          print TAB "$prot\t$org\n";          print TAB "$prot\t$org\n";
25      }      }
26  }  }
27  close(TAB);  close(TAB);
28  close(SPORG);  close(SPORG);
29    
30  $dbf->load_table( tbl => "external_orgs",  $fig->reload_table('all', "external_orgs",
31                    file => "$temp_dir/tmp$$" );                                     "prot varchar(32), org varchar(64)",
32  $dbf->create_index( idx  => "external_orgs_ix",                                     { external_orgs_ix => "prot" },
33                      tbl  => "external_orgs",                                     $orgFile);
34                      type => "btree",  unlink($orgFile);
35                      flds => "prot" );  Trace("External organisms loaded.") if T(2);
 $dbf->vacuum_it("external_orgs");  
 unlink("$temp_dir/tmp$$");  

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3