JAL-2599 move fillSymbol method to HMFile
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 17 Aug 2017 13:53:47 +0000 (14:53 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 17 Aug 2017 13:53:47 +0000 (14:53 +0100)
src/jalview/io/HMMFile.java

index 28aa62f..b2a6f8b 100644 (file)
@@ -154,7 +154,7 @@ public class HMMFile extends AlignFile
                               // properties)
         {
           readingFile = false;
-          hmm.fillSymbols(parser);
+          fillSymbols(parser);
           numberOfSymbols = hmm.getNumberOfSymbols();
         }
         else if ("STATS".equals(next))
@@ -729,5 +729,23 @@ public class HMMFile extends AlignFile
 
   }
 
+  /**
+   * Fills symbol array and adds each symbol to an index lookup
+   * 
+   * @param parser
+   *          The scanner scanning the symbol line in the file.
+   */
+  public void fillSymbols(Scanner parser)
+  {
+    int i = 0;
+    while (parser.hasNext())
+    {
+      String strSymbol = parser.next();
+      char[] symbol = strSymbol.toCharArray();
+      hmm.getSymbols().add(symbol[0]);
+      hmm.setSymbolIndex(symbol[0], i);
+      i++;
+    }
+  }
 }