[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.95, Fri Jan 19 17:01:06 2007 UTC revision 1.96, Fri Jan 26 21:33:03 2007 UTC
# Line 1645  Line 1645 
1645      return ref($rlist) ? @$rlist : ();      return ref($rlist) ? @$rlist : ();
1646  }  }
1647    
1648    =head3 get_abbr_for_role
1649    
1650    C<< my $abbr = $sub->get_abbr_for_role($name); >>
1651    
1652    Return the abbreviation for the given role name.
1653    
1654    =cut
1655    
1656    sub get_abbr_for_role
1657    {
1658        my($self, $name) = @_;
1659        my $idx = $self->{role_index}->{$name};
1660        if (defined($idx))
1661        {
1662            return $self->{role_abbrs}->[$idx];
1663        }
1664        else
1665        {
1666            return undef;
1667        }
1668    }
1669    
1670    
1671    =head3 get_roles_for_genome
1672    
1673    C<< my $abbr = $sub->get_roles_for_genome($genome_id); >>
1674    
1675    Return the list of roles for which the given genome has nonempty cells.
1676    
1677    =cut
1678    
1679    sub get_roles_for_genome
1680    {
1681        my($self, $genome) = @_;
1682    
1683        my $gidx = $self->{genome_index}->{$genome};
1684        return undef unless defined($gidx);
1685    
1686        my $row = $self->{spreadsheet}->[$gidx];
1687    
1688        my @out;
1689        for my $ridx (0 .. $#$row)
1690        {
1691            my $cell = $row->[$ridx];
1692            if (@$cell > 0)
1693            {
1694                push(@out, $self->{roles}->[$ridx]);
1695            }
1696        }
1697        return @out;
1698    }
1699    
1700  sub roles_with_abbreviations  sub roles_with_abbreviations
1701  {  {

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3