X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FAlignSeq.java;h=369721d8c2b325fa0d4bec3a20ce73f9824906f3;hb=0ebcd487f08f9873987d9a32edce7df47aa27927;hp=5612133cb95ef77c1b2aec9931d7c687b7b90870;hpb=d69ae82ef958ae5bd67481d0b018a1db3662d4ae;p=jalview.git diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 5612133..369721d 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -20,13 +20,6 @@ */ package jalview.analysis; -import java.awt.Color; -import java.awt.Graphics; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.StringTokenizer; - import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Mapping; @@ -39,6 +32,13 @@ import jalview.util.Format; import jalview.util.MapList; import jalview.util.MessageManager; +import java.awt.Color; +import java.awt.Graphics; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.StringTokenizer; + /** * * @@ -53,13 +53,11 @@ public class AlignSeq private static final String NEWLINE = System.lineSeparator(); - static String[] dna = - { "A", "C", "G", "T", "-" }; + static String[] dna = { "A", "C", "G", "T", "-" }; // "C", "T", "A", "G", "-"}; - static String[] pep = - { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F", - "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "-" }; + static String[] pep = { "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", + "L", "K", "M", "F", "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "-" }; int[][] score; @@ -451,7 +449,8 @@ public class AlignSeq else { output.append("Wrong type = dna or pep only"); - throw new Error(MessageManager.formatMessage("error.unknown_type_dna_or_pep", new String[]{type2})); + throw new Error(MessageManager.formatMessage( + "error.unknown_type_dna_or_pep", new String[] { type2 })); } } @@ -578,7 +577,8 @@ public class AlignSeq } } int len = 72 - maxid - 1; - int nochunks = ((aseq1.length - count) / len) + 1; + int nochunks = ((aseq1.length - count) / len) + + ((aseq1.length - count) % len > 0 ? 1 : 0); pid = 0; output.append("Score = ").append(score[maxi][maxj]).append(NEWLINE); @@ -663,9 +663,8 @@ public class AlignSeq } pid = pid / (aseq1.length - count) * 100; - output = output.append(new Format("Percentage ID = %2.2f\n\n") + output = output.append(new Format("Percentage ID = %2.2f\n") .form(pid)); - try { os.print(output.toString()); @@ -949,6 +948,7 @@ public class AlignSeq public static void displayMatrix(Graphics g, int[][] mat, int n, int m, int psize) { + // TODO method dosen't seem to be referenced anywhere delete?? int max = -1000; int min = 1000; @@ -1097,8 +1097,8 @@ public class AlignSeq */ public static List> replaceMatchingSeqsWith( List seqs, List annotations, - List ochains, - AlignmentI al, String dnaOrProtein, boolean removeOldAnnots) + List ochains, AlignmentI al, String dnaOrProtein, + boolean removeOldAnnots) { List orig = new ArrayList(), repl = new ArrayList(); List aligs = new ArrayList(); @@ -1106,7 +1106,7 @@ public class AlignSeq { ArrayList matches = new ArrayList(); ArrayList aligns = new ArrayList(); - + for (SequenceI sq : ochains) { SequenceI bestm = null; @@ -1114,8 +1114,7 @@ public class AlignSeq int bestscore = 0; for (SequenceI msq : al.getSequences()) { - AlignSeq aseq = doGlobalNWAlignment(msq, sq, - dnaOrProtein); + AlignSeq aseq = doGlobalNWAlignment(msq, sq, dnaOrProtein); if (bestm == null || aseq.getMaxScore() > bestscore) { bestscore = aseq.getMaxScore(); @@ -1141,7 +1140,8 @@ public class AlignSeq sq.setName(sp.getName()); sq.setDescription(sp.getDescription()); Mapping sp2sq; - sq.transferAnnotation(sp, sp2sq = aligns.get(q).getMappingFromS1(false)); + sq.transferAnnotation(sp, + sp2sq = aligns.get(q).getMappingFromS1(false)); aligs.add(aligns.get(q)); int inspos = -1; for (int ap = 0; ap < annotations.size();) @@ -1152,9 +1152,12 @@ public class AlignSeq { inspos = ap; } - if (removeOldAnnots) { + if (removeOldAnnots) + { annotations.remove(ap); - } else { + } + else + { AlignmentAnnotation alan = annotations.remove(ap); alan.liftOver(sq, sp2sq); alan.setSequenceRef(sq);