Class IntensityCalculatorUtil

java.lang.Object
net.sf.basedb.util.IntensityCalculatorUtil

public class IntensityCalculatorUtil
extends Object
This is a utility class for plugins that calculate intensities from raw spot data.
Version:
2.0
Author:
Nicklas
Last modified
$Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
  • Constructor Details

    • IntensityCalculatorUtil

      public IntensityCalculatorUtil()
  • Method Details

    • checkSameArrayDesign

      public static boolean checkSameArrayDesign​(Collection<RawBioAssay> rawBioAssays, boolean throwException)
    • createRootBioAssaySet

      public static BioAssaySet createRootBioAssaySet​(DbControl dc, Experiment experiment, Collection<RawBioAssay> rawBioAssays, Job job, Expression[] intensities, ProgressReporter progress) throws InvalidDataException, BaseException
      Create a root bioassayset for a given experiment and set of raw bioassays. The raw bioassays must be part of the experiment. The intensities for the bioassays in the new bioassayset are calculated by adding Query API Expression objects to a DynamicRawDataQuery. This method is very fast since most of the work is done on the database only.

      This method can only be used if all raw bioassays are connected to the same ArrayDesign (which must have features), since it doesn't supports remapping of the position numbers.

      Parameters:
      dc - The DbControl object to use for database acecss
      experiment - The experiment where the new bioassayset should be placed
      rawBioAssays - The raw bioassays to create bioassays for, or null to use all raw bioassays
      job - The job that the transformation should be linked to, or null if this method isn't called by a job
      intensities - An array containing the expressions for calculating the intensities, one for each channel
      progress - Optional progress reporter if the caller is interested in the progress
      Returns:
      A BioAssaySet object.
      Throws:
      InvalidDataException - If any of the required parameters is null or if the raw bioassays arn't using the same array design or if the number of intensity expressions doesn't match the number of channels
      BaseException - If anything else goes wrong in the process.
    • createRootBioAssaySet

      public static BioAssaySet createRootBioAssaySet​(DbControl dc, Experiment experiment, Collection<RawBioAssay> rawBioAssays, Job job, IntensityCalculator iCalc, ProgressReporter progress) throws InvalidDataException, BaseException
      Create a root bioassayset for a given experiment and set of raw bioassays. The raw bioassays must be part of the experiment. The intensities for the bioassays in the new bioassayset are calculated by a IntensityCalculator object. This method is not as fast as the other createRootBioAssay method since all raw data must be loaded into memory and the inserted into the database one row at a time.

      On the other hand, this method supports remapping of the position numbers so it is not necessary for all raw bioassays to use the same array design.

      Parameters:
      dc - The DbControl object to use for database acecss
      experiment - The experiment where the new bioassayset should be placed
      rawBioAssays - The raw bioassays to create bioassays for, or null to use all raw bioassays
      job - The job that the transformation should be linked to, or null if this method isn't called by a job
      iCalc - An object implementing the IntensityCalculator interface
      progress - A progress reporter object, or null if the caller isn't interested in the progress
      Returns:
      A BioAssaySet object
      Throws:
      InvalidDataException - If any of the required parameters is null.
      BaseException - If there is another error.
    • createJepIntensityCalculator

      public static IntensityCalculator createJepIntensityCalculator​(DbControl dc, RawDataType rawDataType, String... jepFormulas) throws InvalidDataException, BaseException
      Create an intensity calculator from mathematical expressions in strings. The expressions may contain most regular mathematical operators, including +, -, / , *, ln. Use the name of a raw() function to include the value of that property, or the mean() function to include the mean of a property (over the whole data set). Examples of valid expressions are (assuming that the properties has been defined for the raw data type in question; see RawDataType.getProperties()):
      raw('ch1FgMean') - raw('ch1BgMean')
      raw('ch1FgMedian') - mean('ch1BgMedian')
      
      Parameters:
      dc - The DbControl used for database access
      rawDataType - The raw data type to create the intensity calculator for. Null is not allowed.
      jepFormulas - The mathematical expressions in a form supported by JEP, one expression is required for each channel. Null is not allowed
      Returns:
      An intensity calculator object
      Throws:
      InvalidDataException - If any of the required arguments is null or if the formulas length does not match the number of channels.
      BaseException - If there is another error.
      See Also:
      RawDataType.getIntensityFormulas(), IntensityFormula, Jep
    • createJepExpressions

      public static Expression[] createJepExpressions​(DbControl dc, RawDataType rawDataType, String[] formulas)