Package net.sf.basedb.util
Class IntensityCalculatorUtil
java.lang.Object
net.sf.basedb.util.IntensityCalculatorUtil
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) $
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
An implementation of theIntensityCalculator
interface using JEP expressions. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
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 APIExpression
objects to aDynamicRawDataQuery
. 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
- TheDbControl
object to use for database acecssexperiment
- The experiment where the new bioassayset should be placedrawBioAssays
- The raw bioassays to create bioassays for, or null to use all raw bioassaysjob
- The job that the transformation should be linked to, or null if this method isn't called by a jobintensities
- An array containing the expressions for calculating the intensities, one for each channelprogress
- 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 channelsBaseException
- 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 aIntensityCalculator
object. This method is not as fast as the othercreateRootBioAssay
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
- TheDbControl
object to use for database acecssexperiment
- The experiment where the new bioassayset should be placedrawBioAssays
- The raw bioassays to create bioassays for, or null to use all raw bioassaysjob
- The job that the transformation should be linked to, or null if this method isn't called by a jobiCalc
- An object implementing theIntensityCalculator
interfaceprogress
- 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; seeRawDataType.getProperties()
):raw('ch1FgMean') - raw('ch1BgMean') raw('ch1FgMedian') - mean('ch1BgMedian')
- Parameters:
dc
- The DbControl used for database accessrawDataType
- 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:
-
createJepExpressions
public static Expression[] createJepExpressions(DbControl dc, RawDataType rawDataType, String[] formulas)
-