[Bio] / FigKernelPackages / Subsystem.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Subsystem.pm

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

revision 1.125, Fri Mar 28 16:38:25 2008 UTC revision 1.126, Mon Apr 28 16:32:27 2008 UTC
# Line 311  Line 311 
311      $self->{spreadsheet} = [];      $self->{spreadsheet} = [];
312      $self->{spreadsheet_inv} = [];      $self->{spreadsheet_inv} = [];
313    
314        # added by DB for empty cell annotation
315        $self->{emptycells} = [];
316    
317      $self->{col_subsets} = [];      $self->{col_subsets} = [];
318      $self->{col_subset_members} = {};      $self->{col_subset_members} = {};
319    
# Line 1002  Line 1005 
1005      $self->load_row_subsets();      $self->load_row_subsets();
1006      $self->load_genomes($ssa);      $self->load_genomes($ssa);
1007    
1008        # now load the empty cell information
1009        $self->load_emptycells();
1010    
1011      #      #
1012      # Now load the rest of the info.      # Now load the rest of the info.
1013      #      #
# Line 1021  Line 1027 
1027      return 1;      return 1;
1028  }  }
1029    
1030    sub load_emptycells
1031    {
1032        my($self) = @_;
1033    
1034        my $absencehash = {};
1035        if  (open(ECS,"<$self->{dir}/emptycells"))
1036        {
1037            while (defined($_ = <ECS>))
1038            {
1039              my ( $genome, $frabbr, $value ) = split( '\t', $_ );
1040              $absencehash->{ $genome }->{ $frabbr } = $value;
1041            }
1042            close(ECS);
1043        }
1044        $self->{emptycells} = $absencehash;
1045    }
1046    
1047    
1048  sub load_notes  sub load_notes
1049  {  {
1050      my($self) = @_;      my($self) = @_;
# Line 1560  Line 1584 
1584      my $hope_reaction_links_bak = "$dir/hope_reaction_links~";      my $hope_reaction_links_bak = "$dir/hope_reaction_links~";
1585      my $hope_curation_notes_file = "$dir/hope_curation_notes";      my $hope_curation_notes_file = "$dir/hope_curation_notes";
1586      my $hope_curation_notes_bak = "$dir/hope_curation_notes~";      my $hope_curation_notes_bak = "$dir/hope_curation_notes~";
1587        my $emptycells_file = "$dir/emptycells";
1588        my $emptycells_bak = "$dir/emptycells~";
1589      my $classification_file = "$dir/CLASSIFICATION";      my $classification_file = "$dir/CLASSIFICATION";
1590    
1591      if (-f $ss_file)      if (-f $ss_file)
# Line 1607  Line 1633 
1633  #       print STDERR "wrote $hope_curation_notes_bak\n";  #       print STDERR "wrote $hope_curation_notes_bak\n";
1634      }      }
1635    
1636        if (-f $emptycells_file)
1637        {
1638            rename($emptycells_file, $emptycells_bak) or warn "rename $emptycells_file $emptycells_bak failed $!";
1639    #       print STDERR "wrote $hope_curation_notes_bak\n";
1640        }
1641    
1642      #      #
1643      # Eval this whole chunk, so that if we get any fatal errors, we can      # Eval this whole chunk, so that if we get any fatal errors, we can
1644      # roll back to the old saved data.      # roll back to the old saved data.
# Line 1720  Line 1752 
1752          close($fh);          close($fh);
1753          chmod(0777,$hope_curation_notes_file);          chmod(0777,$hope_curation_notes_file);
1754    
1755            open($fh, ">$emptycells_file") or die "Cannot open $emptycells_file for writing: $!\n";
1756            my $gahash = $self->{emptycells};
1757            foreach my $k1 ( keys %$gahash ) {
1758              foreach my $k2 ( keys %{ $gahash->{ $k1 } } ) {
1759                print $fh $k1."\t".$k2."\t".$gahash->{ $k1 }->{ $k2 }."\n";
1760              }
1761            }
1762            close($fh);
1763            chmod(0777,$emptycells_file);
1764    
1765          open($fh, ">$classification_file") or die "Can not open $classification_file for writing: $!\n";          open($fh, ">$classification_file") or die "Can not open $classification_file for writing: $!\n";
1766          print $fh join "\t", (@{$self->{classification}}), "\n";          print $fh join "\t", (@{$self->{classification}}), "\n";
1767          close($fh);          close($fh);
# Line 1801  Line 1843 
1843      my $hope_reaction_links_bak = "$dir/hope_reaction_links~";      my $hope_reaction_links_bak = "$dir/hope_reaction_links~";
1844      my $hope_curation_notes_file = "$dir/hope_curation_notes";      my $hope_curation_notes_file = "$dir/hope_curation_notes";
1845      my $hope_curation_notes_bak = "$dir/hope_curation_notes~";      my $hope_curation_notes_bak = "$dir/hope_curation_notes~";
1846        my $emptycells_file = "$dir/emptycells";
1847        my $emptycells_bak = "$dir/emptycells~";
1848      my $hope_kegg_info_file = "$dir/hope_kegg_info";      my $hope_kegg_info_file = "$dir/hope_kegg_info";
1849      my $hope_kegg_info_bak = "$dir/hope_kegg_info~";      my $hope_kegg_info_bak = "$dir/hope_kegg_info~";
1850    
# Line 1812  Line 1856 
1856      my $hope_reaction_notes_diff = (system("cmp",  "-s",  $hope_reaction_notes_file, $hope_reaction_notes_bak) != 0);      my $hope_reaction_notes_diff = (system("cmp",  "-s",  $hope_reaction_notes_file, $hope_reaction_notes_bak) != 0);
1857      my $hope_reaction_links_diff = (system("cmp",  "-s",  $hope_reaction_links_file, $hope_reaction_links_bak) != 0);      my $hope_reaction_links_diff = (system("cmp",  "-s",  $hope_reaction_links_file, $hope_reaction_links_bak) != 0);
1858      my $hope_curation_notes_diff = (system("cmp",  "-s",  $hope_curation_notes_file, $hope_curation_notes_bak) != 0);      my $hope_curation_notes_diff = (system("cmp",  "-s",  $hope_curation_notes_file, $hope_curation_notes_bak) != 0);
1859        my $emptycells_diff = (system("cmp",  "-s",  $emptycells_file, $emptycells_bak) != 0);
1860      my $hope_kegg_info_diff = (system("cmp",  "-s",  $hope_kegg_info_file, $hope_kegg_info_bak) != 0);      my $hope_kegg_info_diff = (system("cmp",  "-s",  $hope_kegg_info_file, $hope_kegg_info_bak) != 0);
1861    
1862      if ($force_backup or ($ss_diff > 10) or ($notes_diff > 10) or $reactions_diff or $hope_reactions_diff or $hope_reaction_notes_diff or $hope_reaction_links_diff or $hope_curation_notes_diff or $hope_kegg_info_diff)      if ($force_backup or ($ss_diff > 10) or ($notes_diff > 10) or $reactions_diff or $hope_reactions_diff or $hope_reaction_notes_diff or $hope_reaction_links_diff or $hope_curation_notes_diff or $hope_kegg_info_diff)
# Line 1838  Line 1883 
1883      rename("$dir/hope_reaction_notes~", "$bak/hope_reaction_notes.$ts");      rename("$dir/hope_reaction_notes~", "$bak/hope_reaction_notes.$ts");
1884      rename("$dir/hope_reaction_links~", "$bak/hope_reaction_links.$ts");      rename("$dir/hope_reaction_links~", "$bak/hope_reaction_links.$ts");
1885      rename("$dir/hope_curation_notes~", "$bak/hope_curation_notes.$ts");      rename("$dir/hope_curation_notes~", "$bak/hope_curation_notes.$ts");
1886        rename("$dir/emptycells~", "$bak/emptycells.$ts");
1887      rename("$dir/hope_kegg_info~", "$bak/hope_kegg_info.$ts");      rename("$dir/hope_kegg_info~", "$bak/hope_kegg_info.$ts");
1888      $self->{version}++;      $self->{version}++;
1889  }  }
# Line 1911  Line 1957 
1957    
1958      for my $sub ($self->get_subset_namesC())      for my $sub ($self->get_subset_namesC())
1959      {      {
1960          print STDERR $sub." SUB\n";
1961          next if ($sub eq "All");          next if ($sub eq "All");
1962          my @members= $self->get_subsetC($sub);          my @members= $self->get_subsetC($sub);
1963    
# Line 1919  Line 1966 
1966          #          #
1967    
1968          @members = map { $_ + 1 } @members;          @members = map { $_ + 1 } @members;
1969            print STDERR join("\t", $sub, @members)."SUBSET\n";
1970          print $fh join("\t", $sub, @members), "\n";          print $fh join("\t", $sub, @members), "\n";
1971      }      }
1972      my $active_row_subset = $self->{row_active_subset};      my $active_row_subset = $self->{row_active_subset};
1973      my $active_col_subset = $self->{col_active_subset};      my $active_col_subset = $self->{col_active_subset};
1974    print STDERR $active_col_subset."ACS\n";
1975      print $fh "$active_col_subset\n";      print $fh "$active_col_subset\n";
1976    
1977      #      #
# Line 3638  Line 3686 
3686      return %{$self->{hope_reactions}};      return %{$self->{hope_reactions}};
3687  }  }
3688    
3689    sub get_emptycells
3690    {
3691        my($self) = @_;
3692    
3693        return $self->{emptycells};
3694    }
3695    
3696  sub set_hope_reaction {  sub set_hope_reaction {
3697      my($self,$role,$rids) = @_;      my($self,$role,$rids) = @_;
3698      $rids =~ s/,\s+/,/g;      $rids =~ s/,\s+/,/g;
# Line 3685  Line 3740 
3740      $self->{hope_curation_notes} = $hope_curation_notes;      $self->{hope_curation_notes} = $hope_curation_notes;
3741  }  }
3742    
3743    sub set_emptycells
3744    {
3745        my($self, $emptycells) = @_;
3746    
3747        $self->{emptycells} = $emptycells;
3748    }
3749    
3750  sub set_notes  sub set_notes
3751  {  {
3752      my($self, $notes) = @_;      my($self, $notes) = @_;

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3