package jalview.ext.archaeopteryx;
+import jalview.datamodel.Sequence;
+import jalview.ext.forester.ForesterMatrix;
import jalview.math.MatrixI;
import org.forester.evoinference.matrix.distance.DistanceMatrix;
-public class MatrixConverter
+public final class MatrixConverter
{
- DistanceMatrix foresterMatrix;
-
- MatrixI jalviewMatrix;
-
- public static MatrixConverter createConverter(
- DistanceMatrix foresterInputMatrix)
+ /**
+ * Shouldn't get instantiated
+ */
+ private MatrixConverter()
{
- MatrixConverter converter = new MatrixConverter();
- converter.setForesterMatrix(foresterInputMatrix);
- return converter;
}
- public static MatrixConverter createConverter(MatrixI jalviewInputMatrix)
+
+ public static DistanceMatrix convertJalviewToForester(
+ final MatrixI jalviewInputMatrix,
+ final Sequence[] matrixSequences)
{
- MatrixConverter converter = new MatrixConverter();
- converter.setJalviewMatrix(jalviewInputMatrix);
- return converter;
+ if (jalviewInputMatrix.width() != jalviewInputMatrix.height())
+ {
+ // some kind of warning?
+ }
+ DistanceMatrix foresterMatrix = new ForesterMatrix(jalviewInputMatrix,
+ matrixSequences);
+ return foresterMatrix;
+
}
- protected DistanceMatrix getForesterMatrix()
+ public static DistanceMatrix convertJalviewToForester(
+ final MatrixI jalviewInputMatrix,
+ final String[] matrixIdentifiers)
{
+ if (jalviewInputMatrix.width() != jalviewInputMatrix.height())
+ {
+ // some kind of warning?
+ }
+
+ DistanceMatrix foresterMatrix = new ForesterMatrix(jalviewInputMatrix,
+ matrixIdentifiers);
return foresterMatrix;
- }
- protected void setForesterMatrix(DistanceMatrix foresterMatrix)
- {
- this.foresterMatrix = foresterMatrix;
- }
- protected MatrixI getJalviewMatrix()
- {
- return jalviewMatrix;
}
- protected void setJalviewMatrix(MatrixI jalviewMatrix)
- {
- this.jalviewMatrix = jalviewMatrix;
- }
+
+
}
private Sequence[] sequences;
- private String[] identifiers;
+ private final String[] identifiers;
public ForesterMatrix(final MatrixI jalviewInputMatrix,
final Sequence[] matrixSequences)
this.sequences = matrixSequences;
this.identifiers = new String[sequences.length];
- if (jalviewMatrix.width() != jalviewMatrix.height())
- {
- // some kind of warning?
- }
int i = 0;
for (Sequence sequence : sequences)
this.jalviewMatrix = jalviewInputMatrix;
this.identifiers = matrixIdentifiers;
-
- if (jalviewMatrix.width() != jalviewMatrix.height())
- {
- // some kind of warning?
- }
-
-
-
}
@Override