halflife
Class HalfLife

java.lang.Object
  extended by halflife.HalfLife
Direct Known Subclasses:
HalfLife_EU, HalfLife_New, HalfLife_Pre

public abstract class HalfLife
extends java.lang.Object

Calculation of Half Lives and median-based Correction Factors

Author:
Stefanie Kaufmann

Constructor Summary
HalfLife()
          Constructs a HalfLife object with default Alpha
 
Method Summary
abstract  CorrectionFactors calculateCorrectionFactors(double medianHWZ, double t)
          Calculation of correction factors based on a median
abstract  void calculateHalfLives(int t)
          Calculation of Half lives
 void filterValues()
          filters out half life values that are below 0 or NaN
 Alpha getAlpha()
          Returns the alpha object defining the calculation method of alpha
 double getC_l()
          Returns the correction factor c_l
 double getC_u()
          Returns the correction factor c_u
 Data getData()
          Returns the data object holding the original data
 double[] getHwz()
          Returns the half life values
 Mapping<java.lang.String,java.lang.Integer> getNewMapping()
          Returns the mapping corresponding to ratios/half lives
 double[] getRatio()
          Returns the ratio values
 int getReplikat()
          Returns the number of the used replicate
abstract  void initialize(Data data)
          initializes the HalfLife object & extracts the needed values of the Data object
abstract  void initialize(Data data, int replicate)
          initializes the HalfLife object for a specific replicate of the data
static double median(double[] inp)
          Calculation of the median of a single dimensional array
 double[] ratioOfReplicate(double[][] rna, double[][] total)
          Calculates the ratio of a specific replicate
 void setAlpha(Alpha alpha)
          Sets the Alpha object defining the method for calculation of alpha(t)
abstract  void setCorrectionFactor(CorrectionFactors corr)
          Sets the set of correction factors
 void setCorrectionFactors(double c_u, double c_l)
          Sets the correction factors c_u and c_l
 void setHwz(double[] hwz)
          Sets the half life values
 void setNewMap(Mapping<java.lang.String,java.lang.Integer> newMap)
          Sets the mapping corresponding to the ratio values
 void writeToFileHalfLives(java.lang.String output)
          Writes the half life values contained in the object together with corresponding spotIds into a file
 void writeToFileRatios(java.lang.String output)
          Writes Ratio array into a file with two columns: column 1: spotid, column 2: corresponding ratio
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HalfLife

public HalfLife()
Constructs a HalfLife object with default Alpha

Method Detail

initialize

public abstract void initialize(Data data)
initializes the HalfLife object & extracts the needed values of the Data object

Parameters:
data - The data object for which the HalfLife calculation shall be done

initialize

public abstract void initialize(Data data,
                                int replicate)
initializes the HalfLife object for a specific replicate of the data

Parameters:
data - The data object for which the HalfLife calculation shall be done
replicate - The replicate that shall be used

calculateHalfLives

public abstract void calculateHalfLives(int t)
Calculation of Half lives

Parameters:
t - Time

calculateCorrectionFactors

public abstract CorrectionFactors calculateCorrectionFactors(double medianHWZ,
                                                             double t)
Calculation of correction factors based on a median

Parameters:
medianHWZ - median mRNA Half life
t - Time
Returns:
CorrectionFactors c_u and c_l

median

public static double median(double[] inp)
Calculation of the median of a single dimensional array

Parameters:
inp - The array for which the median shall be calculated
Returns:
Median value

filterValues

public void filterValues()
filters out half life values that are below 0 or NaN


ratioOfReplicate

public double[] ratioOfReplicate(double[][] rna,
                                 double[][] total)
Calculates the ratio of a specific replicate

Parameters:
rna - Set of RNA values serving as numerator
total - Set of RNA values serving as denominator
Returns:
The ratio of the two sets of RNA restricted to a single replicate

writeToFileHalfLives

public void writeToFileHalfLives(java.lang.String output)
Writes the half life values contained in the object together with corresponding spotIds into a file

Parameters:
output - Name of output file

writeToFileRatios

public void writeToFileRatios(java.lang.String output)
Writes Ratio array into a file with two columns: column 1: spotid, column 2: corresponding ratio

Parameters:
output -

setNewMap

public void setNewMap(Mapping<java.lang.String,java.lang.Integer> newMap)
Sets the mapping corresponding to the ratio values

Parameters:
newMap - The mapping corresponding to the ratios

setAlpha

public void setAlpha(Alpha alpha)
Sets the Alpha object defining the method for calculation of alpha(t)

Parameters:
alpha - The alpha object

setCorrectionFactor

public abstract void setCorrectionFactor(CorrectionFactors corr)
Sets the set of correction factors

Parameters:
corr - The correction factors

setHwz

public void setHwz(double[] hwz)
Sets the half life values

Parameters:
hwz - The half life values

setCorrectionFactors

public void setCorrectionFactors(double c_u,
                                 double c_l)
Sets the correction factors c_u and c_l

Parameters:
c_u - The correction factor c_u
c_l - The correction factor c_l

getAlpha

public Alpha getAlpha()
Returns the alpha object defining the calculation method of alpha

Returns:
The alpha object

getC_l

public double getC_l()
Returns the correction factor c_l

Returns:
The correction factor c_l

getC_u

public double getC_u()
Returns the correction factor c_u

Returns:
The correction factor c_u

getNewMapping

public Mapping<java.lang.String,java.lang.Integer> getNewMapping()
Returns the mapping corresponding to ratios/half lives

Returns:
The mapping corresponding to ratios and half life values

getData

public Data getData()
Returns the data object holding the original data

Returns:
The data object

getHwz

public double[] getHwz()
Returns the half life values

Returns:
The half life values

getRatio

public double[] getRatio()
Returns the ratio values

Returns:
The ratio values

getReplikat

public int getReplikat()
Returns the number of the used replicate

Returns:
The number of the replicate