math_utils
Class ExpressionMatrix

java.lang.Object
  extended by math_utils.ExpressionMatrix

public class ExpressionMatrix
extends java.lang.Object

This class implements and expression matrix object. It supports parsing of an expression matrix file and manipulations of the data.


Field Summary
 java.util.ArrayList<java.lang.String> genesID
           
 float[][] matrix
           
 
Constructor Summary
ExpressionMatrix(float[][] mat, java.lang.String[] h, java.util.ArrayList<java.lang.String> ids)
           
ExpressionMatrix(java.lang.String path)
           
 
Method Summary
 void addRowsToMatrix(ExpressionMatrix other)
           
 boolean containsGene(java.lang.String name)
           
 void createGene2IndexHash()
           
 ExpressionMatrix deepClone()
           
 void floorData(float val)
           
 float geneGenesCorrelations(java.lang.String first, java.lang.String second)
           
 double[][] getDoubleTrasposedMatrix()
           
 ExpressionMatrix getExpandedByGraph(short[][] graph)
           
 java.util.ArrayList<java.lang.String> getGenesID()
           
 java.lang.String[] getHeader()
           
 float[][] getMatrix()
           
 ExpressionMatrix getShuffeledMatrixByColumns(java.util.Random rand)
           
 ExpressionMatrix getSubMatrixByColumnsIndices(java.util.ArrayList<java.lang.Integer> list)
          This method receives a sorted list of indices and returns a sub-matrix that contains only the columns that are included in the list
 ExpressionMatrix getSubMatrixByRowsIndices(java.util.LinkedList<java.lang.Integer> list)
          This method returns a sub-matrix with all the raws that appear in the list.
 java.util.LinkedList<java.lang.Integer> intensityFilterGenes(float thr, float percentage, int[] borders)
           
 java.util.LinkedList<java.lang.Integer> intensityFilterGenesForOneClass(float thr, float percentage, int[] borders, int classIndex)
           
 ExpressionMatrix matrixByClusteringResults(java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> clusteringResult)
          unite clusters into median pattern
 void printMatrix()
           
 void printMatrix(java.io.BufferedWriter writer)
           
 void printWekaCSVForRegression(java.lang.String path)
           
 void printWekaCSVInstancesArePatients(java.lang.String path, int[] borders, int classIndex)
          WEKA receives tab separated files, the header contains the features names and each line is an instance.
 void printWekaCSVInstancesArePatients(java.lang.String path, int[] borders, java.lang.String[] classesNames)
           
 ExpressionMatrix removeGenes(java.util.LinkedList<java.lang.Integer> toRemove)
           
 void setMatrix(float[][] matrix)
           
 void shuffleExpressions()
           
 void standardizeByClasses(int[] borders)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrix

public float[][] matrix

genesID

public java.util.ArrayList<java.lang.String> genesID
Constructor Detail

ExpressionMatrix

public ExpressionMatrix(float[][] mat,
                        java.lang.String[] h,
                        java.util.ArrayList<java.lang.String> ids)

ExpressionMatrix

public ExpressionMatrix(java.lang.String path)
Method Detail

matrixByClusteringResults

public ExpressionMatrix matrixByClusteringResults(java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> clusteringResult)
unite clusters into median pattern

Parameters:
clusteringResult -
Returns:

getSubMatrixByRowsIndices

public ExpressionMatrix getSubMatrixByRowsIndices(java.util.LinkedList<java.lang.Integer> list)
This method returns a sub-matrix with all the raws that appear in the list. The given parameter is an ArrayList of indices of raws in the matrix, in ascending order;


getSubMatrixByColumnsIndices

public ExpressionMatrix getSubMatrixByColumnsIndices(java.util.ArrayList<java.lang.Integer> list)
This method receives a sorted list of indices and returns a sub-matrix that contains only the columns that are included in the list


printWekaCSVInstancesArePatients

public void printWekaCSVInstancesArePatients(java.lang.String path,
                                             int[] borders,
                                             int classIndex)
WEKA receives tab separated files, the header contains the features names and each line is an instance. Therefore the expander matrix is the transpose of the WEKA's matrix. This method prints the transposed matrix. The last column in the output matrix is the class name, this is the default in WEKA.

Parameters:
writer -

printWekaCSVForRegression

public void printWekaCSVForRegression(java.lang.String path)

getDoubleTrasposedMatrix

public double[][] getDoubleTrasposedMatrix()

printWekaCSVInstancesArePatients

public void printWekaCSVInstancesArePatients(java.lang.String path,
                                             int[] borders,
                                             java.lang.String[] classesNames)

getMatrix

public float[][] getMatrix()

getHeader

public java.lang.String[] getHeader()

getGenesID

public java.util.ArrayList<java.lang.String> getGenesID()

containsGene

public boolean containsGene(java.lang.String name)

geneGenesCorrelations

public float geneGenesCorrelations(java.lang.String first,
                                   java.lang.String second)

createGene2IndexHash

public void createGene2IndexHash()

intensityFilterGenes

public java.util.LinkedList<java.lang.Integer> intensityFilterGenes(float thr,
                                                                    float percentage,
                                                                    int[] borders)

intensityFilterGenesForOneClass

public java.util.LinkedList<java.lang.Integer> intensityFilterGenesForOneClass(float thr,
                                                                               float percentage,
                                                                               int[] borders,
                                                                               int classIndex)

addRowsToMatrix

public void addRowsToMatrix(ExpressionMatrix other)

setMatrix

public void setMatrix(float[][] matrix)

floorData

public void floorData(float val)

printMatrix

public void printMatrix()

printMatrix

public void printMatrix(java.io.BufferedWriter writer)
                 throws java.io.IOException
Throws:
java.io.IOException

removeGenes

public ExpressionMatrix removeGenes(java.util.LinkedList<java.lang.Integer> toRemove)

getExpandedByGraph

public ExpressionMatrix getExpandedByGraph(short[][] graph)

standardizeByClasses

public void standardizeByClasses(int[] borders)

shuffleExpressions

public void shuffleExpressions()

deepClone

public ExpressionMatrix deepClone()

getShuffeledMatrixByColumns

public ExpressionMatrix getShuffeledMatrixByColumns(java.util.Random rand)