- /*
- * permit an uncommented line with delimited residue headings
- */
- if (isHeaderLine(data, alphabet))
- {
- continue;
- }
-
- /*
- * subsequent lines should be the symbol scores
- * optionally with the symbol as the first column for readability
- */
- StringTokenizer scoreLine = new StringTokenizer(data, DELIMITERS);
- if (scoreLine.countTokens() == size + 1)
- {
- /*
- * check 'guide' symbol is the row'th letter of the alphabet
- */
- String symbol = scoreLine.nextToken();
- if (symbol.length() > 1 || symbol.charAt(0) != alphabet.charAt(row))
- {
- err = String
- .format("Error parsing score matrix at line %d, expected '%s' but found '%s'",
- lineNo, alphabet.charAt(row), symbol);
- throw new FileFormatException(err);
- }
- }
- if (scoreLine.countTokens() != size)
- {
- err = String.format("Expected %d scores at line %d but found %d",
- size, lineNo, scoreLine.countTokens());
- throw new FileFormatException(err);
- }
- scores[row] = new float[size];
- int col = 0;
- String value = null;
- while (scoreLine.hasMoreTokens())
- {
- try
- {
- value = scoreLine.nextToken();
- scores[row][col] = Float.valueOf(value);
- col++;
- } catch (NumberFormatException e)
- {
- err = String.format(
- "Invalid score value '%s' at line %d column %d", value,
- lineNo, col);
- throw new FileFormatException(err);
- }
- }