public class DistanceMatrix extends Object implements TableReport
For best performance, iterate over matrix this way.
DistanceMatrix matrix; for (int i = 0; i < myNumTaxa; i++) { for (int j = 0; j <= i; j++) { matrix.getDistance(i, j); } }
Constructor and Description |
---|
DistanceMatrix(DistanceMatrix dm)
Constructor that clones a distance matrix.
|
DistanceMatrix(DistanceMatrix dm,
TaxaList subset)
Constructor that clones a distance matrix and for only the specified
taxa.
|
DistanceMatrix(double[][] distance,
TaxaList taxa)
Constructor taking distances array and taxa list.
|
DistanceMatrix(double[][] distances,
TaxaList taxa,
GeneralAnnotation annotations)
Use DistanceMatrixBuilder instead of this.
|
Modifier and Type | Method and Description |
---|---|
double |
absoluteDistance(DistanceMatrix mat)
compute absolute distance to second distance matrix
|
GeneralAnnotation |
annotations() |
double[][] |
getClonedDistances()
Returns the distances as a 2-dimensional array of doubles.
|
int |
getClosestIndex(int fromIndex,
int[] exclusion) |
int |
getColumnCount()
Get the number of the columns
|
String |
getColumnName(int col) |
float |
getDistance(int row,
int col) |
double[][] |
getDistances()
Returns the distances as a 2-dimensional array of doubles (in the actual
array used to store the distances)
|
long |
getElementCount()
Get the total number of elements in the dataset.
|
Object[] |
getRow(long rowLong)
Returns specified row.
|
long |
getRowCount()
Get the number of rows
|
int |
getSize()
Returns the number of taxa which is also the number of rows and columns
that the distance matrix has.
|
Object[] |
getTableColumnNames()
Get the names of the columns
|
String |
getTableTitle()
Get the title of the table
|
TaxaList |
getTaxaList()
Return TaxaList of this alignment.
|
Taxon |
getTaxon(int i) |
Object |
getValueAt(long rowIndex,
int columnIndex)
Returns value at given row and column.
|
static DistanceMatrix |
hadamardProduct(DistanceMatrix m0,
DistanceMatrix m1) |
boolean |
isSymmetric()
test whether this matrix is a symmetric distance matrix
|
double |
meanDistance()
Returns the mean pairwise distance of this matrix
|
int |
numberOfTaxa() |
void |
printPHYLIP(PrintWriter out)
print alignment (PHYLIP format)
|
double |
squaredDistance(DistanceMatrix mat,
boolean weighted)
compute squared distance to second distance matrix
|
String |
toString()
returns representation of this alignment as a string
|
int |
whichIdNumber(String name) |
int |
whichIdNumber(Taxon id) |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
toStringTabDelim
public DistanceMatrix(double[][] distance, TaxaList taxa)
DistanceMatrixBuilder
public DistanceMatrix(double[][] distances, TaxaList taxa, GeneralAnnotation annotations)
DistanceMatrixBuilder
public DistanceMatrix(DistanceMatrix dm)
public DistanceMatrix(DistanceMatrix dm, TaxaList subset)
public void printPHYLIP(PrintWriter out) throws IOException
IOException
public String toString()
public double squaredDistance(DistanceMatrix mat, boolean weighted)
public double absoluteDistance(DistanceMatrix mat)
public int getSize()
public final double[][] getClonedDistances()
public final double[][] getDistances()
public final float getDistance(int row, int col)
public double meanDistance()
public Taxon getTaxon(int i)
public int numberOfTaxa()
public int whichIdNumber(String name)
public int whichIdNumber(Taxon id)
public TaxaList getTaxaList()
public boolean isSymmetric()
public int getClosestIndex(int fromIndex, int[] exclusion)
fromIndex
- the index of the thing (taxa,sequence) from which we
want to find the closest (excluding self)exclusion
- indexes of things that should not be considered, may be
nullpublic static DistanceMatrix hadamardProduct(DistanceMatrix m0, DistanceMatrix m1)
public Object[] getTableColumnNames()
TableReport
getTableColumnNames
in interface TableReport
public Object[] getRow(long rowLong)
getRow
in interface TableReport
rowLong
- row numberpublic String getTableTitle()
TableReport
getTableTitle
in interface TableReport
public long getRowCount()
TableReport
getRowCount
in interface TableReport
public long getElementCount()
TableReport
getElementCount
in interface TableReport
public int getColumnCount()
TableReport
getColumnCount
in interface TableReport
public Object getValueAt(long rowIndex, int columnIndex)
TableReport
getValueAt
in interface TableReport
rowIndex
- row numbercolumnIndex
- column numberpublic String getColumnName(int col)
public GeneralAnnotation annotations()
Copyright © 2019. All rights reserved.