Package ffx.potential.parsers
Class DistanceMatrixFilter
java.lang.Object
ffx.potential.parsers.DistanceMatrixFilter
The DistanceMatrixFilter class parses a Distance Matrix (*.DST) files.
- Since:
- 1.0
- Author:
- Michael J. Schnieders
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of columns in the last row that was read in.int
Get the number of rows read in.readDistanceMatrix
(String filename, int expectedRows, int expectedColumns) Read in the distance matrix from a file.readDistanceMatrix
(String filename, List<double[]> distanceList) Read in the distance matrix from a file.static String
toDistanceMatrixString
(double[][] distanceMatrix) Convert a distance matrix to a String.static String
toDistanceMatrixString
(List<double[]> distanceMatrix) Convert a distance matrix to a String.static boolean
writeDistanceMatrix
(String filename, List<double[]> distanceMatrix) Write the distance matrix to a file.static boolean
writeDistanceMatrixRow
(String filename, double[] distanceMatrixRow, int firstColumn) Write the distance matrix to a file.
-
Constructor Details
-
DistanceMatrixFilter
public DistanceMatrixFilter()No public constructor for DistanceMatrixFilter.
-
-
Method Details
-
getRestartRow
public int getRestartRow()Get the number of rows read in.- Returns:
- The number of rows read in.
-
getRestartColumn
public int getRestartColumn()Get the number of columns in the last row that was read in.- Returns:
- The number of columns in the last row that was read in.
-
readDistanceMatrix
Read in the distance matrix from a file. This method is used from the Clustering code, where the size of the distance matrix is unknown, and the full N^2 matrix is needed.- Parameters:
filename
- The filename to read from.distanceList
- The distance matrix (if null, only the last row is returned).- Returns:
- Statistics for the parsed values.
-
readDistanceMatrix
Read in the distance matrix from a file.- Parameters:
filename
- The filename to read from.expectedRows
- The number of rows to expect.expectedColumns
- The number of columns to expect.- Returns:
- Statistics for the parsed values.
-
toDistanceMatrixString
Convert a distance matrix to a String.- Parameters:
distanceMatrix
- The distance matrix.- Returns:
- Return a String representation (or null if the distanceMatrix is null).
-
toDistanceMatrixString
Convert a distance matrix to a String.- Parameters:
distanceMatrix
- The distance matrix.- Returns:
- Return a String representation (or null if the distanceMatrix is null).
-
writeDistanceMatrix
Write the distance matrix to a file.- Parameters:
filename
- The filename to write to.distanceMatrix
- a list containing rows of the distance matrix.- Returns:
- a boolean.
-
writeDistanceMatrixRow
public static boolean writeDistanceMatrixRow(String filename, double[] distanceMatrixRow, int firstColumn) Write the distance matrix to a file.- Parameters:
filename
- The filename to write to.distanceMatrixRow
- A row of the distance matrix.firstColumn
- The first column of the distance matrix row to write.- Returns:
- a boolean.
-