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

Diff of /FigKernelPackages/PinnedRegions.pm

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

revision 1.13, Sat Oct 18 09:56:23 2008 UTC revision 1.14, Wed Oct 22 18:18:31 2008 UTC
# Line 525  Line 525 
525    
526                  # Add FigFam information to hash -- to go into the popup text                  # Add FigFam information to hash -- to go into the popup text
527                  $feature_data->{$fid}{'figfam'} = $figfam_text{$figfam_id};                  $feature_data->{$fid}{'figfam'} = $figfam_text{$figfam_id};
 #->{$fid} . ": " . $family_function->{$figfam->{$fid}};  
528              }              }
529          }          }
530      }      }
# Line 533  Line 532 
532    
533  sub add_subsystem_data {  sub add_subsystem_data {
534      my($fig, $pin_desc, $feature_data) = @_;      my($fig, $pin_desc, $feature_data) = @_;
535      # Get all the pegs.  
536      my @pegs = grep {$feature_data->{$_}{'type'} eq 'peg'} keys %$feature_data;      # Get subsystem_information for =all= pegs
537      # Get their subsystem_information.  
538      my %peg_to_ss = $fig->subsystems_for_pegs(\@pegs);      my %peg_to_ss;
539        foreach my $fid ( keys %$feature_data )
540        {
541            if ( $feature_data->{$fid}{'type'} eq 'peg' )
542            {
543                my @subsystems = grep { $fig->usable_subsystem($_->[0],1) } $fig->subsystems_for_peg_complete($fid, 1);
544    
545                foreach my $rec ( @subsystems )
546                {
547                    my($ss_name, $role, $variant, $is_auxiliary) = @$rec;
548                    $ss_name =~ s/_/ /g;
549    
550                    if ( $variant eq '0' )
551                    {
552                        # no subsystem
553                    }
554                    elsif ( $variant eq '-1' or $variant eq '*-1' )
555                    {
556                        # subsystem not functional in this organism
557                        my $ss_text = "$ss_name (classified 'not active' in this organism)";
558                        $peg_to_ss{$fid}{$ss_text} = 1;
559                    }
560                    else
561                    {
562                        $peg_to_ss{$fid}{$ss_name} = 1;
563                    }
564                }
565            }
566        }
567    
568      # Count number of occurences of each subsystem      # Count number of occurences of each subsystem
569      my %ss_count;      my %ss_count;
570      foreach my $ss ( map {$_->[0]} map {@$_} values %peg_to_ss )      foreach my $fid ( keys %peg_to_ss )
571        {
572            foreach my $ss ( keys %{ $peg_to_ss{$fid} } )
573      {      {
574          $ss_count{$ss}++;          $ss_count{$ss}++;
575      }      }
576        }
577    
578      # Sort subsystems based on count and create hash with unique index for each subsystem where      # Sort subsystems based on count and create hash with unique index for each subsystem where
579      # lower indices correspond to higher number of occurences of the subsystem.      # lower indices correspond to higher number of occurences of the subsystem.
# Line 557  Line 587 
587      # Add subsystem information for pegs in subsystems      # Add subsystem information for pegs in subsystems
588      foreach my $fid ( keys %peg_to_ss )      foreach my $fid ( keys %peg_to_ss )
589      {      {
590          my @subsystems = ();          my @subsystems = keys %{ $peg_to_ss{$fid} };
         foreach my $rec ( @{ $peg_to_ss{$fid} } )  
         {  
             if ( @$rec )  
             {  
                 push @subsystems, $rec->[0];  
             }  
         }  
591    
592          if ( @subsystems )          if ( @subsystems )
593          {          {
594              $feature_data->{$fid}{'subsystems'} = [sort {$a->[1] <=> $b->[1]} map {$_->[0] =~ s/_/ /g; $_} map {[$_, $ss_index{$_}]} @subsystems];              $feature_data->{$fid}{'subsystems'} = [sort {$a->[1] <=> $b->[1]} map {[$_, $ss_index{$_}]} @subsystems];
595          }          }
596      }      }
597  }  }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3