X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignSeq.java;h=ed44d4ad8d5c54201613435700401b32de275d18;hb=7d6575e94bed92bc06043d432576e3a39e8a8e75;hp=bd4cc223152a38191ca5fccff936147c4f68744e;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index bd4cc22..ed44d4a 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -51,6 +51,8 @@ public class AlignSeq public static final String DNA = "dna"; + private static final String NEWLINE = System.lineSeparator(); + static String[] dna = { "A", "C", "G", "T", "-" }; @@ -363,8 +365,8 @@ public class AlignSeq */ private void SeqInit(String string1, String string2) { - s1str = extractGaps(jalview.util.Comparison.GapChars, string1); - s2str = extractGaps(jalview.util.Comparison.GapChars, string2); + s1str = extractGaps(Comparison.GapChars, string1); + s2str = extractGaps(Comparison.GapChars, string2); if (s1str.length() == 0 || s2str.length() == 0) { @@ -579,21 +581,28 @@ public class AlignSeq int nochunks = ((aseq1.length - count) / len) + 1; pid = 0; - output.append("Score = " + score[maxi][maxj] + "\n"); - output.append("Length of alignment = " + (aseq1.length - count) + "\n"); + output.append("Score = ").append(score[maxi][maxj]).append(NEWLINE); + output.append("Length of alignment = ") + .append(String.valueOf(aseq1.length - count)).append(NEWLINE); output.append("Sequence "); output.append(new Format("%" + maxid + "s").form(s1.getName())); - output.append(" : " + s1.getStart() + " - " + s1.getEnd() - + " (Sequence length = " + s1str.length() + ")\n"); + output.append(" : ").append(String.valueOf(s1.getStart())) + .append(" - ").append(String.valueOf(s1.getEnd())); + output.append(" (Sequence length = ") + .append(String.valueOf(s1str.length())).append(")") + .append(NEWLINE); output.append("Sequence "); output.append(new Format("%" + maxid + "s").form(s2.getName())); - output.append(" : " + s2.getStart() + " - " + s2.getEnd() - + " (Sequence length = " + s2str.length() + ")\n\n"); + output.append(" : ").append(String.valueOf(s2.getStart())) + .append(" - ").append(String.valueOf(s2.getEnd())); + output.append(" (Sequence length = ") + .append(String.valueOf(s2str.length())).append(")") + .append(NEWLINE).append(NEWLINE); for (int j = 0; j < nochunks; j++) { // Print the first aligned sequence - output.append(new Format("%" + (maxid) + "s").form(s1id) + " "); + output.append(new Format("%" + (maxid) + "s").form(s1id)).append(" "); for (int i = 0; i < len; i++) { @@ -603,8 +612,8 @@ public class AlignSeq } } - output.append("\n"); - output.append(new Format("%" + (maxid) + "s").form(" ") + " "); + output.append(NEWLINE); + output.append(new Format("%" + (maxid) + "s").form(" ")).append(" "); // Print out the matching chars for (int i = 0; i < len; i++) @@ -612,7 +621,7 @@ public class AlignSeq if ((i + (j * len)) < astr1.length()) { if (astr1.charAt(i + (j * len)) == astr2.charAt(i + (j * len)) - && !jalview.util.Comparison.isGap(astr1.charAt(i + && !Comparison.isGap(astr1.charAt(i + (j * len)))) { pid++; @@ -638,9 +647,9 @@ public class AlignSeq } // Now print the second aligned sequence - output = output.append("\n"); - output = output.append(new Format("%" + (maxid) + "s").form(s2id) - + " "); + output = output.append(NEWLINE); + output = output.append(new Format("%" + (maxid) + "s").form(s2id)) + .append(" "); for (int i = 0; i < len; i++) { @@ -650,12 +659,12 @@ public class AlignSeq } } - output = output.append("\n\n"); + output.append(NEWLINE).append(NEWLINE); } pid = pid / (aseq1.length - count) * 100; output = output.append(new Format("Percentage ID = %2.2f\n\n") - .form(pid)); + .formDouble(pid)); try { @@ -698,7 +707,7 @@ public class AlignSeq Format.print(System.out, "%3s", s1str.substring(i, i + 1)); } - Format.print(System.out, "%3d ", mat[i][j] / 10); + Format.printLong(System.out, "%3d ", mat[i][j] / 10); } System.out.println(); @@ -1001,7 +1010,7 @@ public class AlignSeq * * @return mapping from positions in S1 to corresponding positions in S2 */ - public jalview.datamodel.Mapping getMappingFromS1(boolean allowmismatch) + public Mapping getMappingFromS1(boolean allowmismatch) { ArrayList as1 = new ArrayList(), as2 = new ArrayList(); int pdbpos = s2.getStart() + getSeq2Start() - 2; @@ -1068,7 +1077,7 @@ public class AlignSeq } MapList map = new MapList(mapseq1, mapseq2, 1, 1); - jalview.datamodel.Mapping mapping = new Mapping(map); + Mapping mapping = new Mapping(map); mapping.setTo(s2); return mapping; }