Package ubic.basecode.io.reader
Class DoubleMatrixReader
- java.lang.Object
-
- ubic.basecode.io.reader.AbstractMatrixReader<DoubleMatrix<String,String>,Double>
-
- ubic.basecode.io.reader.DoubleMatrixReader
-
- Direct Known Subclasses:
SparseDoubleMatrixReader
,SparseRaggedMatrixReader
public class DoubleMatrixReader extends AbstractMatrixReader<DoubleMatrix<String,String>,Double>
Reader forbasecode.dataStructure.matrix.DoubleMatrix
. Lines beginning with "#" or "!" will be ignored.- Author:
- Paul Pavlidis
-
-
Field Summary
-
Fields inherited from class ubic.basecode.io.reader.AbstractMatrixReader
log
-
-
Constructor Summary
Constructors Constructor Description DoubleMatrixReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected cern.colt.list.DoubleArrayList
createEmptyRow(int numColumns)
protected DoubleMatrix<String,String>
createMatrix(List<cern.colt.list.DoubleArrayList> MTemp, List<String> rowNames, List<String> colNames1)
DoubleMatrix<String,String>
read(InputStream stream)
DoubleMatrix<String,String>
read(InputStream stream, Collection<String> wantedRowNames)
DoubleMatrix<String,String>
read(InputStream stream, Collection<String> wantedRowNames, boolean createEmptyRows, int skipColumns, int maxRows)
DoubleMatrix<String,String>
read(InputStream stream, Collection<String> wantedRowNames, int numberOfColumnsToSkip)
DoubleMatrix<String,String>
read(String filename)
DoubleMatrix<String,String>
read(String filename, int maxRows)
DoubleMatrix<String,String>
read(String filename, Collection<String> wantedRowNames)
Read a matrix from a file, subject to filtering criteria.DoubleMatrix<String,String>
read(String fileName, Collection<String> wantedRowNames, int numberOfColumnsToSkip)
-
Methods inherited from class ubic.basecode.io.reader.AbstractMatrixReader
readHeader
-
-
-
-
Method Detail
-
read
public DoubleMatrix<String,String> read(InputStream stream) throws IOException
- Specified by:
read
in classAbstractMatrixReader<DoubleMatrix<String,String>,Double>
- Parameters:
stream
- InputStream stream to read from- Returns:
- NamedMatrix object constructed from the data file
- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(InputStream stream, Collection<String> wantedRowNames) throws IOException
- Parameters:
stream
- InputStreamwantedRowNames
- Set- Returns:
read( stream, wantedRowNames, createEmptyRows )
withcreateEmptyRows
set to true.- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(InputStream stream, Collection<String> wantedRowNames, boolean createEmptyRows, int skipColumns, int maxRows) throws IOException
- Parameters:
stream
- InputStreamwantedRowNames
- SetcreateEmptyRows
- if a row contained inwantedRowNames
is not found in the file, create an empty row filled with Double.NaN iff this param is true.maxRows
-- Returns:
- matrix
- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(InputStream stream, Collection<String> wantedRowNames, int numberOfColumnsToSkip) throws IOException
- Parameters:
stream
-wantedRowNames
-numberOfColumnsToSkip
-- Returns:
- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(String filename) throws IOException
- Specified by:
read
in classAbstractMatrixReader<DoubleMatrix<String,String>,Double>
- Parameters:
filename
- data file to read from (can be compressed)- Returns:
- NamedMatrix object constructed from the data file
- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(String filename, Collection<String> wantedRowNames) throws IOException
Read a matrix from a file, subject to filtering criteria.- Parameters:
filename
- data file to read from (can be compressed)wantedRowNames
- contains names of rows we want to get- Returns:
- NamedMatrix object constructed from the data file
- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(String fileName, Collection<String> wantedRowNames, int numberOfColumnsToSkip) throws IOException
- Parameters:
fileName
-wantedRowNames
- if null, takes all rowsnumberOfColumnsToSkip
- how many columns to skip -- not counting the first column. So if you set this to 4, the first four data columns will be skipped. If you set it to zero, only the first column will be skipped.- Returns:
- Throws:
IOException
-
read
public DoubleMatrix<String,String> read(String filename, int maxRows) throws IOException
- Specified by:
read
in classAbstractMatrixReader<DoubleMatrix<String,String>,Double>
- Throws:
IOException
-
createEmptyRow
protected cern.colt.list.DoubleArrayList createEmptyRow(int numColumns)
-
-