[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.17, Mon Jun 27 20:00:55 2005 UTC revision 1.18, Tue Jun 28 21:34:15 2005 UTC
# Line 86  Line 86 
86      # Compute the options. We do this by starting with a table of defaults and overwriting with      # Compute the options. We do this by starting with a table of defaults and overwriting with
87      # the incoming data.      # the incoming data.
88      my $optionTable = Tracer::GetOptions({      my $optionTable = Tracer::GetOptions({
89                         dbType       => 'mysql',         # database type                         dbType       => $FIG_Config::dbms,
90                         dataDir      => 'Data',          # data file directory                                                          # database type
91                         xmlFileName  => 'SproutDBD.xml', # database definition file name                         dataDir      => $FIG_Config::sproutData,
92                         userData     => 'root/',         # user name and password                                                          # data file directory
93                         port         => 0,               # database connection port                         xmlFileName  => "$FIG_Config::sproutData/SproutDBD.xml",
94                                                            # database definition file name
95                           userData     => "$FIG_Config::dbuser/$FIG_Config::dbpass",
96                                                            # user name and password
97                           port         => $FIG_Config::dbport,
98                                                            # database connection port
99                         maxSegmentLength => 4500,        # maximum feature segment length                         maxSegmentLength => 4500,        # maximum feature segment length
100                         maxSequenceLength => 8000,       # maximum contig sequence length                         maxSequenceLength => 8000,       # maximum contig sequence length
101                        }, $options);                        }, $options);
# Line 420  Line 425 
425      # Loop through the incoming table names.      # Loop through the incoming table names.
426      for my $tableName (@{$tableList}) {      for my $tableName (@{$tableList}) {
427          # Find the table's file.          # Find the table's file.
428          my $fileName = "$dataDir/$tableName";          my $fileName = LoadFileName($dataDir, $tableName);
429          if (! -e $fileName) {          if (! $fileName) {
430              $fileName = "$fileName.dtx";              Trace("No load file found for $tableName in $dataDir.") if T(0);
431          }          } else {
432          # Attempt to load this table.          # Attempt to load this table.
433          my $result = $erdb->LoadTable($fileName, $tableName, $truncateFlag);          my $result = $erdb->LoadTable($fileName, $tableName, $truncateFlag);
434          # Accumulate the resulting statistics.          # Accumulate the resulting statistics.
435          $retVal->Accumulate($result);          $retVal->Accumulate($result);
436      }      }
437        }
438      # Return the statistics.      # Return the statistics.
439      return $retVal;      return $retVal;
440  }  }
# Line 1506  Line 1512 
1512      my ($self, $peg1, $peg2) = @_;      my ($self, $peg1, $peg2) = @_;
1513      # Declare the return variable.      # Declare the return variable.
1514      my @retVal = ();      my @retVal = ();
1515      # Our first task is to find out the nature of the coupling.      # Our first task is to find out the nature of the coupling: whether or not
1516        # it exists, its score, and whether the features are stored in the same
1517        # order as the ones coming in.
1518      my ($couplingID, $inverted, $score) = $self->GetCoupling($peg1, $peg2);      my ($couplingID, $inverted, $score) = $self->GetCoupling($peg1, $peg2);
1519      # Only proceed if a coupling exists.      # Only proceed if a coupling exists.
1520      if ($couplingID) {      if ($couplingID) {
1521          # Determine the ordering to place on the evidence items. If we're          # Determine the ordering to place on the evidence items. If we're
1522          # inverted, we want to see feature 2 before feature 1; otherwise,          # inverted, we want to see feature 2 before feature 1 (descending); otherwise,
1523          # we want the reverse.          # we want feature 1 before feature 2 (normal).
1524          my $ordering = ($inverted ? "DESC" : "");          my $ordering = ($inverted ? "DESC" : "");
1525          # Get the coupling evidence.          # Get the coupling evidence.
1526          my @evidenceList = $self->GetAll(['IsEvidencedBy', 'PCH', 'UsesAsEvidence'],          my @evidenceList = $self->GetAll(['IsEvidencedBy', 'PCH', 'UsesAsEvidence'],
# Line 1529  Line 1537 
1537              push @retVal, [$peg1Data->[1], $peg2Data->[1], $peg1Data->[0]];              push @retVal, [$peg1Data->[1], $peg2Data->[1], $peg1Data->[0]];
1538          }          }
1539      }      }
     # TODO: code  
1540      # Return the result.      # Return the result.
1541      return @retVal;      return @retVal;
1542  }  }
# Line 2896  Line 2903 
2903      return %retVal;      return %retVal;
2904  }  }
2905    
2906    =head3 MyGenomes
2907    
2908    C<< my @genomes = Sprout::MyGenomes($dataDir); >>
2909    
2910    Return a list of the genomes to be included in the Sprout.
2911    
2912    This method is provided for use during the Sprout load. It presumes the Genome load file has
2913    already been created. (It will be in the Sprout data directory and called either C<Genome>
2914    or C<Genome.dtx>.) Essentially, it reads in the Genome load file and strips out the genome
2915    IDs.
2916    
2917    =over 4
2918    
2919    =item dataDir
2920    
2921    Directory containing the Sprout load files.
2922    
2923    =back
2924    
2925    =cut
2926    #: Return Type @;
2927    sub MyGenomes {
2928        # Get the parameters.
2929        my ($dataDir) = @_;
2930        # Compute the genome file name.
2931        my $genomeFileName = LoadFileName($dataDir, "Genome");
2932        # Extract the genome IDs from the files.
2933        my @retVal = map { $_ =~ /^(\S+)/; $1 } Tracer::GetFile($genomeFileName);
2934        # Return the result.
2935        return @retVal;
2936    }
2937    
2938    =head3 LoadFileName
2939    
2940    C<< my $fileName = Sprout::LoadFileName($dataDir, $tableName); >>
2941    
2942    Return the name of the load file for the specified table in the specified data
2943    directory.
2944    
2945    =over 4
2946    
2947    =item dataDir
2948    
2949    Directory containing the Sprout load files.
2950    
2951    =item tableName
2952    
2953    Name of the table whose load file is desired.
2954    
2955    =item RETURN
2956    
2957    Returns the name of the file containing the load data for the specified table, or
2958    C<undef> if no load file is present.
2959    
2960    =back
2961    
2962    =cut
2963    #: Return Type $;
2964    sub LoadFileName {
2965        # Get the parameters.
2966        my ($dataDir, $tableName) = @_;
2967        # Declare the return variable.
2968        my $retVal;
2969        # Check for the various file names.
2970        if (-e "$dataDir/$tableName") {
2971            $retVal = "$dataDir/$tableName";
2972        } elsif (-e "$dataDir/$tableName.dtx") {
2973            $retVal = "$dataDir/$tableName.dtx";
2974        }
2975        # Return the result.
2976        return $retVal;
2977    }
2978    
2979  =head2 Internal Utility Methods  =head2 Internal Utility Methods
2980    
2981  =head3 ParseAssignment  =head3 ParseAssignment

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3