package jalview.analysis.scoremodels;
+
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+import jalview.io.DataSourceType;
+import jalview.io.FileParse;
+import jalview.io.ScoreMatrixFile;
import jalview.math.MatrixI;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
import org.testng.annotations.Test;
public class ScoreMatrixTest
// Q.G + I.W + A.C = -2 + -3 + 0 = -5
assertEquals(pairwise.getValue(2, 3), -5d);
}
+
+ /**
+ * Test that the result of outputMatrix can be reparsed to give an identical
+ * ScoreMatrix
+ *
+ * @throws IOException
+ * @throws MalformedURLException
+ */
+ @Test(groups = "Functional")
+ public void testOutputMatrix_roundTrip() throws MalformedURLException,
+ IOException
+ {
+ ScoreMatrix sm = ScoreModels.getInstance().getBlosum62();
+ String output = sm.outputMatrix(false);
+ FileParse fp = new FileParse(output, DataSourceType.PASTE);
+ ScoreMatrixFile parser = new ScoreMatrixFile(fp);
+ ScoreMatrix sm2 = parser.parseMatrix();
+ assertNotNull(sm2);
+ assertTrue(sm2.equals(sm));
+ }
}