[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.72, Mon Oct 3 20:00:13 2005 UTC revision 1.73, Wed Oct 12 02:45:35 2005 UTC
# Line 15  Line 15 
15    
16  use strict;  use strict;
17    
18  =pod  =head1 Subsystem Manipulation
   
 =head1 Subsystem manipulation.  
19    
20  Any manipulation of subsystem data should happen through this interface.  Any manipulation of subsystem data should happen through this interface.
21  This allows us to assure ourselves that the relational tables that  This allows us to assure ourselves that the relational tables that
# Line 135  Line 133 
133    
134  =back  =back
135    
136  =head2  Methods  =head2 Public Methods
   
 =over 4  
137    
138  =item index_cell  =head3 new
139    
140  Create the subsystem_index entries for the given cell.  C<< my $sub = Subsystem->new($subName, $fig, $createFlag); >>
 (NEW).  
141    
142  =item delete_role(name)  Load the subsystem. If it does not exist, and $createFlag is true, create
143    a new, empty subsystem.
 Delete the given role.  
   
 =item add_role(name, abbr)  
144    
145  Add a new role.  =over 4
146    
147  =item get_subset(name)  =item subName
148    
149  A deprecated form of get_subsetC  Name of the desired subsystem.
150    
151  =item get_subsetC(name)  =item fig
152    
153  Returns a given subset. A subset is an object, implemented as a blessed array  FIG object for accessing the SEED data store.
 of roles.  
154    
155  =item add_genome(genome_id, variant_code)  =item createFlag
156    
157  =item remove_genome(genome_id)  TRUE if an empty subsystem should be created with the given name, else FALSE. If a
158    subsystem with the name already exists, this parameter has no effect.
159    
160  =back  =back
161    
162  =cut  =cut
163    
 =pod  
   
 =head1 Subsystem constructor  
   
 usage: $sub = Subsystem->new("subsystem name", $fig, $createFlag)  
   
 Load the subsystem. If it does not exist, and $createFlag is true, create  
 a new empty subsystem.  
   
 =cut  
   
164  sub new  sub new
165  {  {
166      my($class, $name, $fig, $create) = @_;      my($class, $name, $fig, $create) = @_;
# Line 272  Line 253 
253      return $self;      return $self;
254  }  }
255    
256  =pod  =head3 create_subsystem
   
 =head2 create_subsystem()  
257    
258  Create a new subsystem. This creates the subsystem directory in the  Create a new subsystem. This creates the subsystem directory in the
259  correct place ($FIG_Config::data/Subsystems), and populates it with  correct place ($FIG_Config::data/Subsystems), and populates it with
# Line 1057  Line 1036 
1036      }      }
1037  }  }
1038    
1039  =pod  =head3 write_subsystem
   
 =head2 write_subsystem()  
1040    
1041  Write the subsystem to the disk.  Updates on-disk data with notes,  Write the subsystem to the disk.  Updates on-disk data with notes,
1042  etc. Perform backups when necessary.  etc. Perform backups when necessary.
# Line 1232  Line 1209 
1209    
1210    
1211    
1212  =pod  =head3 write_spreadsheet
1213    
1214  =head1 write_spreadsheet($fh)  C<< $sub->write_spreadsheet($fh); >>
1215    
1216  Write the spreadsheet for this subsystem to filehandle $fh.  Write the spreadsheet for this subsystem to filehandle $fh.
1217    
# Line 1347  Line 1324 
1324      }      }
1325  }  }
1326    
1327    =head3 get_genomes
1328    
1329  =pod  C<< my @genomeList = $sub->get_genomes(); >>
1330    
1331  =head1 get_genomes  Return a list of the genome IDs for this subsystem. Each genome corresponds to a row
1332    in the subsystem spreadsheet. Indexing into this list returns the ID of the genome
1333    in the specified row.
1334    
1335  =cut  =cut
1336    
# Line 1363  Line 1343 
1343      return @$glist;      return @$glist;
1344  }  }
1345    
1346  =pod  =head3 get_variant_codes
1347    
1348    C<< my @codes = $sub->get_variant_codes(); >>
1349    
1350  =head1 get_variant_codes  Return a list of the variant codes for each genome, in row index order. The variant
1351    code indicates which variation of the subsystem is used by the given genome.
1352    
1353  =cut  =cut
1354    
# Line 1378  Line 1361 
1361      return @$glist;      return @$glist;
1362  }  }
1363    
1364    =head3 get_variant_code
1365    
1366    C<< my $code = $sub->get_variant_code($gidx); >>
1367    
1368    Return the variant code for the specified genome. Each subsystem has multiple
1369    variants which involve slightly different chemical reactions, and each variant
1370    has an associated variant code. When a genome is connected to the spreadsheet,
1371    the subsystem variant used by the genome must be specified.
1372    
1373    =over 4
1374    
1375    =item gidx
1376    
1377    Row index for the genome whose variant code is desired.
1378    
1379    =item RETURN
1380    
1381    Returns the variant code for the specified genome.
1382    
1383    =back
1384    
1385    =cut
1386    
1387  sub get_variant_code  sub get_variant_code
1388  {  {
1389      my($self, $gidx) = @_;      my($self, $gidx) = @_;
# Line 1440  Line 1446 
1446      }      }
1447  }  }
1448    
1449    =head3 get_roles
1450    
1451    C<< my @roles = $sub->get_roles(); >>
1452    
1453    Return a list of the subsystem's roles. Each role corresponds to a column
1454    in the subsystem spreadsheet. The list entry at a specified position in
1455    the list will contain the ID of that column's role.
1456    
1457    =cut
1458    
1459  sub get_roles  sub get_roles
1460  {  {
1461      my($self) = @_;      my($self) = @_;
# Line 1541  Line 1557 
1557      return $cell;      return $cell;
1558  }  }
1559    
1560    =head3 get_genome_index
1561    
1562    C<< my $idx = $sub->get_genome_index($genome); >>
1563    
1564    Return the row index for the genome with the specified ID.
1565    
1566    =over 4
1567    
1568    =item genome
1569    
1570    ID of the genome whose row index is desired.
1571    
1572    =item RETURN
1573    
1574    Returns the row index for the genome with the specified ID, or an undefined
1575    value if the genome does not participate in the subsystem.
1576    
1577    =back
1578    
1579    =cut
1580    
1581  sub get_genome_index :Scalar  sub get_genome_index :Scalar
1582  {  {
1583      my($self, $genome) = @_;      my($self, $genome) = @_;
# Line 1555  Line 1592 
1592      return $self->{genome}->[$gidx];      return $self->{genome}->[$gidx];
1593  }  }
1594    
1595    =head3 get_role_index
1596    
1597    C<< my $idx = $sub->get_role_index($role); >>
1598    
1599    Return the column index for the role with the specified ID.
1600    
1601    =over 4
1602    
1603    =item role
1604    
1605    ID (full name) of the role whose column index is desired.
1606    
1607    =item RETURN
1608    
1609    Returns the column index for the role with the specified name.
1610    
1611    =back
1612    
1613    =cut
1614    
1615  sub get_role_index :Scalar  sub get_role_index :Scalar
1616  {  {
1617      my($self, $role) = @_;      my($self, $role) = @_;
# Line 1569  Line 1626 
1626      return $self->{roles}->[$ridx];      return $self->{roles}->[$ridx];
1627  }  }
1628    
1629    =head3 get_role_abbr
1630    
1631    C<< my $abbr = $sub->get_role_abbr($ridx); >>
1632    
1633    Return the abbreviation for the role in the specified column. The abbreviation
1634    is a shortened identifier that is not necessarily unique, but is more likely to
1635    fit in a column heading.
1636    
1637    =over 4
1638    
1639    =item ridx
1640    
1641    Column index for the role whose abbreviation is desired.
1642    
1643    =item RETURN
1644    
1645    Returns an abbreviated name for the role corresponding to the indexed column.
1646    
1647    =back
1648    
1649    =cut
1650    
1651  sub get_role_abbr :Scalar  sub get_role_abbr :Scalar
1652  {  {
1653      my($self, $ridx) = @_;      my($self, $ridx) = @_;
# Line 1583  Line 1662 
1662      return $self->{abbr}->{$abbr};      return $self->{abbr}->{$abbr};
1663  }  }
1664    
1665  =pod  =head3 set_pegs_in_cell
1666    
1667  =head1 set_pegs_in_cell($genome, $role, $peg_list)  C<< $sub->set_pegs_in_cell($genome, $role, $peg_list); >>
1668    
1669  Set the cell for the given genome and role to $peg_list.  Set the cell for the given genome and role to $peg_list.
1670    
# Line 1697  Line 1776 
1776      }      }
1777  }  }
1778    
1779    =head3 get_pegs_from_cell
1780    
1781    C<< my @pegs = $sub->get_pegs_from_cell($rowstr, $colstr); >>
1782    
1783    Return a list of the peg IDs for the features in the specified spreadsheet cell.
1784    
1785    =over 4
1786    
1787    =item rowstr
1788    
1789    Genome row, specified either as a row index or a genome ID.
1790    
1791    =item colstr
1792    
1793    Role column, specified either as a column index, a role name, or a role
1794    abbreviation.
1795    
1796    =item RETURN
1797    
1798    Returns a list of PEG IDs. The PEGs in the list belong to the genome in the
1799    specified row and perform the role in the specified column. If the indicated
1800    row and column does not exist, returns an empty list.
1801    
1802    =back
1803    
1804    =cut
1805    
1806  sub get_pegs_from_cell  sub get_pegs_from_cell
1807  {  {
1808      my($self, $rowstr, $colstr) = @_;      my($self, $rowstr, $colstr) = @_;
# Line 1800  Line 1906 
1906      return $self->get_subset_namesC;      return $self->get_subset_namesC;
1907  }  }
1908    
1909    =head3 get_subset_namesC
1910    
1911    C<< my @subsetNames = $sub->get_subset_namesC(); >>
1912    
1913    Return a list of the names for all the column (role) subsets. Given a subset
1914    name, you can use the L</get_subsetC_roles> method to get the roles in the
1915    subset.
1916    
1917    =cut
1918    
1919  sub get_subset_namesC  sub get_subset_namesC
1920  {  {
1921      my($self) = @_;      my($self) = @_;
# Line 1814  Line 1930 
1930      return ("All",@{$self->{row_subsets}});      return ("All",@{$self->{row_subsets}});
1931  }  }
1932    
1933    =head3 get_subsetC_roles
1934    
1935    C<< my @roles = $sub->get_subsetC_roles($subname); >>
1936    
1937    Return the names of the roles contained in the specified role (column) subset.
1938    
1939    =over 4
1940    
1941    =item subname
1942    
1943    Name of the role subset whose roles are desired.
1944    
1945    =item RETURN
1946    
1947    Returns a list of the role names for the columns in the named subset.
1948    
1949    =back
1950    
1951    =cut
1952    
1953  sub get_subsetC_roles  sub get_subsetC_roles
1954  {  {
1955      my($self, $subname) = @_;      my($self, $subname) = @_;
# Line 1866  Line 2002 
2002      }      }
2003  }  }
2004    
2005  =pod  =head3 load_row_subsets_by_kv
   
 =head2 load_row_subsets_by_kv  
2006    
2007  Load a row subset based on a key/value pair. This will take a single key/value pair and only show that subset  Load a row subset based on a key/value pair. This will take a single key/value pair and only show that subset
2008    
# Line 1895  Line 2029 
2029   $self->{row_subset_members}->{$key}=$keep;   $self->{row_subset_members}->{$key}=$keep;
2030  }  }
2031    
2032  =pod  =head3 set_subsetC
2033    
2034  =head2 set_subsetC($name, $members)  C<< $sub->set_subsetC($name, $members); >>
2035    
2036  Create a subset with the given name and members.  Create a subset with the given name and members.
2037    
# Line 1921  Line 2055 
2055      $self->set_subsetsC($subname,$list);      $self->set_subsetsC($subname,$list);
2056  }  }
2057    
2058  =pod  =head3 _set_subset
   
 =head2 _set_subset($name, $members)  
2059    
2060  Create a subset with the given name and members.  Create a subset with the given name and members.
2061    
# Line 1963  Line 2095 
2095  #  #
2096    
2097    
2098  =pod  =head3 set_roles
2099    
2100  =head1 set_roles($role_list)  C<< $sub->set_roles($role_list); >>
2101    
2102  Set the list of roles. C<$role_list> is a list of tuples C<[$role_name, $abbreviation]>.  Set the list of roles. C<$role_list> is a list of tuples C<[$role_name, $abbreviation]>.
2103    
# Line 2131  Line 2263 
2263    
2264  }  }
2265    
2266  =pod  =head3 add_role($role, $abbr)
   
 =head1 C<add_role($role, $abbr)>  
2267    
2268  Add the given role to the spreadsheet.  Add the given role to the spreadsheet.
2269    
# Line 2189  Line 2319 
2319      return $idx;      return $idx;
2320  }  }
2321    
2322  =pod  =head3 remove_role
   
 =head1 remove_role($role)  
2323    
2324  Remove the role from the spreadsheet.  Remove the role from the spreadsheet.
2325    
# Line 2290  Line 2418 
2418      }      }
2419  }  }
2420    
2421  =pod  =head3 add_genome($genome, $abbr)
   
 =head1 C<add_genome($genome, $abbr)>  
2422    
2423  Add the given genome to the spreadsheet.  Add the given genome to the spreadsheet.
2424    
# Line 2348  Line 2474 
2474      return $idx;      return $idx;
2475  }  }
2476    
2477  =pod  =head3 remove_genome
   
 =head1 remove_genome($genome)  
2478    
2479  Remove the genome from the spreadsheet.  Remove the genome from the spreadsheet.
2480    
# Line 2454  Line 2578 
2578      return $self->{version};      return $self->{version};
2579  }  }
2580    
2581    =head3 get_notes
2582    
2583    C<< my $text = $sub->get_notes(); >>
2584    
2585    Return the descriptive notes for this subsystem.
2586    
2587    =cut
2588    
2589  sub get_notes :Scalar  sub get_notes :Scalar
2590  {  {
2591      my($self) = @_;      my($self) = @_;
# Line 2461  Line 2593 
2593      return $self->{notes};      return $self->{notes};
2594  }  }
2595    
2596    =head3 get_reactions
2597    
2598    C<< my $reactHash = $sub->get_reactions(); >>
2599    
2600    Return a reference to a hash that maps each role ID to a list of the reactions
2601    catalyzed by the role.
2602    
2603    =cut
2604    
2605  sub get_reactions  sub get_reactions
2606  {  {
2607      my($self) = @_;      my($self) = @_;
# Line 2497  Line 2638 
2638  }  }
2639    
2640    
2641    =head3 get_curator
2642    
2643    C<< my $userName = $sub->get_curator(); >>
2644    
2645    Return the name of this subsystem's official curator.
2646    
2647    =cut
2648    
2649  sub get_curator :Scalar  sub get_curator :Scalar
2650  {  {
# Line 2508  Line 2656 
2656  # Subsystem copying logic  # Subsystem copying logic
2657  #  #
2658    
2659  =pod  =head3 add_to_subsystem($subsystem_name, $columns, $notes_flag)
   
 =head2 add_to_subsystem($subsystem_name, $columns, $notes_flag)  
2660    
2661  Merge the given columns from $subsystem_name into this subsystem. Append the  Merge the given columns from $subsystem_name into this subsystem. Append the
2662  notes from the subsystem if $notes_flag is true.  notes from the subsystem if $notes_flag is true.
# Line 3170  Line 3316 
3316    
3317  1;  1;
3318    
3319    =head2 Method Listing
3320    
3321    =over 4
3322    
3323    =item index_cell
3324    
3325    Create the subsystem_index entries for the given cell.
3326    (NEW).
3327    
3328    =item delete_role(name)
3329    
3330    Delete the given role.
3331    
3332    =item add_role(name, abbr)
3333    
3334    Add a new role.
3335    
3336    =item get_subset(name)
3337    
3338    A deprecated form of get_subsetC
3339    
3340    =item get_subsetC(name)
3341    
3342    Returns a given subset. A subset is an object, implemented as a blessed array
3343    of roles.
3344    
3345    =item add_genome(genome_id, variant_code)
3346    
3347    =item remove_genome(genome_id)
3348    
3349    =back
3350    
3351    =cut
3352    

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3