public static final String FILE_DESC = "PHYLIP";
/**
- *
+ *
* @see {@link AlignFile#AlignFile()}
*/
public PhylipFile()
}
/**
- *
+ *
* @param source
* @throws IOException
*/
/**
* Parses the input source
- *
+ *
* @see {@link AlignFile#parse()}
*/
@Override
"First line must contain the number of specifies and number of characters");
}
- int numberSpecies = Integer.parseInt(lineElements[0]), numberCharacters = Integer
- .parseInt(lineElements[1]);
+ int numberSpecies = Integer.parseInt(lineElements[0]);
+ int numberCharacters = Integer.parseInt(lineElements[1]);
if (numberSpecies <= 0)
{
// first check sequence is the expected length
if (sequences[i].length() != numberCharacters)
{
- throw new IOException(sequenceElements[i].getName()
+ String warnMessage = sequenceElements[i].getName()
+ " sequence is incorrect length - should be "
- + numberCharacters + " but is " + sequences[i].length());
+ + numberCharacters + " but is " + sequences[i].length();
+
+ throw new IOException(warnMessage);
}
sequenceElements[i].setSequence(sequences[i].toString());
seqs.add(sequenceElements[i]);
/**
* Removes any whitespace from txt, used to strip and spaces added to
* sequences to improve human readability
- *
+ *
* @param txt
* @return
*/
/**
* According to the specification, the name cannot have parentheses, square
* brackets, colon, semicolon, comma
- *
+ *
* @param name
* @return
* @throws IOException
private String validateName(String name) throws IOException
{
char[] invalidCharacters = new char[]
- { '(', ')', '[', ']', ':', ';', ',' };
+ { '(', ')', '[', ']', ':', ';', ',' };
for (char c : invalidCharacters)
{
if (name.indexOf(c) > -1)
* characters; a blank line is added between each matrix; no spacing is added
* between the sequence characters.
* </p>
- *
- *
+ *
+ *
* @see {@link AlignFile#print()}
*/
@Override
sb.append(
(seqs.size() > 0) ? Integer
.toString(seqs.get(0).getSequence().length) : "0")
- .append(newline);
+ .append(newline);
// Due to how IO is handled, there doesn't appear to be a way to store
// if the original file was sequential or interleaved; if there is, then
sb.append(
s.getSequence(start, Math.min(start
+ numInterleavedColumns, sequenceLength)))
- .append(newline);
+ .append(newline);
}
}