[Bio] / Sprout / Sprout.pm Repository:
ViewVC logotype

Diff of /Sprout/Sprout.pm

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

revision 1.101, Mon Aug 20 23:29:24 2007 UTC revision 1.102, Thu Dec 6 14:56:23 2007 UTC
# Line 1  Line 1 
1  package Sprout;  package Sprout;
2    
     require Exporter;  
     use ERDB;  
     @ISA = qw(Exporter ERDB);  
3      use Data::Dumper;      use Data::Dumper;
4      use strict;      use strict;
5      use DBKernel;      use DBKernel;
# Line 17  Line 14 
14      use BasicLocation;      use BasicLocation;
15      use CustomAttributes;      use CustomAttributes;
16      use RemoteCustomAttributes;      use RemoteCustomAttributes;
17        use base qw(ERDB);
18    
19  =head1 Sprout Database Manipulation Object  =head1 Sprout Database Manipulation Object
20    
# Line 29  Line 27 
27  on the constructor. For example, the following invocation specifies a PostgreSQL database named I<GenDB>  on the constructor. For example, the following invocation specifies a PostgreSQL database named I<GenDB>
28  whose definition and data files are in a co-directory named F<Data>.  whose definition and data files are in a co-directory named F<Data>.
29    
30  C<< my $sprout = Sprout->new('GenDB', { dbType => 'pg', dataDir => '../Data', xmlFileName => '../Data/SproutDBD.xml' }); >>      my $sprout = Sprout->new('GenDB', { dbType => 'pg', dataDir => '../Data', xmlFileName => '../Data/SproutDBD.xml' });
31    
32  Once you have a sprout object, you may use it to re-create the database, load the tables from  Once you have a sprout object, you may use it to re-create the database, load the tables from
33  tab-delimited flat files and perform queries. Several special methods are provided for common  tab-delimited flat files and perform queries. Several special methods are provided for common
34  query tasks. For example, L</genomes> lists the IDs of all the genomes in the database and  query tasks. For example, L</Genomes> lists the IDs of all the genomes in the database and
35  L</dna_seq> returns the DNA sequence for a specified genome location.  L</DNASeq> returns the DNA sequence for a specified genome location.
36    
37  The Sprout object is a subclass of the ERDB object and inherits all its properties and methods.  The Sprout object is a subclass of the ERDB object and inherits all its properties and methods.
38    
# Line 46  Line 44 
44    
45  =head3 new  =head3 new
46    
47  C<< my $sprout = Sprout->new($dbName, \%options); >>      my $sprout = Sprout->new($dbName, \%options);
48    
49  This is the constructor for a sprout object. It connects to the database and loads the  This is the constructor for a sprout object. It connects to the database and loads the
50  database definition into memory. The positional first parameter specifies the name of the  database definition into memory. The positional first parameter specifies the name of the
# Line 86  Line 84 
84  I<fig> with a password of I<admin>. The database load files are in the directory  I<fig> with a password of I<admin>. The database load files are in the directory
85  F</usr/fig/SproutData>.  F</usr/fig/SproutData>.
86    
87  C<< my $sprout = Sprout->new('Sprout', { userData =>; 'fig/admin', dataDir => '/usr/fig/SproutData' }); >>      my $sprout = Sprout->new('Sprout', { userData =>; 'fig/admin', dataDir => '/usr/fig/SproutData' });
88    
89  =cut  =cut
90    
# Line 151  Line 149 
149    
150  =head3 MaxSegment  =head3 MaxSegment
151    
152  C<< my $length = $sprout->MaxSegment(); >>      my $length = $sprout->MaxSegment();
153    
154  This method returns the maximum permissible length of a feature segment. The length is important  This method returns the maximum permissible length of a feature segment. The length is important
155  because it enables us to make reasonable guesses at how to find features inside a particular  because it enables us to make reasonable guesses at how to find features inside a particular
# Line 168  Line 166 
166    
167  =head3 MaxSequence  =head3 MaxSequence
168    
169  C<< my $length = $sprout->MaxSequence(); >>      my $length = $sprout->MaxSequence();
170    
171  This method returns the maximum permissible length of a contig sequence. A contig is broken  This method returns the maximum permissible length of a contig sequence. A contig is broken
172  into sequences in order to save memory resources. In particular, when manipulating features,  into sequences in order to save memory resources. In particular, when manipulating features,
# Line 183  Line 181 
181    
182  =head3 Load  =head3 Load
183    
184  C<< $sprout->Load($rebuild); >>;      $sprout->Load($rebuild);;
185    
186  Load the database from files in the data directory, optionally re-creating the tables.  Load the database from files in the data directory, optionally re-creating the tables.
187    
# Line 223  Line 221 
221    
222  =head3 LoadUpdate  =head3 LoadUpdate
223    
224  C<< my $stats = $sprout->LoadUpdate($truncateFlag, \@tableList); >>      my $stats = $sprout->LoadUpdate($truncateFlag, \@tableList);
225    
226  Load updates to one or more database tables. This method enables the client to make changes to one  Load updates to one or more database tables. This method enables the client to make changes to one
227  or two tables without reloading the whole database. For each table, there must be a corresponding  or two tables without reloading the whole database. For each table, there must be a corresponding
# Line 280  Line 278 
278    
279  =head3 GenomeCounts  =head3 GenomeCounts
280    
281  C<< my ($arch, $bact, $euk, $vir, $env, $unk) = $sprout->GenomeCounts($complete); >>      my ($arch, $bact, $euk, $vir, $env, $unk) = $sprout->GenomeCounts($complete);
282    
283  Count the number of genomes in each domain. If I<$complete> is TRUE, only complete  Count the number of genomes in each domain. If I<$complete> is TRUE, only complete
284  genomes will be included in the counts.  genomes will be included in the counts.
# Line 325  Line 323 
323    
324  =head3 ContigCount  =head3 ContigCount
325    
326  C<< my $count = $sprout->ContigCount($genomeID); >>      my $count = $sprout->ContigCount($genomeID);
327    
328  Return the number of contigs for the specified genome ID.  Return the number of contigs for the specified genome ID.
329    
# Line 354  Line 352 
352    
353  =head3 GeneMenu  =head3 GeneMenu
354    
355  C<< my $selectHtml = $sprout->GeneMenu(\%attributes, $filterString, \@params, $selected); >>      my $selectHtml = $sprout->GeneMenu(\%attributes, $filterString, \@params, $selected);
356    
357  Return an HTML select menu of genomes. Each genome will be an option in the menu,  Return an HTML select menu of genomes. Each genome will be an option in the menu,
358  and will be displayed by name with the ID and a contig count attached. The selection  and will be displayed by name with the ID and a contig count attached. The selection
# Line 435  Line 433 
433    
434  =head3 Build  =head3 Build
435    
436  C<< $sprout->Build(); >>      $sprout->Build();
437    
438  Build the database. The database will be cleared and the tables re-created from the metadata.  Build the database. The database will be cleared and the tables re-created from the metadata.
439  This method is useful when a database is brand new or when the database definition has  This method is useful when a database is brand new or when the database definition has
# Line 452  Line 450 
450    
451  =head3 Genomes  =head3 Genomes
452    
453  C<< my @genomes = $sprout->Genomes(); >>      my @genomes = $sprout->Genomes();
454    
455  Return a list of all the genome IDs.  Return a list of all the genome IDs.
456    
# Line 469  Line 467 
467    
468  =head3 GenusSpecies  =head3 GenusSpecies
469    
470  C<< my $infoString = $sprout->GenusSpecies($genomeID); >>      my $infoString = $sprout->GenusSpecies($genomeID);
471    
472  Return the genus, species, and unique characterization for a genome.  Return the genus, species, and unique characterization for a genome.
473    
# Line 501  Line 499 
499    
500  =head3 FeaturesOf  =head3 FeaturesOf
501    
502  C<< my @features = $sprout->FeaturesOf($genomeID, $ftype); >>      my @features = $sprout->FeaturesOf($genomeID, $ftype);
503    
504  Return a list of the features relevant to a specified genome.  Return a list of the features relevant to a specified genome.
505    
# Line 546  Line 544 
544    
545  =head3 FeatureLocation  =head3 FeatureLocation
546    
547  C<< my @locations = $sprout->FeatureLocation($featureID); >>      my @locations = $sprout->FeatureLocation($featureID);
548    
549  Return the location of a feature in its genome's contig segments. In a list context, this method  Return the location of a feature in its genome's contig segments. In a list context, this method
550  will return a list of the locations. In a scalar context, it will return the locations as a space-  will return a list of the locations. In a scalar context, it will return the locations as a space-
# Line 592  Line 590 
590    
591  =head3 ParseLocation  =head3 ParseLocation
592    
593  C<< my ($contigID, $start, $dir, $len) = Sprout::ParseLocation($location); >>      my ($contigID, $start, $dir, $len) = Sprout::ParseLocation($location);
594    
595  Split a location specifier into the contig ID, the starting point, the direction, and the  Split a location specifier into the contig ID, the starting point, the direction, and the
596  length.  length.
# Line 638  Line 636 
636    
637  =head3 PointLocation  =head3 PointLocation
638    
639  C<< my $found = Sprout::PointLocation($location, $point); >>      my $found = Sprout::PointLocation($location, $point);
640    
641  Return the offset into the specified location of the specified point on the contig. If  Return the offset into the specified location of the specified point on the contig. If
642  the specified point is before the location, a negative value will be returned. If it is  the specified point is before the location, a negative value will be returned. If it is
# Line 690  Line 688 
688    
689  =head3 DNASeq  =head3 DNASeq
690    
691  C<< my $sequence = $sprout->DNASeq(\@locationList); >>      my $sequence = $sprout->DNASeq(\@locationList);
692    
693  This method returns the DNA sequence represented by a list of locations. The list of locations  This method returns the DNA sequence represented by a list of locations. The list of locations
694  should be of the form returned by L</featureLocation> when in a list context. In other words,  should be of the form returned by L</featureLocation> when in a list context. In other words,
# Line 774  Line 772 
772    
773  =head3 AllContigs  =head3 AllContigs
774    
775  C<< my @idList = $sprout->AllContigs($genomeID); >>      my @idList = $sprout->AllContigs($genomeID);
776    
777  Return a list of all the contigs for a genome.  Return a list of all the contigs for a genome.
778    
# Line 804  Line 802 
802    
803  =head3 GenomeLength  =head3 GenomeLength
804    
805  C<< my $length = $sprout->GenomeLength($genomeID); >>      my $length = $sprout->GenomeLength($genomeID);
806    
807  Return the length of the specified genome in base pairs.  Return the length of the specified genome in base pairs.
808    
# Line 839  Line 837 
837    
838  =head3 FeatureCount  =head3 FeatureCount
839    
840  C<< my $count = $sprout->FeatureCount($genomeID, $type); >>      my $count = $sprout->FeatureCount($genomeID, $type);
841    
842  Return the number of features of the specified type in the specified genome.  Return the number of features of the specified type in the specified genome.
843    
# Line 874  Line 872 
872    
873  =head3 GenomeAssignments  =head3 GenomeAssignments
874    
875  C<< my $fidHash = $sprout->GenomeAssignments($genomeID); >>      my $fidHash = $sprout->GenomeAssignments($genomeID);
876    
877  Return a list of a genome's assigned features. The return hash will contain each  Return a list of a genome's assigned features. The return hash will contain each
878  assigned feature of the genome mapped to the text of its most recent functional  assigned feature of the genome mapped to the text of its most recent functional
# Line 917  Line 915 
915    
916  =head3 ContigLength  =head3 ContigLength
917    
918  C<< my $length = $sprout->ContigLength($contigID); >>      my $length = $sprout->ContigLength($contigID);
919    
920  Compute the length of a contig.  Compute the length of a contig.
921    
# Line 956  Line 954 
954    
955  =head3 ClusterPEGs  =head3 ClusterPEGs
956    
957  C<< my $clusteredList = $sprout->ClusterPEGs($sub, \@pegs); >>      my $clusteredList = $sprout->ClusterPEGs($sub, \@pegs);
958    
959  Cluster the PEGs in a list according to the cluster coding scheme of the specified  Cluster the PEGs in a list according to the cluster coding scheme of the specified
960  subsystem. In order for this to work properly, the subsystem object must have  subsystem. In order for this to work properly, the subsystem object must have
961  been used recently to retrieve the PEGs using the B<get_pegs_from_cell> method.  been used recently to retrieve the PEGs using the B<get_pegs_from_cell> or
962  This causes the cluster numbers to be pulled into the subsystem's color hash.  B<get_row> methods. This causes the cluster numbers to be pulled into the
963  If a PEG is not found in the color hash, it will not appear in the output  subsystem's color hash. If a PEG is not found in the color hash, it will not
964  sequence.  appear in the output sequence.
965    
966  =over 4  =over 4
967    
# Line 1004  Line 1002 
1002    
1003  =head3 GenesInRegion  =head3 GenesInRegion
1004    
1005  C<< my (\@featureIDList, $beg, $end) = $sprout->GenesInRegion($contigID, $start, $stop); >>      my (\@featureIDList, $beg, $end) = $sprout->GenesInRegion($contigID, $start, $stop);
1006    
1007  List the features which overlap a specified region in a contig.  List the features which overlap a specified region in a contig.
1008    
# Line 1085  Line 1083 
1083    
1084  =head3 GeneDataInRegion  =head3 GeneDataInRegion
1085    
1086  C<< my @featureList = $sprout->GenesInRegion($contigID, $start, $stop); >>      my @featureList = $sprout->GenesInRegion($contigID, $start, $stop);
1087    
1088  List the features which overlap a specified region in a contig.  List the features which overlap a specified region in a contig.
1089    
# Line 1156  Line 1154 
1154    
1155  =head3 FType  =head3 FType
1156    
1157  C<< my $ftype = $sprout->FType($featureID); >>      my $ftype = $sprout->FType($featureID);
1158    
1159  Return the type of a feature.  Return the type of a feature.
1160    
# Line 1186  Line 1184 
1184    
1185  =head3 FeatureAnnotations  =head3 FeatureAnnotations
1186    
1187  C<< my @descriptors = $sprout->FeatureAnnotations($featureID, $rawFlag); >>      my @descriptors = $sprout->FeatureAnnotations($featureID, $rawFlag);
1188    
1189  Return the annotations of a feature.  Return the annotations of a feature.
1190    
# Line 1249  Line 1247 
1247    
1248  =head3 AllFunctionsOf  =head3 AllFunctionsOf
1249    
1250  C<< my %functions = $sprout->AllFunctionsOf($featureID); >>      my %functions = $sprout->AllFunctionsOf($featureID);
1251    
1252  Return all of the functional assignments for a particular feature. The data is returned as a  Return all of the functional assignments for a particular feature. The data is returned as a
1253  hash of functional assignments to user IDs. A functional assignment is a type of annotation,  hash of functional assignments to user IDs. A functional assignment is a type of annotation,
# Line 1304  Line 1302 
1302    
1303  =head3 FunctionOf  =head3 FunctionOf
1304    
1305  C<< my $functionText = $sprout->FunctionOf($featureID, $userID); >>      my $functionText = $sprout->FunctionOf($featureID, $userID);
1306    
1307  Return the most recently-determined functional assignment of a particular feature.  Return the most recently-determined functional assignment of a particular feature.
1308    
# Line 1408  Line 1406 
1406    
1407  =head3 FunctionsOf  =head3 FunctionsOf
1408    
1409  C<< my @functionList = $sprout->FunctionOf($featureID, $userID); >>      my @functionList = $sprout->FunctionOf($featureID, $userID);
1410    
1411  Return the functional assignments of a particular feature.  Return the functional assignments of a particular feature.
1412    
# Line 1480  Line 1478 
1478    
1479  =head3 BBHList  =head3 BBHList
1480    
1481  C<< my $bbhHash = $sprout->BBHList($genomeID, \@featureList); >>      my $bbhHash = $sprout->BBHList($genomeID, \@featureList);
1482    
1483  Return a hash mapping the features in a specified list to their bidirectional best hits  Return a hash mapping the features in a specified list to their bidirectional best hits
1484  on a specified target genome.  on a specified target genome.
# Line 1530  Line 1528 
1528    
1529  =head3 SimList  =head3 SimList
1530    
1531  C<< my %similarities = $sprout->SimList($featureID, $count); >>      my %similarities = $sprout->SimList($featureID, $count);
1532    
1533  Return a list of the similarities to the specified feature.  Return a list of the similarities to the specified feature.
1534    
# Line 1566  Line 1564 
1564    
1565  =head3 IsComplete  =head3 IsComplete
1566    
1567  C<< my $flag = $sprout->IsComplete($genomeID); >>      my $flag = $sprout->IsComplete($genomeID);
1568    
1569  Return TRUE if the specified genome is complete, else FALSE.  Return TRUE if the specified genome is complete, else FALSE.
1570    
# Line 1602  Line 1600 
1600    
1601  =head3 FeatureAliases  =head3 FeatureAliases
1602    
1603  C<< my @aliasList = $sprout->FeatureAliases($featureID); >>      my @aliasList = $sprout->FeatureAliases($featureID);
1604    
1605  Return a list of the aliases for a specified feature.  Return a list of the aliases for a specified feature.
1606    
# Line 1632  Line 1630 
1630    
1631  =head3 GenomeOf  =head3 GenomeOf
1632    
1633  C<< my $genomeID = $sprout->GenomeOf($featureID); >>      my $genomeID = $sprout->GenomeOf($featureID);
1634    
1635  Return the genome that contains a specified feature or contig.  Return the genome that contains a specified feature or contig.
1636    
# Line 1668  Line 1666 
1666    
1667  =head3 CoupledFeatures  =head3 CoupledFeatures
1668    
1669  C<< my %coupleHash = $sprout->CoupledFeatures($featureID); >>      my %coupleHash = $sprout->CoupledFeatures($featureID);
1670    
1671  Return the features functionally coupled with a specified feature. Features are considered  Return the features functionally coupled with a specified feature. Features are considered
1672  functionally coupled if they tend to be clustered on the same chromosome.  functionally coupled if they tend to be clustered on the same chromosome.
# Line 1715  Line 1713 
1713    
1714  =head3 CouplingEvidence  =head3 CouplingEvidence
1715    
1716  C<< my @evidence = $sprout->CouplingEvidence($peg1, $peg2); >>      my @evidence = $sprout->CouplingEvidence($peg1, $peg2);
1717    
1718  Return the evidence for a functional coupling.  Return the evidence for a functional coupling.
1719    
# Line 1777  Line 1775 
1775    
1776  =head3 GetSynonymGroup  =head3 GetSynonymGroup
1777    
1778  C<< my $id = $sprout->GetSynonymGroup($fid); >>      my $id = $sprout->GetSynonymGroup($fid);
1779    
1780  Return the synonym group name for the specified feature.  Return the synonym group name for the specified feature.
1781    
# Line 1816  Line 1814 
1814    
1815  =head3 GetBoundaries  =head3 GetBoundaries
1816    
1817  C<< my ($contig, $beg, $end) = $sprout->GetBoundaries(@locList); >>      my ($contig, $beg, $end) = $sprout->GetBoundaries(@locList);
1818    
1819  Determine the begin and end boundaries for the locations in a list. All of the  Determine the begin and end boundaries for the locations in a list. All of the
1820  locations must belong to the same contig and have mostly the same direction in  locations must belong to the same contig and have mostly the same direction in
# Line 1880  Line 1878 
1878    
1879  =head3 ReadFasta  =head3 ReadFasta
1880    
1881  C<< my %sequenceData = Sprout::ReadFasta($fileName, $prefix); >>      my %sequenceData = Sprout::ReadFasta($fileName, $prefix);
1882    
1883  Read sequence data from a FASTA-format file. Each sequence in a FASTA file is represented by  Read sequence data from a FASTA-format file. Each sequence in a FASTA file is represented by
1884  one or more lines of data. The first line begins with a > character and contains an ID.  one or more lines of data. The first line begins with a > character and contains an ID.
# Line 1946  Line 1944 
1944    
1945  =head3 FormatLocations  =head3 FormatLocations
1946    
1947  C<< my @locations = $sprout->FormatLocations($prefix, \@locations, $oldFormat); >>      my @locations = $sprout->FormatLocations($prefix, \@locations, $oldFormat);
1948    
1949  Insure that a list of feature locations is in the Sprout format. The Sprout feature location  Insure that a list of feature locations is in the Sprout format. The Sprout feature location
1950  format is I<contig>_I<beg*len> where I<*> is C<+> for a forward gene and C<-> for a backward  format is I<contig>_I<beg*len> where I<*> is C<+> for a forward gene and C<-> for a backward
# Line 2011  Line 2009 
2009    
2010  =head3 DumpData  =head3 DumpData
2011    
2012  C<< $sprout->DumpData(); >>      $sprout->DumpData();
2013    
2014  Dump all the tables to tab-delimited DTX files. The files will be stored in the data directory.  Dump all the tables to tab-delimited DTX files. The files will be stored in the data directory.
2015    
# Line 2028  Line 2026 
2026    
2027  =head3 XMLFileName  =head3 XMLFileName
2028    
2029  C<< my $fileName = $sprout->XMLFileName(); >>      my $fileName = $sprout->XMLFileName();
2030    
2031  Return the name of this database's XML definition file.  Return the name of this database's XML definition file.
2032    
# Line 2039  Line 2037 
2037      return $self->{_xmlName};      return $self->{_xmlName};
2038  }  }
2039    
2040    =head3 GetGenomeNameData
2041    
2042        my ($genus, $species, $strain) = $sprout->GenomeNameData($genomeID);
2043    
2044    Return the genus, species, and unique characterization for a genome. This
2045    is similar to L</GenusSpecies>, with the exception that it returns the
2046    values in three seperate fields.
2047    
2048    =over 4
2049    
2050    =item genomeID
2051    
2052    ID of the genome whose name data is desired.
2053    
2054    =item RETURN
2055    
2056    Returns a three-element list, consisting of the genus, species, and strain
2057    of the specified genome. If the genome is not found, an error occurs.
2058    
2059    =back
2060    
2061    =cut
2062    
2063    sub GetGenomeNameData {
2064        # Get the parameters.
2065        my ($self, $genomeID) = @_;
2066        # Get the desired values.
2067        my ($genus, $species, $strain) = $self->GetEntityValues('Genome', $genomeID =>
2068                                                                [qw(Genome(genus) Genome(species) Genome(unique-characterization))]);
2069        # Throw an error if they were not found.
2070        if (! defined $genus) {
2071            Confess("Genome $genomeID not found in database.");
2072        }
2073        # Return the results.
2074        return ($genus, $species, $strain);
2075    }
2076    
2077    =head3 GetGenomeByNameData
2078    
2079        my @genomes = $sprout->GetGenomeByNameData($genus, $species, $strain);
2080    
2081    Return a list of the IDs of the genomes with the specified genus,
2082    species, and strain. In almost every case, there will be either zero or
2083    one IDs returned; however, two or more IDs could be returned if there are
2084    multiple versions of the genome in the database.
2085    
2086    =over 4
2087    
2088    =item genus
2089    
2090    Genus of the desired genome.
2091    
2092    =item species
2093    
2094    Species of the desired genome.
2095    
2096    =item strain
2097    
2098    Strain (unique characterization) of the desired genome. This may be an empty
2099    string, in which case it is presumed that the desired genome has no strain
2100    specified.
2101    
2102    =item RETURN
2103    
2104    Returns a list of the IDs of the genomes having the specified genus, species, and
2105    strain.
2106    
2107    =back
2108    
2109    =cut
2110    
2111    sub GetGenomeByNameData {
2112        # Get the parameters.
2113        my ($self, $genus, $species, $strain) = @_;
2114        # Try to find the genomes.
2115        my @retVal = $self->GetFlat(['Genome'], "Genome(genus) = ? AND Genome(species) = ? AND Genome(unique-characterization) = ?",
2116                                    [$genus, $species, $strain], 'Genome(id)');
2117        # Return the result.
2118        return @retVal;
2119    }
2120    
2121  =head3 Insert  =head3 Insert
2122    
2123  C<< $sprout->Insert($objectType, \%fieldHash); >>      $sprout->Insert($objectType, \%fieldHash);
2124    
2125  Insert an entity or relationship instance into the database. The entity or relationship of interest  Insert an entity or relationship instance into the database. The entity or relationship of interest
2126  is defined by a type name and then a hash of field names to values. Field values in the primary  is defined by a type name and then a hash of field names to values. Field values in the primary
# Line 2050  Line 2129 
2129  list references. For example, the following line inserts an inactive PEG feature named  list references. For example, the following line inserts an inactive PEG feature named
2130  C<fig|188.1.peg.1> with aliases C<ZP_00210270.1> and C<gi|46206278>.  C<fig|188.1.peg.1> with aliases C<ZP_00210270.1> and C<gi|46206278>.
2131    
2132  C<< $sprout->Insert('Feature', { id => 'fig|188.1.peg.1', active => 0, feature-type => 'peg', alias => ['ZP_00210270.1', 'gi|46206278']}); >>      $sprout->Insert('Feature', { id => 'fig|188.1.peg.1', active => 0, feature-type => 'peg', alias => ['ZP_00210270.1', 'gi|46206278']});
2133    
2134  The next statement inserts a C<HasProperty> relationship between feature C<fig|158879.1.peg.1> and  The next statement inserts a C<HasProperty> relationship between feature C<fig|158879.1.peg.1> and
2135  property C<4> with an evidence URL of C<http://seedu.uchicago.edu/query.cgi?article_id=142>.  property C<4> with an evidence URL of C<http://seedu.uchicago.edu/query.cgi?article_id=142>.
2136    
2137  C<< $sprout->InsertObject('HasProperty', { 'from-link' => 'fig|158879.1.peg.1', 'to-link' => 4, evidence => 'http://seedu.uchicago.edu/query.cgi?article_id=142'}); >>      $sprout->InsertObject('HasProperty', { 'from-link' => 'fig|158879.1.peg.1', 'to-link' => 4, evidence => 'http://seedu.uchicago.edu/query.cgi?article_id=142'});
2138    
2139  =over 4  =over 4
2140    
# Line 2080  Line 2159 
2159    
2160  =head3 Annotate  =head3 Annotate
2161    
2162  C<< my $ok = $sprout->Annotate($fid, $timestamp, $user, $text); >>      my $ok = $sprout->Annotate($fid, $timestamp, $user, $text);
2163    
2164  Annotate a feature. This inserts an Annotation record into the database and links it to the  Annotate a feature. This inserts an Annotation record into the database and links it to the
2165  specified feature and user.  specified feature and user.
# Line 2134  Line 2213 
2213    
2214  =head3 AssignFunction  =head3 AssignFunction
2215    
2216  C<< my $ok = $sprout->AssignFunction($featureID, $user, $function, $assigningUser); >>      my $ok = $sprout->AssignFunction($featureID, $user, $function, $assigningUser);
2217    
2218  This method assigns a function to a feature. Functions are a special type of annotation. The general  This method assigns a function to a feature. Functions are a special type of annotation. The general
2219  format is described in L</ParseAssignment>.  format is described in L</ParseAssignment>.
# Line 2194  Line 2273 
2273    
2274  =head3 FeaturesByAlias  =head3 FeaturesByAlias
2275    
2276  C<< my @features = $sprout->FeaturesByAlias($alias); >>      my @features = $sprout->FeaturesByAlias($alias);
2277    
2278  Returns a list of features with the specified alias. The alias is parsed to determine  Returns a list of features with the specified alias. The alias is parsed to determine
2279  the type of the alias. A string of digits is a GenBack ID and a string of exactly 6  the type of the alias. A string of digits is a GenBack ID and a string of exactly 6
# Line 2236  Line 2315 
2315    
2316  =head3 FeatureTranslation  =head3 FeatureTranslation
2317    
2318  C<< my $translation = $sprout->FeatureTranslation($featureID); >>      my $translation = $sprout->FeatureTranslation($featureID);
2319    
2320  Return the translation of a feature.  Return the translation of a feature.
2321    
# Line 2264  Line 2343 
2343    
2344  =head3 Taxonomy  =head3 Taxonomy
2345    
2346  C<< my @taxonomyList = $sprout->Taxonomy($genome); >>      my @taxonomyList = $sprout->Taxonomy($genome);
2347    
2348  Return the taxonomy of the specified genome. This will be in the form of a list  Return the taxonomy of the specified genome. This will be in the form of a list
2349  containing the various classifications in order from domain (eg. C<Bacteria>, C<Archaea>,  containing the various classifications in order from domain (eg. C<Bacteria>, C<Archaea>,
2350  or C<Eukaryote>) to sub-species. For example,  or C<Eukaryote>) to sub-species. For example,
2351    
2352  C<< (Bacteria, Proteobacteria, Gammaproteobacteria, Enterobacteriales, Enterobacteriaceae, Escherichia, Escherichia coli, Escherichia coli K12) >>      (Bacteria, Proteobacteria, Gammaproteobacteria, Enterobacteriales, Enterobacteriaceae, Escherichia, Escherichia coli, Escherichia coli K12)
2353    
2354  =over 4  =over 4
2355    
# Line 2305  Line 2384 
2384    
2385  =head3 CrudeDistance  =head3 CrudeDistance
2386    
2387  C<< my $distance = $sprout->CrudeDistance($genome1, $genome2); >>      my $distance = $sprout->CrudeDistance($genome1, $genome2);
2388    
2389  Returns a crude estimate of the distance between two genomes. The distance is construed so  Returns a crude estimate of the distance between two genomes. The distance is construed so
2390  that it will be 0 for genomes with identical taxonomies and 1 for genomes from different domains.  that it will be 0 for genomes with identical taxonomies and 1 for genomes from different domains.
# Line 2357  Line 2436 
2436    
2437  =head3 RoleName  =head3 RoleName
2438    
2439  C<< my $roleName = $sprout->RoleName($roleID); >>      my $roleName = $sprout->RoleName($roleID);
2440    
2441  Return the descriptive name of the role with the specified ID. In general, a role  Return the descriptive name of the role with the specified ID. In general, a role
2442  will only have a descriptive name if it is coded as an EC number.  will only have a descriptive name if it is coded as an EC number.
# Line 2391  Line 2470 
2470    
2471  =head3 RoleDiagrams  =head3 RoleDiagrams
2472    
2473  C<< my @diagrams = $sprout->RoleDiagrams($roleID); >>      my @diagrams = $sprout->RoleDiagrams($roleID);
2474    
2475  Return a list of the diagrams containing a specified functional role.  Return a list of the diagrams containing a specified functional role.
2476    
# Line 2421  Line 2500 
2500    
2501  =head3 GetProperties  =head3 GetProperties
2502    
2503  C<< my @list = $sprout->GetProperties($fid, $key, $value, $url); >>      my @list = $sprout->GetProperties($fid, $key, $value, $url);
2504    
2505  Return a list of the properties with the specified characteristics.  Return a list of the properties with the specified characteristics.
2506    
# Line 2507  Line 2586 
2586    
2587  =head3 FeatureProperties  =head3 FeatureProperties
2588    
2589  C<< my @properties = $sprout->FeatureProperties($featureID); >>      my @properties = $sprout->FeatureProperties($featureID);
2590    
2591  Return a list of the properties for the specified feature. Properties are key-value pairs  Return a list of the properties for the specified feature. Properties are key-value pairs
2592  that specify special characteristics of the feature. For example, a property could indicate  that specify special characteristics of the feature. For example, a property could indicate
# Line 2546  Line 2625 
2625    
2626  =head3 DiagramName  =head3 DiagramName
2627    
2628  C<< my $diagramName = $sprout->DiagramName($diagramID); >>      my $diagramName = $sprout->DiagramName($diagramID);
2629    
2630  Return the descriptive name of a diagram.  Return the descriptive name of a diagram.
2631    
# Line 2574  Line 2653 
2653    
2654  =head3 PropertyID  =head3 PropertyID
2655    
2656  C<< my $id = $sprout->PropertyID($propName, $propValue); >>      my $id = $sprout->PropertyID($propName, $propValue);
2657    
2658  Return the ID of the specified property name and value pair, if the  Return the ID of the specified property name and value pair, if the
2659  pair exists. Only a small subset of the FIG attributes are stored as  pair exists. Only a small subset of the FIG attributes are stored as
# Line 2611  Line 2690 
2690    
2691  =head3 MergedAnnotations  =head3 MergedAnnotations
2692    
2693  C<< my @annotationList = $sprout->MergedAnnotations(\@list); >>      my @annotationList = $sprout->MergedAnnotations(\@list);
2694    
2695  Returns a merged list of the annotations for the features in a list. Each annotation is  Returns a merged list of the annotations for the features in a list. Each annotation is
2696  represented by a 4-tuple of the form C<($fid, $timestamp, $userID, $annotation)>, where  represented by a 4-tuple of the form C<($fid, $timestamp, $userID, $annotation)>, where
# Line 2660  Line 2739 
2739    
2740  =head3 RoleNeighbors  =head3 RoleNeighbors
2741    
2742  C<< my @roleList = $sprout->RoleNeighbors($roleID); >>      my @roleList = $sprout->RoleNeighbors($roleID);
2743    
2744  Returns a list of the roles that occur in the same diagram as the specified role. Because  Returns a list of the roles that occur in the same diagram as the specified role. Because
2745  diagrams and roles are in a many-to-many relationship with each other, the list is  diagrams and roles are in a many-to-many relationship with each other, the list is
# Line 2703  Line 2782 
2782    
2783  =head3 FeatureLinks  =head3 FeatureLinks
2784    
2785  C<< my @links = $sprout->FeatureLinks($featureID); >>      my @links = $sprout->FeatureLinks($featureID);
2786    
2787  Return a list of the web hyperlinks associated with a feature. The web hyperlinks are  Return a list of the web hyperlinks associated with a feature. The web hyperlinks are
2788  to external websites describing either the feature itself or the organism containing it  to external websites describing either the feature itself or the organism containing it
# Line 2734  Line 2813 
2813    
2814  =head3 SubsystemsOf  =head3 SubsystemsOf
2815    
2816  C<< my %subsystems = $sprout->SubsystemsOf($featureID); >>      my %subsystems = $sprout->SubsystemsOf($featureID);
2817    
2818  Return a hash describing all the subsystems in which a feature participates. Each subsystem is mapped  Return a hash describing all the subsystems in which a feature participates. Each subsystem is mapped
2819  to the roles the feature performs.  to the roles the feature performs.
# Line 2782  Line 2861 
2861    
2862  =head3 SubsystemList  =head3 SubsystemList
2863    
2864  C<< my @subsystems = $sprout->SubsystemList($featureID); >>      my @subsystems = $sprout->SubsystemList($featureID);
2865    
2866  Return a list containing the names of the subsystems in which the specified  Return a list containing the names of the subsystems in which the specified
2867  feature participates. Unlike L</SubsystemsOf>, this method only returns the  feature participates. Unlike L</SubsystemsOf>, this method only returns the
# Line 2814  Line 2893 
2893    
2894  =head3 GenomeSubsystemData  =head3 GenomeSubsystemData
2895    
2896  C<< my %featureData = $sprout->GenomeSubsystemData($genomeID); >>      my %featureData = $sprout->GenomeSubsystemData($genomeID);
2897    
2898  Return a hash mapping genome features to their subsystem roles.  Return a hash mapping genome features to their subsystem roles.
2899    
# Line 2874  Line 2953 
2953    
2954  =head3 RelatedFeatures  =head3 RelatedFeatures
2955    
2956  C<< my @relatedList = $sprout->RelatedFeatures($featureID, $function, $userID); >>      my @relatedList = $sprout->RelatedFeatures($featureID, $function, $userID);
2957    
2958  Return a list of the features which are bi-directional best hits of the specified feature and  Return a list of the features which are bi-directional best hits of the specified feature and
2959  have been assigned the specified function by the specified user. If no such features exists,  have been assigned the specified function by the specified user. If no such features exists,
# Line 2925  Line 3004 
3004    
3005  =head3 TaxonomySort  =head3 TaxonomySort
3006    
3007  C<< my @sortedFeatureIDs = $sprout->TaxonomySort(\@featureIDs); >>      my @sortedFeatureIDs = $sprout->TaxonomySort(\@featureIDs);
3008    
3009  Return a list formed by sorting the specified features by the taxonomy of the containing  Return a list formed by sorting the specified features by the taxonomy of the containing
3010  genome. This will cause genomes from similar organisms to float close to each other.  genome. This will cause genomes from similar organisms to float close to each other.
# Line 2973  Line 3052 
3052    
3053  =head3 Protein  =head3 Protein
3054    
3055  C<< my $protein = Sprout::Protein($sequence, $table); >>      my $protein = Sprout::Protein($sequence, $table);
3056    
3057  Translate a DNA sequence into a protein sequence.  Translate a DNA sequence into a protein sequence.
3058    
# Line 3059  Line 3138 
3138    
3139  =head3 LoadInfo  =head3 LoadInfo
3140    
3141  C<< my ($dirName, @relNames) = $sprout->LoadInfo(); >>      my ($dirName, @relNames) = $sprout->LoadInfo();
3142    
3143  Return the name of the directory from which data is to be loaded and a list of the relation  Return the name of the directory from which data is to be loaded and a list of the relation
3144  names. This information is useful when trying to analyze what needs to be put where in order  names. This information is useful when trying to analyze what needs to be put where in order
# Line 3080  Line 3159 
3159    
3160  =head3 BBHMatrix  =head3 BBHMatrix
3161    
3162  C<< my %bbhMap = $sprout->BBHMatrix($genomeID, $cutoff, @targets); >>      my %bbhMap = $sprout->BBHMatrix($genomeID, $cutoff, @targets);
3163    
3164  Find all the bidirectional best hits for the features of a genome in a  Find all the bidirectional best hits for the features of a genome in a
3165  specified list of target genomes. The return value will be a hash mapping  specified list of target genomes. The return value will be a hash mapping
# Line 3134  Line 3213 
3213    
3214  =head3 SimMatrix  =head3 SimMatrix
3215    
3216  C<< my %simMap = $sprout->SimMatrix($genomeID, $cutoff, @targets); >>      my %simMap = $sprout->SimMatrix($genomeID, $cutoff, @targets);
3217    
3218  Find all the similarities for the features of a genome in a  Find all the similarities for the features of a genome in a
3219  specified list of target genomes. The return value will be a hash mapping  specified list of target genomes. The return value will be a hash mapping
# Line 3204  Line 3283 
3283    
3284  =head3 LowBBHs  =head3 LowBBHs
3285    
3286  C<< my %bbhMap = $sprout->LowBBHs($featureID, $cutoff); >>      my %bbhMap = $sprout->LowBBHs($featureID, $cutoff);
3287    
3288  Return the bidirectional best hits of a feature whose score is no greater than a  Return the bidirectional best hits of a feature whose score is no greater than a
3289  specified cutoff value. A higher cutoff value will allow inclusion of hits with  specified cutoff value. A higher cutoff value will allow inclusion of hits with
# Line 3248  Line 3327 
3327    
3328  =head3 Sims  =head3 Sims
3329    
3330  C<< my $simList = $sprout->Sims($fid, $maxN, $maxP, $select, $max_expand, $filters); >>      my $simList = $sprout->Sims($fid, $maxN, $maxP, $select, $max_expand, $filters);
3331    
3332  Get a list of similarities for a specified feature. Similarity information is not kept in the  Get a list of similarities for a specified feature. Similarity information is not kept in the
3333  Sprout database; rather, they are retrieved from a network server. The similarities are  Sprout database; rather, they are retrieved from a network server. The similarities are
# Line 3314  Line 3393 
3393    
3394  =head3 IsAllGenomes  =head3 IsAllGenomes
3395    
3396  C<< my $flag = $sprout->IsAllGenomes(\@list, \@checkList); >>      my $flag = $sprout->IsAllGenomes(\@list, \@checkList);
3397    
3398  Return TRUE if all genomes in the second list are represented in the first list at  Return TRUE if all genomes in the second list are represented in the first list at
3399  least one. Otherwise, return FALSE. If the second list is omitted, the first list is  least one. Otherwise, return FALSE. If the second list is omitted, the first list is
# Line 3363  Line 3442 
3442    
3443  =head3 GetGroups  =head3 GetGroups
3444    
3445  C<< my %groups = $sprout->GetGroups(\@groupList); >>      my %groups = $sprout->GetGroups(\@groupList);
3446    
3447  Return a hash mapping each group to the IDs of the genomes in the group.  Return a hash mapping each group to the IDs of the genomes in the group.
3448  A list of groups may be specified, in which case only those groups will be  A list of groups may be specified, in which case only those groups will be
# Line 3395  Line 3474 
3474                                      [$FIG_Config::otherGroup], ['Genome(id)', 'Genome(primary-group)']);                                      [$FIG_Config::otherGroup], ['Genome(id)', 'Genome(primary-group)']);
3475          # Loop through the genomes found.          # Loop through the genomes found.
3476          for my $genome (@genomes) {          for my $genome (@genomes) {
3477              # Pop this genome's ID off the current list.              # Get the genome ID and group, and add this genome to the group's list.
3478              my @groups = @{$genome};              my ($genomeID, $group) = @{$genome};
3479              my $genomeID = shift @groups;              push @{$retVal{$group}}, $genomeID;
             # Loop through the groups, adding the genome ID to each group's  
             # list.  
             for my $group (@groups) {  
                 Tracer::AddToListMap(\%retVal, $group, $genomeID);  
             }  
3480          }          }
3481      }      }
3482      # Return the hash we just built.      # Return the hash we just built.
# Line 3411  Line 3485 
3485    
3486  =head3 MyGenomes  =head3 MyGenomes
3487    
3488  C<< my @genomes = Sprout::MyGenomes($dataDir); >>      my @genomes = Sprout::MyGenomes($dataDir);
3489    
3490  Return a list of the genomes to be included in the Sprout.  Return a list of the genomes to be included in the Sprout.
3491    
# Line 3443  Line 3517 
3517    
3518  =head3 LoadFileName  =head3 LoadFileName
3519    
3520  C<< my $fileName = Sprout::LoadFileName($dataDir, $tableName); >>      my $fileName = Sprout::LoadFileName($dataDir, $tableName);
3521    
3522  Return the name of the load file for the specified table in the specified data  Return the name of the load file for the specified table in the specified data
3523  directory.  directory.
# Line 3484  Line 3558 
3558    
3559  =head3 DeleteGenome  =head3 DeleteGenome
3560    
3561  C<< my $stats = $sprout->DeleteGenome($genomeID, $testFlag); >>      my $stats = $sprout->DeleteGenome($genomeID, $testFlag);
3562    
3563  Delete a genome from the database.  Delete a genome from the database.
3564    
# Line 3520  Line 3594 
3594    
3595  =head3 Fix  =head3 Fix
3596    
3597  C<< my %fixedHash = Sprout::Fix(%groupHash); >>      my %fixedHash = $sprout->Fix(%groupHash);
3598    
3599  Prepare a genome group hash (like that returned by L</GetGroups>) for processing.  Prepare a genome group hash (like that returned by L</GetGroups>) for processing.
3600  Groups with the same primary name will be combined. The primary name is the  The groups will be combined into the appropriate super-groups.
 first capitalized word in the group name.  
3601    
3602  =over 4  =over 4
3603    
# Line 3542  Line 3615 
3615    
3616  sub Fix {  sub Fix {
3617      # Get the parameters.      # Get the parameters.
3618      my (%groupHash) = @_;      my ($self, %groupHash) = @_;
3619      # Create the result hash.      # Create the result hash.
3620      my %retVal = ();      my %retVal = ();
3621        # Get the super-group table.
3622        my %superTable = $self->CheckGroupFile();
3623      # Copy over the genomes.      # Copy over the genomes.
3624      for my $groupID (keys %groupHash) {      for my $groupID (keys %groupHash) {
3625          # Make a safety copy of the group ID.          # Get the super-group name.
3626          my $realGroupID = $groupID;          my $realGroupID;
         # Yank the primary name.  
3627          if ($groupID =~ /([A-Z]\w+)/) {          if ($groupID =~ /([A-Z]\w+)/) {
3628              $realGroupID = $1;              my $sortOfGroup = $1;
3629                if (! defined($superTable{$1})) {
3630                    Confess("Super-group name not found for group $groupID.");
3631                } else {
3632                    $realGroupID = $superTable{$1}->{superGroup};
3633                }
3634            } else {
3635                Confess("Invalid group name $groupID.");
3636          }          }
3637          # Append this group's genomes into the result hash.          # Append this group's genomes into the result hash.
3638          Tracer::AddToListMap(\%retVal, $realGroupID, @{$groupHash{$groupID}});          push @{$retVal{$realGroupID}}, @{$groupHash{$groupID}};
3639      }      }
3640      # Return the result hash.      # Return the result hash.
3641      return %retVal;      return %retVal;
# Line 3562  Line 3643 
3643    
3644  =head3 GroupPageName  =head3 GroupPageName
3645    
3646  C<< my $name = $sprout->GroupPageName($group); >>      my $name = $sprout->GroupPageName($group);
3647    
3648  Return the name of the page for the specified NMPDR group.  Return the name of the page for the specified NMPDR group.
3649    
# Line 3587  Line 3668 
3668      # Declare the return variable.      # Declare the return variable.
3669      my $retVal;      my $retVal;
3670      # Check for the group file data.      # Check for the group file data.
3671      if (! defined $self->{groupHash}) {      my %superTable = $self->CheckGroupFile();
         # Read the group file.  
         my %groupData = Sprout::ReadGroupFile($self->{_options}->{dataDir} . "/groups.tbl");  
         # Store it in our object.  
         $self->{groupHash} = \%groupData;  
     }  
3672      # Compute the real group name.      # Compute the real group name.
3673      my $realGroup = $group;      my ($realGroup, $pageLink);
3674      if ($group =~ /([A-Z]\w+)/) {      if ($group =~ /([A-Z]\w+)/) {
3675          $realGroup = $1;          my $sortOfGroup = $1;
3676            if (! defined($superTable{$1})) {
3677                Confess("No sort-of group found for \"$group\".");
3678            } else {
3679                $pageLink = $superTable{$1}->{page};
3680            }
3681        } else {
3682            Confess("\"group\" is not a valid group name.");
3683      }      }
3684      # Return the page name.      # Return the page name.
3685      $retVal = "../content/" . $self->{groupHash}->{$realGroup}->[1];      $retVal = "../content/" . $pageLink;
3686      # Return the result.      # Return the result.
3687      return $retVal;      return $retVal;
3688  }  }
3689    
 =head3 ReadGroupFile  
   
 C<< my %groupData = Sprout::ReadGroupFile($groupFileName); >>  
   
 Read in the data from the specified group file. The group file contains information  
 about each of the NMPDR groups.  
   
 =over 4  
   
 =item name  
3690    
3691  Name of the group.  =head3 AddProperty
   
 =item page  
   
 Name of the group's page on the web site (e.g. C<campy.php> for  
 Campylobacter)  
   
 =item genus  
   
 Genus of the group  
3692    
3693  =item species      $sprout->AddProperty($featureID, $key, @values);
3694    
3695  Species of the group, or an empty string if the group is for an entire  Add a new attribute value (Property) to a feature.
 genus. If the group contains more than one species, the species names  
 should be separated by commas.  
3696    
3697  =back  =over 4
3698    
3699  The parameters to this method are as follows  =item peg
3700    
3701  =over 4  ID of the feature to which the attribute is to be added.
3702    
3703  =item groupFile  =item key
3704    
3705  Name of the file containing the group data.  Name of the attribute (key).
3706    
3707  =item RETURN  =item values
3708    
3709  Returns a hash keyed on group name. The value of each hash  Values of the attribute.
3710    
3711  =back  =back
3712    
3713  =cut  =cut
3714    #: Return Type ;
3715  sub ReadGroupFile {  sub AddProperty {
3716      # Get the parameters.      # Get the parameters.
3717      my ($groupFileName) = @_;      my ($self, $featureID, $key, @values) = @_;
3718      # Declare the return variable.      # Add the property using the attached attributes object.
3719      my %retVal;      $self->{_ca}->AddAttribute($featureID, $key, @values);
     # Read the group file.  
     my @groupLines = Tracer::GetFile($groupFileName);  
     for my $groupLine (@groupLines) {  
         my ($name, $page, $genus, $species) = split(/\t/, $groupLine);  
         $retVal{$name} = [$page, $genus, $species];  
     }  
     # Return the result.  
     return %retVal;  
3720  }  }
3721    
3722  =head3 AddProperty  =head3 CheckGroupFile
3723    
3724  C<< my  = $sprout->AddProperty($featureID, $key, @values); >>      my %groupData = $sprout->CheckGroupFile();
3725    
3726  Add a new attribute value (Property) to a feature.  Get the group file hash. The group file hash describes the relationship
3727    between a group and the super-group to which it belongs for purposes of
3728    display. The super-group name is computed from the sort-of group name,
3729    which is the first capitalized word in the actual group name. For each
3730    sort-of group, the group file contains the super-group name, the group
3731    genus, the list of applicable species (if any), and the name of the NMPDR
3732    display page for the super-group.
3733    
3734    This method returns a hash from sort-of group names to hash reference. Each
3735    resulting hash reference contains the following fields.
3736    
3737  =over 4  =over 4
3738    
3739  =item peg  =item superGroup
3740    
3741  ID of the feature to which the attribute is to be added.  Super-group name.
3742    
3743  =item key  =item page
3744    
3745  Name of the attribute (key).  The super-group's web page in the NMPDR.
3746    
3747  =item values  =item genus
3748    
3749  Values of the attribute.  The genus of the sort-of group.
3750    
3751    =item species
3752    
3753    A reference to a list of the species for the sort-of group.
3754    
3755  =back  =back
3756    
3757  =cut  =cut
3758  #: Return Type ;  
3759  sub AddProperty {  sub CheckGroupFile{
3760      # Get the parameters.      # Get the parameters.
3761      my ($self, $featureID, $key, @values) = @_;      my ($self) = @_;
3762      # Add the property using the attached attributes object.      # Check to see if we already have this hash.
3763      $self->{_ca}->AddAttribute($featureID, $key, @values);      if (! defined $self->{groupHash}) {
3764            # We don't, so we need to read it in.
3765            my %groupHash;
3766            # Read the group file.
3767            my @groupLines = Tracer::GetFile("$FIG_Config::sproutData/groups.tbl");
3768            # Loop through the list of sort-of groups.
3769            for my $groupLine (@groupLines) {
3770                my ($mainName, $name, $page, $genus, $species) = split(/\t/, $groupLine);
3771                $groupHash{$name} = { page => $page,
3772                                   genus => $genus,
3773                                   species => [ split(/\s*,\s*/, $species) ],
3774                                   superGroup => $mainName };
3775            }
3776            # Save the hash.
3777            $self->{groupHash} = \%groupHash;
3778        }
3779        # Return the result.
3780        return %{$self->{groupHash}};
3781  }  }
3782    
3783  =head2 Virtual Methods  =head2 Virtual Methods
3784    
3785  =head3 CleanKeywords  =head3 CleanKeywords
3786    
3787  C<< my $cleanedString = $sprout->CleanKeywords($searchExpression); >>      my $cleanedString = $sprout->CleanKeywords($searchExpression);
3788    
3789  Clean up a search expression or keyword list. This involves converting the periods  Clean up a search expression or keyword list. This involves converting the periods
3790  in EC numbers to underscores, converting non-leading minus signs to underscores,  in EC numbers to underscores, converting non-leading minus signs to underscores,
# Line 3750  Line 3834 
3834    
3835  A functional assignment is always of the form  A functional assignment is always of the form
3836    
3837      C<set >I<YYYY>C< function to\n>I<ZZZZZ>      set YYYY function to
3838        ZZZZ
3839    
3840  where I<YYYY> is the B<user>, and I<ZZZZ> is the actual functional role. In most cases,  where I<YYYY> is the B<user>, and I<ZZZZ> is the actual functional role. In most cases,
3841  the user and the assigning user (from MadeAnnotation) will be the same, but that is  the user and the assigning user (from MadeAnnotation) will be the same, but that is
# Line 3805  Line 3890 
3890    
3891  =head3 _CheckFeature  =head3 _CheckFeature
3892    
3893  C<< my $flag = $sprout->_CheckFeature($fid); >>      my $flag = $sprout->_CheckFeature($fid);
3894    
3895  Return TRUE if the specified FID is probably an NMPDR feature ID, else FALSE.  Return TRUE if the specified FID is probably an NMPDR feature ID, else FALSE.
3896    

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.102

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3