Merge branch 'develop' into features/JAL-2446NCList
[jalview.git] / src / jalview / datamodel / BinarySequence.java
index da41c44..c33abb3 100755 (executable)
@@ -69,13 +69,9 @@ public class BinarySequence extends Sequence
   {
     int nores = (isNa) ? ResidueProperties.maxNucleotideIndex
             : ResidueProperties.maxProteinIndex;
-    // Set all matrix to 0
-    dbinary = new double[getSequence().length * nores];
 
-    for (int i = 0; i < dbinary.length; i++)
-    {
-      dbinary[i] = 0.0;
-    }
+    dbinary = new double[getLength() * nores];
+
     return nores;
   }
 
@@ -92,7 +88,7 @@ public class BinarySequence extends Sequence
   {
     int nores = initMatrixGetNoRes();
     final int[] sindex = getSymbolmatrix();
-    for (int i = 0; i < getSequence().length; i++)
+    for (int i = 0; i < getLength(); i++)
     {
       int aanum = nores - 1;
 
@@ -123,10 +119,10 @@ public class BinarySequence extends Sequence
   {
     if (isNa != smtrx.isDNA())
     {
-      throw new InvalidSequenceTypeException("matrix "
-              + smtrx.getClass().getCanonicalName()
-              + " is not a valid matrix for "
-              + (isNa ? "nucleotide" : "protein") + "sequences");
+      throw new InvalidSequenceTypeException(
+              "matrix " + smtrx.getClass().getCanonicalName()
+                      + " is not a valid matrix for "
+                      + (isNa ? "nucleotide" : "protein") + "sequences");
     }
     matrixEncode(smtrx.isDNA() ? ResidueProperties.nucleotideIndex
             : ResidueProperties.aaIndex, smtrx.getMatrix());
@@ -134,15 +130,9 @@ public class BinarySequence extends Sequence
 
   private void matrixEncode(final int[] aaIndex, final float[][] matrix)
   {
-    // Set all matrix to 0
-    // dbinary = new double[getSequence().length * 21];
-
     int nores = initMatrixGetNoRes();
 
-    // for (int i = 0; i < dbinary.length; i++) {
-    // dbinary[i] = 0.0;
-    // }
-    for (int i = 0, iSize = getSequence().length; i < iSize; i++)
+    for (int i = 0, iSize = getLength(); i < iSize; i++)
     {
       int aanum = nores - 1;