}
/**
- * Returns the next line that is not a comment, or null at end of file.
- * Comments in MEGA are within [ ] brackets, and may be nested.
+ * Returns the next non-comment line (or part line), or null at end of file.
+ * Comments in MEGA are within [ ] brackets, and may be nested. They may occur
+ * anywhere within a line (for example at the end with position numbers); this
+ * method returns the line with any comments removed.
*
* @param depth
* current depth of nesting of comments while parsing
}
return data;
}
- int leftBracket = data.indexOf(COMMENT_START);
-
- /*
- * reject unnested comment following data on the same line
- */
- if (depth == 0 && leftBracket > 0)
- {
- throw new FileFormatException(
- "Can't parse comment following data at " + data);
- }
/*
* If we are in a (possibly nested) comment after parsing this line, keep
else
{
/*
- * not in a comment by end of this line; return what is left (or the next
- * line if that is empty)
+ * not in a comment by end of this line; return what is left
*/
String nonCommentPart = getNonCommentContent(data, depth);
- // if (nonCommentPart.length() > 0)
- // {
- return nonCommentPart;
- // }
- // return nextNonCommentLine(0);
+ return nonCommentPart;
}
}
public String print(AlignmentI al)
{
this.nucleotide = al.isNucleotide();
+
String lineLength = (String) al.getProperty(PROP_LINELENGTH);
this.positionsPerLine = lineLength == null ? DEFAULT_LINE_LENGTH : Integer
.parseInt(lineLength);
- return printHeaders(al) + print(al.getSequencesArray());
+
+ String interleave = (String) al.getProperty(PROP_INTERLEAVED);
+ if (interleave != null)
+ {
+ this.interleaved = Boolean.valueOf(interleave);
+ }
+
+ String headers = printHeaders(al);
+ return headers + print(al.getSequencesArray());
}
/**