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

Diff of /FigKernelPackages/FIGV.pm

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

revision 1.8, Wed Nov 29 15:19:19 2006 UTC revision 1.9, Wed Nov 29 20:59:44 2006 UTC
# Line 103  Line 103 
103      my $ss = $fig->get_subsystem($ssa);      my $ss = $fig->get_subsystem($ssa);
104      return undef unless $ss;      return undef unless $ss;
105    
106      #      $self->load_ss_data();
     # Find the variant code and role/peg mappings for this genome.  
     #  
107    
108      open(S, "<$newGdir/Subsystems/bindings") or die "Cannot open $newGdir/Subsystems/bindings: $!";      my $bindings = $self->{_ss_bindings}->{$ssa};
109        my $variant = $self->{_ss_variants}->{$ssa};
110    
111      my %bindings;  #    warn "Adding virtual genome " . Dumper(\%bindings);
112      while (<S>)      $ss->add_virtual_genome($self->genus_species(), $newG, $variant, $bindings);
113      {  
114          chomp;      return $ss;
         my($sname, $role, $peg) = split(/\t/);  
         if ($sname eq $ssa)  
         {  
             push(@{$bindings{$role}}, $peg);  
 #           print "Pushing $role=>$peg for $ssa\n";  
         }  
         else  
         {  
 #           print "Not pushing $sname $role=>$peg for $ssa\n";  
         }  
115      }      }
     close(S);  
116    
117      open(S, "<$newGdir/Subsystems/subsystems") or die "Cannot open $newGdir/Subsystems/subsystems: $!";  sub peg_to_roles_in_subsystems
     my $variant;  
     while (<S>)  
     {  
         chomp;  
         my($sname, $v) = split(/\t/);  
         if ($sname eq $ssa)  
118          {          {
119              $variant = $v;      my($self,$peg) = @_;
             last;  
         }  
     }  
     close(S);  
120    
121  #    warn "Adding virtual genome " . Dumper(\%bindings);      my $fig     = $self->{_fig};
122      $ss->add_virtual_genome($self->genus_species(), $newG, $variant, \%bindings);      my $newG    = $self->{_genome};
123        my $newGdir = $self->{_orgdir};
124    
125      return $ss;      $self->load_ss_data();
126    
127        my $ret  = $self->{_ss_peg_index}->{$peg};
128    
129        return $ret ? @$ret : ();
130    }
131    
132    sub subsystems_for_peg
133    {
134        my($self,$peg) = @_;
135        return $self->peg_to_roles_in_subsystems($peg);
136  }  }
137    
138  sub genomes {  sub genomes {
# Line 794  Line 783 
783      $self->{_pseq} = $pseq;      $self->{_pseq} = $pseq;
784  }  }
785    
786    sub load_ss_data
787    {
788        my($self) = @_;
789    
790        return if defined($self->{_ss_bindings});
791    
792        my $fig     = $self->{_fig};
793        my $newG    = $self->{_genome};
794        my $newGdir = $self->{_orgdir};
795    
796        open(S, "<$newGdir/Subsystems/bindings") or die "Cannot open $newGdir/Subsystems/bindings: $!";
797    
798        my $peg_index;
799        my $bindings;
800        while (<S>)
801        {
802            chomp;
803            my($sname, $role, $peg) = split(/\t/);
804    
805            push(@{$bindings->{$sname}->{$role}}, $peg);
806            push(@{$peg_index->{$peg}}, [$sname, $role]);
807        }
808        close(S);
809    
810        open(S, "<$newGdir/Subsystems/subsystems") or die "Cannot open $newGdir/Subsystems/subsystems: $!";
811        my $variant;
812        while (<S>)
813        {
814            chomp;
815            my($sname, $v) = split(/\t/);
816            $variant->{$sname} = $v;
817        }
818        close(S);
819    
820        $self->{_ss_bindings} = $bindings;
821        $self->{_ss_variants} = $variant;
822        $self->{_ss_peg_index} = $peg_index;
823    }
824    
825  sub load_tbl {  sub load_tbl {
826      my($self) = @_;      my($self) = @_;
827    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3