}
/**
+ * build a string excluding hidden regions from a particular sequence in the
+ * view
+ *
+ * @param c
+ * @param n
+ * @return
+ */
+ private String getASequenceString(char c, int n)
+ {
+ String sqn;
+ String fullseq = sequences[n].getSequenceString(c);
+ if (contigs != null)
+ {
+ sqn = "";
+ int p = 0;
+ for (int h = 0; h < contigs.length; h += 3)
+ {
+ sqn += fullseq.substring(p, contigs[h + 1]);
+ p = contigs[h + 1] + contigs[h + 2];
+ }
+ sqn += fullseq.substring(p);
+ }
+ else
+ {
+ sqn = fullseq;
+ }
+ return sqn;
+ }
+
+ /**
* get an array of visible sequence strings for a view on an alignment using
- * the given gap character
+ * the given gap character uses getASequenceString
*
* @param c
* char
String[] seqs = new String[sequences.length];
for (int n = 0; n < sequences.length; n++)
{
- String fullseq = sequences[n].getSequenceString(c);
- if (contigs != null)
- {
- seqs[n] = "";
- int p = 0;
- for (int h = 0; h < contigs.length; h += 3)
- {
- seqs[n] += fullseq.substring(p, contigs[h + 1]);
- p = contigs[h + 1] + contigs[h + 2];
- }
- seqs[n] += fullseq.substring(p);
- }
- else
- {
- seqs[n] = fullseq;
- }
+ seqs[n] = getASequenceString(c, n);
}
return seqs;
}