JAL-1645 Version-Rel Version 2.9 Year-Rel 2015 Licensing glob
[jalview.git] / src / jalview / analysis / AlignSeq.java
index 5612133..241eeeb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  */
 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 }));
     }
   }
 
@@ -1097,8 +1096,8 @@ public class AlignSeq
    */
   public static List<List<? extends Object>> replaceMatchingSeqsWith(
           List<SequenceI> seqs, List<AlignmentAnnotation> annotations,
-          List<SequenceI> ochains,
-          AlignmentI al, String dnaOrProtein, boolean removeOldAnnots)
+          List<SequenceI> ochains, AlignmentI al, String dnaOrProtein,
+          boolean removeOldAnnots)
   {
     List<SequenceI> orig = new ArrayList<SequenceI>(), repl = new ArrayList<SequenceI>();
     List<AlignSeq> aligs = new ArrayList<AlignSeq>();
@@ -1106,7 +1105,7 @@ public class AlignSeq
     {
       ArrayList<SequenceI> matches = new ArrayList<SequenceI>();
       ArrayList<AlignSeq> aligns = new ArrayList<AlignSeq>();
-  
+
       for (SequenceI sq : ochains)
       {
         SequenceI bestm = null;
@@ -1114,8 +1113,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 +1139,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 +1151,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);