data
Class Data

java.lang.Object
  extended by data.Data

public class Data
extends java.lang.Object

Reading and containing RNA values from an input file and providing methods for the calculation of RNA ratios as well as methods to save the filtered values to a file

Author:
Stefanie Kaufmann

Field Summary
static java.lang.String absent
           
static java.lang.String absentLabel
           
static int AVERAGEFIRST
           
static java.lang.String geneName
           
static int RATIOFIRST
           
static java.lang.String spotid
           
 
Constructor Summary
Data(double[][] totalRNA, double[][] newRNA, double[][] preRNA, java.lang.String[] totalDescr, java.lang.String[] newDescr, java.lang.String[] preDescr, Mapping<java.lang.String,java.lang.Integer> map)
          Constructs a Data-Object based on already existing data
Data(java.lang.String file, java.util.List<java.lang.String> columnsTotal, java.util.List<java.lang.String> columnsNew, java.util.List<java.lang.String> columnsPre)
          Constructs a Data-Object based on an Input-File and the list of columns to be read with no additional attributes
Data(java.lang.String file, java.util.List<java.lang.String> columnsTotal, java.util.List<java.lang.String> columnsNew, java.util.List<java.lang.String> columnsPre, java.util.List<java.lang.String> attr)
          Constructs a Data-Object based on an Input-File and the list of columns to be read, defines columns containing attributes
 
Method Summary
 void addAttributes(java.lang.String inputfile)
          Reads in a file containing two columns: column 1: spotID, column2: attribute (e.g. gene name) The resulting Mapping is added to the List attrMaps and accessible over the index received from attrMapsDescr, where the name of the column is stored
 double[] calculateAverageFirst(double[][] rna, double[][] total)
          calculates the average values from all replicates for the linear regression calculates the ratio of the averages (AVERAGEFIRST method)
 Mapping<java.lang.String,java.lang.Integer> calculateNewMapping()
          Calculates the Mapping corresponding to the ratio
 double[] calculateRatio(double[][] rna, double[][] total)
          Calculates filtered Ratio of a set of RNA values (e.g. newly transcribed RNA) to a second set of values (e.g. total RNA) based on the specified method to calculate the average of multiple replicates.
 double[] calculateRatioFirst(double[][] allRatio)
          calculates the average values from all replicates for the linear regression calculates the average of the ratios (RATIOFIRST method)
 Mapping<java.lang.String,java.lang.Integer> copyMap()
          Copies the content of the Mapping object
 double evaluate(java.lang.String fasta, int column)
          Method for the Uracil-based evaluation of the values
 java.lang.String[] getAttrDescr()
          Returns the description of the attributes
 java.util.ArrayList<Mapping<java.lang.String,java.lang.String>> getAttributes()
          Returns the attribute lists
 double getAvgLo()
          Returns the average log(e'/n')
 double getAvgUr()
          Returns the average number of Uracil
 java.lang.String getFilename()
          Returns the name of the file containing the data
 Mapping<java.lang.String,java.lang.Integer> getMap()
          Returns the map corresponding to the data
 java.lang.String[] getNewDescr()
          Returns the description = column labels of newly transcribed RNA
 double[][] getNewRNA()
          Returns all the values for newly transcribed RNA
 int getNumberExperiments()
          Returns the number of measured experiments (not changeable through filtering!)
 java.lang.String getPlotName()
          Returns the name of the file into which evaluation results will be printed as a plotable table
 double[] getPqs()
          Returns the probe set quality scores
 java.lang.String[] getPreDescr()
          Returns the description = column labels of pre-existing RNA
 double[][] getPreRNA()
          Returns all the values for pre-existing RNA
 java.lang.String[] getTotalDescr()
          Returns the description = column labels of total RNA
 double[][] getTotalRNA()
          Returns all the values for total RNA
 void readInput(java.lang.String file, java.util.List<java.lang.String> columnsTotal, java.util.List<java.lang.String> columnsNew, java.util.List<java.lang.String> columnsPre, java.util.List<java.lang.String> addit)
          Takes an input file, reads the values and saves them in the class variables of the Data object
 double[] restrictRatio(double[][] input, int replicate)
          Restricts a multidimensional array onto an array with one dimension containing the wanted replicate
static void setAbsent(java.lang.String absent)
          Sets the name of the column (column label) which holds information on present/absent calls
 void setAttrDescr(java.lang.String[] attrDescr)
          Sets the description of all attributes
 void setAttributes(java.util.ArrayList<Mapping<java.lang.String,java.lang.String>> attributes)
          Sets the attributes list for the data
 void setFilename(java.lang.String filename)
          Sets the name of the file holding the data information
static void setGeneName(java.lang.String geneName)
          Sets the name of the column which holds information on the gene name
 void setMap(Mapping<java.lang.String,java.lang.Integer> map)
          Sets the mapping corresponding to the whole data and filtered values
 void setMethod(int i)
          Sets the method used for calculating the average ratios over all replicates
 void setPqs(double[] pqs)
          Sets the probe set quality scores
 void setUnequal(boolean unequal)
          Set the value of the unequal variable, meaning if there is an unequal number of measurements (new, pre, total)
 void writeOutput(java.lang.String output, java.util.List<java.lang.String> columnsTotal, java.util.List<java.lang.String> columnsNew, java.util.List<java.lang.String> columnsPre, java.util.List<java.lang.String> addit)
          desired columns are written to a file; former order is not kept, instead all values of one type are added sequentially
 void writeToFileArray(java.lang.String output, double[] array)
          Writes the half life values contained in the object and in the map together with corresponding spotIds into a file Appropriate for half lives, ratios & pqs (for which the new mapping applies)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RATIOFIRST

public static final int RATIOFIRST
See Also:
Constant Field Values

AVERAGEFIRST

public static final int AVERAGEFIRST
See Also:
Constant Field Values

absentLabel

public static java.lang.String absentLabel

absent

public static java.lang.String absent

geneName

public static java.lang.String geneName

spotid

public static java.lang.String spotid
Constructor Detail

Data

public Data(java.lang.String file,
            java.util.List<java.lang.String> columnsTotal,
            java.util.List<java.lang.String> columnsNew,
            java.util.List<java.lang.String> columnsPre)
Constructs a Data-Object based on an Input-File and the list of columns to be read with no additional attributes

Parameters:
file - Name of the Input-file
columnsTotal - List containing the labels of columns for total RNA
columnsNew - List containing the labels of columns for newly transcribed RNA
columnsPre - List containing the labels of columns for pre-existing RNA

Data

public Data(java.lang.String file,
            java.util.List<java.lang.String> columnsTotal,
            java.util.List<java.lang.String> columnsNew,
            java.util.List<java.lang.String> columnsPre,
            java.util.List<java.lang.String> attr)
Constructs a Data-Object based on an Input-File and the list of columns to be read, defines columns containing attributes

Parameters:
file - Name of the Input-file
columnsTotal - List containing the labels of columns for total RNA
columnsNew - List containing the labels of columns for newly transcribed RNA
columnsPre - List containing the labels of columns for pre-existing RNA
attr - List containing the labels of columns for attributes

Data

public Data(double[][] totalRNA,
            double[][] newRNA,
            double[][] preRNA,
            java.lang.String[] totalDescr,
            java.lang.String[] newDescr,
            java.lang.String[] preDescr,
            Mapping<java.lang.String,java.lang.Integer> map)
Constructs a Data-Object based on already existing data

Parameters:
totalRNA - Array containing all values of total RNA
newRNA - Array containing all values of newly transcribed RNA
preRNA - Array containing all values of pre-existing RNA
totalDescr - A description that matches the columns of the arrays containing the values to the labels of the columns for total RNA
newDescr - matches columns of arrays to labels for newly transcribed RNA
preDescr - matches columns of arrays to labels for pre-existing RNA
map - A Map matching SpotId to index of RNA-arrays, containing only filtered values
Method Detail

readInput

public void readInput(java.lang.String file,
                      java.util.List<java.lang.String> columnsTotal,
                      java.util.List<java.lang.String> columnsNew,
                      java.util.List<java.lang.String> columnsPre,
                      java.util.List<java.lang.String> addit)
Takes an input file, reads the values and saves them in the class variables of the Data object

Parameters:
file - Name of the input file
columnsTotal - List containing labels of columns for total RNA
columnsNew - List containing labels of columns for newly transcribed RNA
columnsPre - List containing labels of columns for pre-existing RNA
addit - List containing labels of columns with additional information; null if no additional information is wanted

addAttributes

public void addAttributes(java.lang.String inputfile)
Reads in a file containing two columns: column 1: spotID, column2: attribute (e.g. gene name) The resulting Mapping is added to the List attrMaps and accessible over the index received from attrMapsDescr, where the name of the column is stored

Parameters:
inputfile -

writeOutput

public void writeOutput(java.lang.String output,
                        java.util.List<java.lang.String> columnsTotal,
                        java.util.List<java.lang.String> columnsNew,
                        java.util.List<java.lang.String> columnsPre,
                        java.util.List<java.lang.String> addit)
desired columns are written to a file; former order is not kept, instead all values of one type are added sequentially

Parameters:
output - Name of the output file
columnsTotal - List containing labels of columns for total RNA that shall be exported
columnsNew - List containing labels of columns for newly transcribed RNA that shall be exported
columnsPre - List containing labels of columns for pre-existing RNA that shall be exported

copyMap

public Mapping<java.lang.String,java.lang.Integer> copyMap()
Copies the content of the Mapping object

Returns:
copy of the map that maps SpotID to indices

calculateRatio

public double[] calculateRatio(double[][] rna,
                               double[][] total)
Calculates filtered Ratio of a set of RNA values (e.g. newly transcribed RNA) to a second set of values (e.g. total RNA) based on the specified method to calculate the average of multiple replicates. If none specified the default method is 'calculateRatioFirst'

Parameters:
rna - A set of RNA values serving as numerator
total - A second set of RNA values serving as denominator
Returns:
The ratio of the two averaged sets of RNA

calculateNewMapping

public Mapping<java.lang.String,java.lang.Integer> calculateNewMapping()
Calculates the Mapping corresponding to the ratio

Returns:
Mapping which matches SpotID to index of ratio array

restrictRatio

public double[] restrictRatio(double[][] input,
                              int replicate)
Restricts a multidimensional array onto an array with one dimension containing the wanted replicate

Parameters:
input - Ratio or Half life array
Returns:
single dimensional array

calculateRatioFirst

public double[] calculateRatioFirst(double[][] allRatio)
calculates the average values from all replicates for the linear regression calculates the average of the ratios (RATIOFIRST method)

Parameters:
allRatio - The array containing the previously calculated ratios
Returns:
The average of the different ratios

calculateAverageFirst

public double[] calculateAverageFirst(double[][] rna,
                                      double[][] total)
calculates the average values from all replicates for the linear regression calculates the ratio of the averages (AVERAGEFIRST method)

Parameters:
rna - A set of RNA that serves as numerator
total - A set of RNA that serves as denominator
Returns:
The ratio of the averages of the given sets

writeToFileArray

public void writeToFileArray(java.lang.String output,
                             double[] array)
Writes the half life values contained in the object and in the map together with corresponding spotIds into a file Appropriate for half lives, ratios & pqs (for which the new mapping applies)

Parameters:
output - Name of output file

evaluate

public double evaluate(java.lang.String fasta,
                       int column)
Method for the Uracil-based evaluation of the values

Parameters:
fasta - The fasta file which contains the sequences
column - The number of the column (starting with 1) of the header in which the genename is contained (i.e. header: > genename | attribute | attribute leads to column = 1)
Returns:
result Average uracil number - average log(e'/n')

setMethod

public void setMethod(int i)
Sets the method used for calculating the average ratios over all replicates

Parameters:
i - The integer value for the method

setMap

public void setMap(Mapping<java.lang.String,java.lang.Integer> map)
Sets the mapping corresponding to the whole data and filtered values

Parameters:
map - The mapping corresponding to data

setFilename

public void setFilename(java.lang.String filename)
Sets the name of the file holding the data information

Parameters:
filename - Name of the file with the data

setAttributes

public void setAttributes(java.util.ArrayList<Mapping<java.lang.String,java.lang.String>> attributes)
Sets the attributes list for the data

Parameters:
attributes - The list of attribute mappings

setAttrDescr

public void setAttrDescr(java.lang.String[] attrDescr)
Sets the description of all attributes

Parameters:
attrDescr - The description of attributes

setAbsent

public static void setAbsent(java.lang.String absent)
Sets the name of the column (column label) which holds information on present/absent calls

Parameters:
absent - Column label for present/absent calls

setGeneName

public static void setGeneName(java.lang.String geneName)
Sets the name of the column which holds information on the gene name

Parameters:
geneName - Column label for gene name

setUnequal

public void setUnequal(boolean unequal)
Set the value of the unequal variable, meaning if there is an unequal number of measurements (new, pre, total)

Parameters:
unequal - True, if there is an unequal number of measurements

setPqs

public void setPqs(double[] pqs)
Sets the probe set quality scores

Parameters:
pqs - The probe set quality scores

getPqs

public double[] getPqs()
Returns the probe set quality scores

Returns:
The probe set quality scores

getFilename

public java.lang.String getFilename()
Returns the name of the file containing the data

Returns:
The name of the data file

getAttributes

public java.util.ArrayList<Mapping<java.lang.String,java.lang.String>> getAttributes()
Returns the attribute lists

Returns:
The list of attribute mappings

getMap

public Mapping<java.lang.String,java.lang.Integer> getMap()
Returns the map corresponding to the data

Returns:
The map for the data

getAttrDescr

public java.lang.String[] getAttrDescr()
Returns the description of the attributes

Returns:
The description of attributes

getNewDescr

public java.lang.String[] getNewDescr()
Returns the description = column labels of newly transcribed RNA

Returns:
The description of pre RNA

getNewRNA

public double[][] getNewRNA()
Returns all the values for newly transcribed RNA

Returns:
The measured values for newly transcribed RNA

getPreDescr

public java.lang.String[] getPreDescr()
Returns the description = column labels of pre-existing RNA

Returns:
The description of pre-existing RNA

getPreRNA

public double[][] getPreRNA()
Returns all the values for pre-existing RNA

Returns:
The measured values for pre-existing RNA

getTotalDescr

public java.lang.String[] getTotalDescr()
Returns the description = column labeles of total RNA

Returns:
The description of total RNA

getTotalRNA

public double[][] getTotalRNA()
Returns all the values for total RNA

Returns:
The measured values for total RNA

getNumberExperiments

public int getNumberExperiments()
Returns the number of measured experiments (not changeable through filtering!)

Returns:
The number of measured experiments

getAvgLo

public double getAvgLo()
Returns the average log(e'/n')

Returns:
The average log(e'/n')

getAvgUr

public double getAvgUr()
Returns the average number of Uracil

Returns:
The average number of Uracil

getPlotName

public java.lang.String getPlotName()
Returns the name of the file into which evaluation results will be printed as a plotable table

Returns:
The name of the file containing the plot information for evaluation