[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.103, Fri Dec 7 18:30:14 2007 UTC revision 1.106, Wed Feb 6 23:21:02 2008 UTC
# Line 78  Line 78 
78    
79  * B<noDBOpen> suppresses the connection to the database if TRUE, else FALSE  * B<noDBOpen> suppresses the connection to the database if TRUE, else FALSE
80    
81    * B<host> name of the database host
82    
83  =back  =back
84    
85  For example, the following constructor call specifies a database named I<Sprout> and a user name of  For example, the following constructor call specifies a database named I<Sprout> and a user name of
86  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
87  F</usr/fig/SproutData>.  F</usr/fig/SproutData>.
88    
89      my $sprout = Sprout->new('Sprout', { userData =>; 'fig/admin', dataDir => '/usr/fig/SproutData' });      my $sprout = Sprout->new('Sprout', { userData => 'fig/admin', dataDir => '/usr/fig/SproutData' });
90    
91  =cut  =cut
92    
# Line 108  Line 110 
110                         port         => $FIG_Config::dbport,                         port         => $FIG_Config::dbport,
111                                                          # database connection port                                                          # database connection port
112                         sock         => $FIG_Config::dbsock,                         sock         => $FIG_Config::dbsock,
113                         host         => $FIG_Config::dbhost,                         host         => $FIG_Config::sprout_host,
114                         maxSegmentLength => 4500,        # maximum feature segment length                         maxSegmentLength => 4500,        # maximum feature segment length
115                         maxSequenceLength => 8000,       # maximum contig sequence length                         maxSequenceLength => 8000,       # maximum contig sequence length
116                         noDBOpen     => 0,               # 1 to suppress the database open                         noDBOpen     => 0,               # 1 to suppress the database open
# Line 121  Line 123 
123      # Connect to the database.      # Connect to the database.
124      my $dbh;      my $dbh;
125      if (! $optionTable->{noDBOpen}) {      if (! $optionTable->{noDBOpen}) {
126            Trace("Connect data: host = $optionTable->{host}, port = $optionTable->{port}.") if T(3);
127          $dbh = DBKernel->new($optionTable->{dbType}, $dbName, $userName,          $dbh = DBKernel->new($optionTable->{dbType}, $dbName, $userName,
128                                  $password, $optionTable->{port}, $optionTable->{host}, $optionTable->{sock});                                  $password, $optionTable->{port}, $optionTable->{host}, $optionTable->{sock});
129      }      }
# Line 147  Line 150 
150      return $retVal;      return $retVal;
151  }  }
152    
153    =head3 RealCoreGenomes
154    
155        my @genomes = $sprout->RealCoreGenomes();
156    
157    Return the IDs of the original core NMPDR genomes. These are the ones
158    in the major groups indicated in the C<@realCoreGroups> member of the
159    B<FIG_Config> file.
160    
161    =cut
162    
163    sub RealCoreGenomes {
164        # Get the parameters.
165        my ($self) = @_;
166        # Declare the return variable.
167        my @retVal = ();
168        # Get the hash of all the genome groups.
169        my %groups = $self->GetGroups();
170        # Loop through the groups, keeping the ones that belong to real core
171        # organisms.
172        for my $group (keys %groups) {
173            if (grep { $group =~ /$_/ } @FIG_Config::realCoreGroups) {
174                push @retVal, @{$groups{$group}};
175            }
176        }
177        # Return the result.
178        return @retVal;
179    }
180    
181  =head3 MaxSegment  =head3 MaxSegment
182    
183      my $length = $sprout->MaxSegment();      my $length = $sprout->MaxSegment();
# Line 267  Line 298 
298              Trace("No load file found for $tableName in $dataDir.") if T(0);              Trace("No load file found for $tableName in $dataDir.") if T(0);
299          } else {          } else {
300              # Attempt to load this table.              # Attempt to load this table.
301              my $result = $self->LoadTable($fileName, $tableName, $truncateFlag);              my $result = $self->LoadTable($fileName, $tableName, truncate => $truncateFlag);
302              # Accumulate the resulting statistics.              # Accumulate the resulting statistics.
303              $retVal->Accumulate($result);              $retVal->Accumulate($result);
304          }          }
# Line 3039  Line 3070 
3070          my ($taxonomy) = $self->GetFlat(['IsLocatedIn', 'HasContig', 'Genome'], "IsLocatedIn(from-link) = ?",          my ($taxonomy) = $self->GetFlat(['IsLocatedIn', 'HasContig', 'Genome'], "IsLocatedIn(from-link) = ?",
3071                                          [$fid], 'Genome(taxonomy)');                                          [$fid], 'Genome(taxonomy)');
3072          # Add this feature to the hash buffer.          # Add this feature to the hash buffer.
3073          Tracer::AddToListMap(\%hashBuffer, $taxonomy, $fid);          push @{$hashBuffer{$taxonomy}}, $fid;
3074      }      }
3075      # Sort the keys and get the elements.      # Sort the keys and get the elements.
3076      my @retVal = ();      my @retVal = ();

Legend:
Removed from v.1.103  
changed lines
  Added in v.1.106

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3