2.17.2: 2011-06-17

net.sf.basedb.util
Class IntensityCalculatorUtil

java.lang.Object
  extended by 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: 2010-02-03 19:33:55 +0100 (Wed, 03 Feb 2010) $

Nested Class Summary
private static class IntensityCalculatorUtil.JepIntensityCalculatorImpl
          An implementation of the IntensityCalculator interface using JEP expressions.
 
Constructor Summary
IntensityCalculatorUtil()
           
 
Method Summary
static boolean checkSameArrayDesign(Collection<RawBioAssay> rawBioAssays, boolean throwException)
           
static Expression[] createJepExpressions(DbControl dc, RawDataType rawDataType, String[] formulas)
           
static IntensityCalculator createJepIntensityCalculator(DbControl dc, RawDataType rawDataType, String... jepFormulas)
          Create an intensity calculator from mathematical expressions in strings.
static BioAssaySet createRootBioAssaySet(DbControl dc, Experiment experiment, Collection<RawBioAssay> rawBioAssays, Job job, Expression[] intensities, ProgressReporter progress)
          Create a root bioassayset for a given experiment and set of raw bioassays.
static BioAssaySet createRootBioAssaySet(DbControl dc, Experiment experiment, Collection<RawBioAssay> rawBioAssays, Job job, IntensityCalculator iCalc, ProgressReporter progress)
          Create a root bioassayset for a given experiment and set of raw bioassays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntensityCalculatorUtil

public IntensityCalculatorUtil()
Method Detail

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)

2.17.2: 2011-06-17