// this can be True, False or null (meaning we don't know yet)
private Boolean interleaved;
+ // write end of line positions as a comment
+ private boolean writePositionNumbers = true;
+
public MegaFile()
{
}
int maxSequenceLength = getMaxSequenceLength(s);
int numLines = maxSequenceLength / positionsPerLine + 3; // approx
- /*
- * Size a buffer to hold the whole output
- */
- StringBuilder sb = new StringBuilder(numLines
- * (maxIdLength + 2 + positionsPerLine));
-
int numDataBlocks = (maxSequenceLength - 1) / positionsPerLine + 1;
int spaceEvery = this.nucleotide != null && this.nucleotide ? 3 : 10;
int chunksPerLine = (positionsPerLine + spaceEvery - 1) / spaceEvery;
/*
+ * Roughly size a buffer to hold the whole output
+ */
+ StringBuilder sb = new StringBuilder(numLines
+ * (maxIdLength + positionsPerLine + chunksPerLine + 10));
+
+ /*
* Output as: #Seqid CGT AGC ACT ... or blocks of 10 for peptide
*/
int from = 0;
advancedBy += subSequence.length;
}
}
+ // write last position as a comment
+ if (writePositionNumbers)
+ {
+ sb.append(SPACE).append(COMMENT_START).append(from + advancedBy)
+ .append(COMMENT_END);
+ }
sb.append(newline);
first = false;
}