Merge branch 'develop' into releases/Release_2_10_2_Branch
[jalview.git] / src / jalview / gui / Jalview2XML.java
index ffbe6a1..4c2b8b6 100644 (file)
@@ -360,7 +360,8 @@ public class Jalview2XML
   }
 
   public SeqFref newAlcodMapRef(final String sref,
-          final AlignedCodonFrame _cf, final jalview.datamodel.Mapping _jmap)
+          final AlignedCodonFrame _cf,
+          final jalview.datamodel.Mapping _jmap)
   {
 
     SeqFref fref = new SeqFref(sref, "Codon Frame")
@@ -412,8 +413,8 @@ public class Jalview2XML
           }
         } catch (Exception x)
         {
-          System.err
-                  .println("IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence "
+          System.err.println(
+                  "IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence "
                           + ref.getSref());
           x.printStackTrace();
           failedtoresolve++;
@@ -436,9 +437,9 @@ public class Jalview2XML
     }
     if (incompleteSeqs != null && incompleteSeqs.size() > 0)
     {
-      System.err.println("Jalview Project Import: There are "
-              + incompleteSeqs.size()
-              + " sequences which may have incomplete metadata.");
+      System.err.println(
+              "Jalview Project Import: There are " + incompleteSeqs.size()
+                      + " sequences which may have incomplete metadata.");
       if (incompleteSeqs.size() < 10)
       {
         for (SequenceI s : incompleteSeqs.values())
@@ -448,8 +449,8 @@ public class Jalview2XML
       }
       else
       {
-        System.err
-                .println("Too many to report. Skipping output of incomplete sequences.");
+        System.err.println(
+                "Too many to report. Skipping output of incomplete sequences.");
       }
     }
   }
@@ -559,9 +560,8 @@ public class Jalview2XML
       {
         AlignFrame af = frames.get(i);
         // skip ?
-        if (skipList != null
-                && skipList
-                        .containsKey(af.getViewport().getSequenceSetId()))
+        if (skipList != null && skipList
+                .containsKey(af.getViewport().getSequenceSetId()))
         {
           continue;
         }
@@ -581,8 +581,8 @@ public class Jalview2XML
 
           saveState(apanel, fileName, jout, viewIds);
 
-          String dssid = getDatasetIdRef(af.getViewport().getAlignment()
-                  .getDataset());
+          String dssid = getDatasetIdRef(
+                  af.getViewport().getAlignment().getDataset());
           if (!dsses.containsKey(dssid))
           {
             dsses.put(dssid, af);
@@ -628,8 +628,8 @@ public class Jalview2XML
 
     if (shortName.indexOf(File.separatorChar) > -1)
     {
-      shortName = shortName.substring(shortName
-              .lastIndexOf(File.separatorChar) + 1);
+      shortName = shortName
+              .substring(shortName.lastIndexOf(File.separatorChar) + 1);
     }
 
     int count = 1;
@@ -762,8 +762,8 @@ public class Jalview2XML
     object.setVamsasModel(new jalview.schemabinding.version2.VamsasModel());
 
     object.setCreationDate(new java.util.Date(System.currentTimeMillis()));
-    object.setVersion(jalview.bin.Cache.getDefault("VERSION",
-            "Development Build"));
+    object.setVersion(
+            jalview.bin.Cache.getDefault("VERSION", "Development Build"));
 
     /**
      * rjal is full height alignment, jal is actual alignment with full metadata
@@ -856,8 +856,8 @@ public class Jalview2XML
         if (av.hasHiddenRows())
         {
           // use rjal, contains the full height alignment
-          jseq.setHidden(av.getAlignment().getHiddenSequences()
-                  .isHidden(jds));
+          jseq.setHidden(
+                  av.getAlignment().getHiddenSequences().isHidden(jds));
 
           if (av.isHiddenRepSequence(jds))
           {
@@ -952,8 +952,8 @@ public class Jalview2XML
             if (frames[f] instanceof StructureViewerBase)
             {
               StructureViewerBase viewFrame = (StructureViewerBase) frames[f];
-              matchedFile = saveStructureState(ap, jds, pdb, entry,
-                      viewIds, matchedFile, viewFrame);
+              matchedFile = saveStructureState(ap, jds, pdb, entry, viewIds,
+                      matchedFile, viewFrame);
               /*
                * Only store each structure viewer's state once in the project
                * jar. First time through only (storeDS==false)
@@ -969,8 +969,8 @@ public class Jalview2XML
                           viewerState.getBytes());
                 } catch (IOException e)
                 {
-                  System.err.println("Error saving viewer state: "
-                          + e.getMessage());
+                  System.err.println(
+                          "Error saving viewer state: " + e.getMessage());
                 }
               }
             }
@@ -1042,8 +1042,8 @@ public class Jalview2XML
           {
             AlcodMap alcmap = new AlcodMap();
             alcmap.setDnasq(seqHash(dnas[m]));
-            alcmap.setMapping(createVamsasMapping(pmaps[m], dnas[m], null,
-                    false));
+            alcmap.setMapping(
+                    createVamsasMapping(pmaps[m], dnas[m], null, false));
             alc.addAlcodMap(alcmap);
             hasMap = true;
           }
@@ -1180,16 +1180,15 @@ public class Jalview2XML
         ColourSchemeI colourScheme = sg.getColourScheme();
         if (colourScheme != null)
         {
-          ResidueShaderI groupColourScheme = sg
-                  .getGroupColourScheme();
+          ResidueShaderI groupColourScheme = sg.getGroupColourScheme();
           if (groupColourScheme.conservationApplied())
           {
             jGroup.setConsThreshold(groupColourScheme.getConservationInc());
 
             if (colourScheme instanceof jalview.schemes.UserColourScheme)
             {
-              jGroup.setColour(setUserColourScheme(colourScheme,
-                      userColours, jms));
+              jGroup.setColour(
+                      setUserColourScheme(colourScheme, userColours, jms));
             }
             else
             {
@@ -1205,8 +1204,8 @@ public class Jalview2XML
           }
           else if (colourScheme instanceof jalview.schemes.UserColourScheme)
           {
-            jGroup.setColour(setUserColourScheme(colourScheme,
-                    userColours, jms));
+            jGroup.setColour(
+                    setUserColourScheme(colourScheme, userColours, jms));
           }
           else
           {
@@ -1241,8 +1240,8 @@ public class Jalview2XML
       // /////////SAVE VIEWPORT
       Viewport view = new Viewport();
       view.setTitle(ap.alignFrame.getTitle());
-      view.setSequenceSetId(makeHashCode(av.getSequenceSetId(),
-              av.getSequenceSetId()));
+      view.setSequenceSetId(
+              makeHashCode(av.getSequenceSetId(), av.getSequenceSetId()));
       view.setId(av.getViewId());
       if (av.getCodingComplement() != null)
       {
@@ -1280,7 +1279,8 @@ public class Jalview2XML
         view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(),
                 userColours, jms));
       }
-      else if (av.getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient)
+      else if (av
+              .getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient)
       {
         AnnotationColours ac = constructAnnotationColours(
                 (jalview.schemes.AnnotationColourGradient) av
@@ -1292,8 +1292,8 @@ public class Jalview2XML
       }
       else
       {
-        view.setBgColour(ColourSchemeProperty.getColourName(av
-                .getGlobalColourScheme()));
+        view.setBgColour(ColourSchemeProperty
+                .getColourName(av.getGlobalColourScheme()));
       }
 
       ResidueShaderI vcs = av.getResidueShading();
@@ -1368,16 +1368,16 @@ public class Jalview2XML
               setting.setAutoScale(fcol.isAutoScaled());
               setting.setThreshold(fcol.getThreshold());
               // -1 = No threshold, 0 = Below, 1 = Above
-              setting.setThreshstate(fcol.isAboveThreshold() ? 1 : (fcol
-                      .isBelowThreshold() ? 0 : -1));
+              setting.setThreshstate(fcol.isAboveThreshold() ? 1
+                      : (fcol.isBelowThreshold() ? 0 : -1));
             }
             else
             {
               setting.setColour(fcol.getColour().getRGB());
             }
 
-            setting.setDisplay(av.getFeaturesDisplayed().isVisible(
-                    featureType));
+            setting.setDisplay(
+                    av.getFeaturesDisplayed().isVisible(featureType));
             float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer()
                     .getOrder(featureType);
             if (rorder > -1)
@@ -1404,7 +1404,7 @@ public class Jalview2XML
           g.setName(grp);
           g.setDisplay(((Boolean) ap.getSeqPanel().seqCanvas
                   .getFeatureRenderer().checkGroupVisibility(grp, false))
-                  .booleanValue());
+                          .booleanValue());
           fs.addGroup(g);
           groupsAdded.addElement(grp);
         }
@@ -1421,8 +1421,7 @@ public class Jalview2XML
         }
         else
         {
-          ArrayList<int[]> hiddenRegions = hidden
-                  .getHiddenColumnsCopy();
+          ArrayList<int[]> hiddenRegions = hidden.getHiddenColumnsCopy();
           for (int[] region : hiddenRegions)
           {
             HiddenColumns hc = new HiddenColumns();
@@ -1463,8 +1462,8 @@ public class Jalview2XML
         System.out.println("Writing jar entry " + fileName);
         JarEntry entry = new JarEntry(fileName);
         jout.putNextEntry(entry);
-        PrintWriter pout = new PrintWriter(new OutputStreamWriter(jout,
-                UTF_8));
+        PrintWriter pout = new PrintWriter(
+                new OutputStreamWriter(jout, UTF_8));
         Marshaller marshaller = new Marshaller(pout);
         marshaller.marshal(object);
         pout.flush();
@@ -1665,8 +1664,8 @@ public class Jalview2XML
       final PDBEntry pdbentry = bindingModel.getPdbEntry(peid);
       final String pdbId = pdbentry.getId();
       if (!pdbId.equals(entry.getId())
-              && !(entry.getId().length() > 4 && entry.getId()
-                      .toLowerCase().startsWith(pdbId.toLowerCase())))
+              && !(entry.getId().length() > 4 && entry.getId().toLowerCase()
+                      .startsWith(pdbId.toLowerCase())))
       {
         /*
          * not interested in a binding to a different PDB entry here
@@ -1679,8 +1678,8 @@ public class Jalview2XML
       }
       else if (!matchedFile.equals(pdbentry.getFile()))
       {
-        Cache.log
-                .warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): "
+        Cache.log.warn(
+                "Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): "
                         + pdbentry.getFile());
       }
       // record the
@@ -1689,7 +1688,8 @@ public class Jalview2XML
       // match is ambiguous (e.g.
       // 1QIP==1qipA)
 
-      for (int smap = 0; smap < viewFrame.getBinding().getSequence()[peid].length; smap++)
+      for (int smap = 0; smap < viewFrame.getBinding()
+              .getSequence()[peid].length; smap++)
       {
         // if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
         if (jds == viewFrame.getBinding().getSequence()[peid][smap])
@@ -1733,12 +1733,13 @@ public class Jalview2XML
     ac.setAnnotation(acg.getAnnotation().annotationId);
     if (acg.getBaseColour() instanceof UserColourScheme)
     {
-      ac.setColourScheme(setUserColourScheme(acg.getBaseColour(),
-              userColours, jms));
+      ac.setColourScheme(
+              setUserColourScheme(acg.getBaseColour(), userColours, jms));
     }
     else
     {
-      ac.setColourScheme(ColourSchemeProperty.getColourName(acg.getBaseColour()));
+      ac.setColourScheme(
+              ColourSchemeProperty.getColourName(acg.getBaseColour()));
     }
 
     ac.setMaxColour(acg.getMaxColour().getRGB());
@@ -1781,11 +1782,10 @@ public class Jalview2XML
         if (groupIdr == null)
         {
           // make a locally unique String
-          groupRefs.put(
-                  annotation.groupRef,
+          groupRefs.put(annotation.groupRef,
                   groupIdr = ("" + System.currentTimeMillis()
-                          + annotation.groupRef.getName() + groupRefs
-                          .size()));
+                          + annotation.groupRef.getName()
+                          + groupRefs.size()));
         }
         an.setGroupRef(groupIdr.toString());
       }
@@ -1865,7 +1865,8 @@ public class Jalview2XML
           }
           if (annotation.annotations[a].displayCharacter != null)
           {
-            ae.setDisplayCharacter(annotation.annotations[a].displayCharacter);
+            ae.setDisplayCharacter(
+                    annotation.annotations[a].displayCharacter);
           }
 
           if (!Float.isNaN(annotation.annotations[a].value))
@@ -1876,8 +1877,8 @@ public class Jalview2XML
           ae.setPosition(a);
           if (annotation.annotations[a].secondaryStructure > ' ')
           {
-            ae.setSecondaryStructure(annotation.annotations[a].secondaryStructure
-                    + "");
+            ae.setSecondaryStructure(
+                    annotation.annotations[a].secondaryStructure + "");
           }
 
           if (annotation.annotations[a].colour != null
@@ -1939,8 +1940,8 @@ public class Jalview2XML
       // need to be able to recover 1) settings 2) user-defined presets or
       // recreate settings from preset 3) predefined settings provided by
       // service - or settings that can be transferred (or discarded)
-      vCalcIdParam.setParameters(settings.getWsParamFile().replace("\n",
-              "|\\n|"));
+      vCalcIdParam.setParameters(
+              settings.getWsParamFile().replace("\n", "|\\n|"));
       vCalcIdParam.setAutoUpdate(settings.isAutoUpdate());
       // todo - decide if updateImmediately is needed for any projects.
 
@@ -2000,8 +2001,8 @@ public class Jalview2XML
       }
     }
     throw new Error(MessageManager.formatMessage(
-            "error.unsupported_version_calcIdparam",
-            new Object[] { calcIdParam.toString() }));
+            "error.unsupported_version_calcIdparam", new Object[]
+            { calcIdParam.toString() }));
   }
 
   /**
@@ -2243,8 +2244,8 @@ public class Jalview2XML
 
     for (int i = 0; i < 24; i++)
     {
-      newColours[i] = new java.awt.Color(Integer.parseInt(colours
-              .getUserColourScheme().getColour(i).getRGB(), 16));
+      newColours[i] = new java.awt.Color(Integer.parseInt(
+              colours.getUserColourScheme().getColour(i).getRGB(), 16));
     }
 
     jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(
@@ -2255,8 +2256,9 @@ public class Jalview2XML
       newColours = new java.awt.Color[23];
       for (int i = 0; i < 23; i++)
       {
-        newColours[i] = new java.awt.Color(Integer.parseInt(colours
-                .getUserColourScheme().getColour(i + 24).getRGB(), 16));
+        newColours[i] = new java.awt.Color(Integer.parseInt(
+                colours.getUserColourScheme().getColour(i + 24).getRGB(),
+                16));
       }
       ucs.setLowerCaseColours(newColours);
     }
@@ -2410,8 +2412,8 @@ public class Jalview2XML
           if (true) // !skipViewport(object))
           {
             _af = loadFromObject(object, file, true, jprovider);
-            if (_af != null
-                    && object.getJalviewModelSequence().getViewportCount() > 0)
+            if (_af != null && object.getJalviewModelSequence()
+                    .getViewportCount() > 0)
             {
               if (af == null)
               {
@@ -2443,8 +2445,8 @@ public class Jalview2XML
     {
       ex.printStackTrace();
       errorMessage = "Couldn't locate Jalview XML file : " + file;
-      System.err.println("Exception whilst loading jalview XML file : "
-              + ex + "\n");
+      System.err.println(
+              "Exception whilst loading jalview XML file : " + ex + "\n");
     } catch (Exception ex)
     {
       System.err.println("Parsing as Jalview Version 2 file failed.");
@@ -2473,8 +2475,8 @@ public class Jalview2XML
       }
       ex.printStackTrace();
 
-      System.err.println("Exception whilst loading jalview XML file : "
-              + ex + "\n");
+      System.err.println(
+              "Exception whilst loading jalview XML file : " + ex + "\n");
     } catch (OutOfMemoryError e)
     {
       // Don't use the OOM Window here
@@ -2500,8 +2502,9 @@ public class Jalview2XML
     {
       if (ds.getCodonFrames() != null)
       {
-        StructureSelectionManager.getStructureSelectionManager(
-                Desktop.instance).registerMappings(ds.getCodonFrames());
+        StructureSelectionManager
+                .getStructureSelectionManager(Desktop.instance)
+                .registerMappings(ds.getCodonFrames());
       }
     }
     if (errorMessage != null)
@@ -2651,12 +2654,11 @@ public class Jalview2XML
           @Override
           public void run()
           {
-            JvOptionPane
-                    .showInternalMessageDialog(Desktop.desktop,
-                            finalErrorMessage, "Error "
-                                    + (saving ? "saving" : "loading")
-                                    + " Jalview file",
-                            JvOptionPane.WARNING_MESSAGE);
+            JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+                    finalErrorMessage,
+                    "Error " + (saving ? "saving" : "loading")
+                            + " Jalview file",
+                    JvOptionPane.WARNING_MESSAGE);
           }
         });
       }
@@ -2858,8 +2860,8 @@ public class Jalview2XML
           if (tmpSeq.getStart() != jseqs[i].getStart()
                   || tmpSeq.getEnd() != jseqs[i].getEnd())
           {
-            System.err
-                    .println("Warning JAL-2154 regression: updating start/end for sequence "
+            System.err.println(
+                    "Warning JAL-2154 regression: updating start/end for sequence "
                             + tmpSeq.toString() + " to " + jseqs[i]);
           }
         }
@@ -2932,7 +2934,8 @@ public class Jalview2XML
     }
     else
     {
-      boolean isdsal = object.getJalviewModelSequence().getViewportCount() == 0;
+      boolean isdsal = object.getJalviewModelSequence()
+              .getViewportCount() == 0;
       if (isdsal)
       {
         // we are importing a dataset record, so
@@ -3012,7 +3015,8 @@ public class Jalview2XML
         {
           // adds dbrefs to datasequence's set (since Jalview 2.10)
           addDBRefs(
-                  al.getSequenceAt(i).getDatasetSequence() == null ? al.getSequenceAt(i)
+                  al.getSequenceAt(i).getDatasetSequence() == null
+                          ? al.getSequenceAt(i)
                           : al.getSequenceAt(i).getDatasetSequence(),
                   vamsasSeq[i]);
         }
@@ -3057,8 +3061,9 @@ public class Jalview2XML
                 }
               }
             }
-            StructureSelectionManager.getStructureSelectionManager(
-                    Desktop.instance).registerPDBEntry(entry);
+            StructureSelectionManager
+                    .getStructureSelectionManager(Desktop.instance)
+                    .registerPDBEntry(entry);
             // adds PDBEntry to datasequence's set (since Jalview 2.10)
             if (al.getSequenceAt(i).getDatasetSequence() != null)
             {
@@ -3103,8 +3108,8 @@ public class Jalview2XML
               else
               {
                 // defer to later
-                frefedSequence.add(newAlcodMapRef(maps[m].getDnasq(), cf,
-                        mapping));
+                frefedSequence.add(
+                        newAlcodMapRef(maps[m].getDnasq(), cf, mapping));
               }
             }
           }
@@ -3145,9 +3150,8 @@ public class Jalview2XML
             annotation.setAutoCalculated(true);
           }
         }
-        if (autoForView
-                || (annotation.hasAutoCalculated() && annotation
-                        .isAutoCalculated()))
+        if (autoForView || (annotation.hasAutoCalculated()
+                && annotation.isAutoCalculated()))
         {
           // remove ID - we don't recover annotation from other views for
           // view-specific annotation
@@ -3189,10 +3193,12 @@ public class Jalview2XML
 
             anot[anpos] = new jalview.datamodel.Annotation(
 
-            ae[aa].getDisplayCharacter(), ae[aa].getDescription(),
-                    (ae[aa].getSecondaryStructure() == null || ae[aa]
-                            .getSecondaryStructure().length() == 0) ? ' '
-                            : ae[aa].getSecondaryStructure().charAt(0),
+                    ae[aa].getDisplayCharacter(), ae[aa].getDescription(),
+                    (ae[aa].getSecondaryStructure() == null
+                            || ae[aa].getSecondaryStructure().length() == 0)
+                                    ? ' '
+                                    : ae[aa].getSecondaryStructure()
+                                            .charAt(0),
                     ae[aa].getValue()
 
             );
@@ -3226,10 +3232,11 @@ public class Jalview2XML
           jaa._linecolour = firstColour;
           if (annotation.getThresholdLine() != null)
           {
-            jaa.setThreshold(new jalview.datamodel.GraphLine(annotation
-                    .getThresholdLine().getValue(), annotation
-                    .getThresholdLine().getLabel(), new java.awt.Color(
-                    annotation.getThresholdLine().getColour())));
+            jaa.setThreshold(new jalview.datamodel.GraphLine(
+                    annotation.getThresholdLine().getValue(),
+                    annotation.getThresholdLine().getLabel(),
+                    new java.awt.Color(
+                            annotation.getThresholdLine().getColour())));
 
           }
           if (autoForView || annotation.isAutoCalculated())
@@ -3360,7 +3367,8 @@ public class Jalview2XML
           }
           else
           {
-            cs = ColourSchemeProperty.getColourScheme(al, jGroup.getColour());
+            cs = ColourSchemeProperty.getColourScheme(al,
+                    jGroup.getColour());
           }
         }
         int pidThreshold = jGroup.getPidThreshold();
@@ -3387,13 +3395,15 @@ public class Jalview2XML
                 jGroup.getDisplayBoxes(), jGroup.getDisplayText(),
                 jGroup.getColourText(), jGroup.getStart(), jGroup.getEnd());
         sg.getGroupColourScheme().setThreshold(pidThreshold, true);
-        sg.getGroupColourScheme().setConservationInc(jGroup.getConsThreshold());
+        sg.getGroupColourScheme()
+                .setConservationInc(jGroup.getConsThreshold());
         sg.setOutlineColour(new java.awt.Color(jGroup.getOutlineColour()));
 
         sg.textColour = new java.awt.Color(jGroup.getTextCol1());
         sg.textColour2 = new java.awt.Color(jGroup.getTextCol2());
-        sg.setShowNonconserved(jGroup.hasShowUnconserved() ? jGroup
-                .isShowUnconserved() : false);
+        sg.setShowNonconserved(
+                jGroup.hasShowUnconserved() ? jGroup.isShowUnconserved()
+                        : false);
         sg.thresholdTextColour = jGroup.getTextColThreshold();
         if (jGroup.hasShowConsensusHistogram())
         {
@@ -3414,8 +3424,8 @@ public class Jalview2XML
         }
         if (jGroup.getConsThreshold() != 0)
         {
-          Conservation c = new Conservation("All", sg.getSequences(null),
-                  0, sg.getWidth() - 1);
+          Conservation c = new Conservation("All", sg.getSequences(null), 0,
+                  sg.getWidth() - 1);
           c.calculate();
           c.verdict(false, 25);
           sg.cs.setConservation(c);
@@ -3424,8 +3434,8 @@ public class Jalview2XML
         if (jGroup.getId() != null && groupAnnotRefs.size() > 0)
         {
           // re-instate unique group/annotation row reference
-          List<AlignmentAnnotation> jaal = groupAnnotRefs.get(jGroup
-                  .getId());
+          List<AlignmentAnnotation> jaal = groupAnnotRefs
+                  .get(jGroup.getId());
           if (jaal != null)
           {
             for (AlignmentAnnotation jaa : jaal)
@@ -3471,8 +3481,8 @@ public class Jalview2XML
     // to the same sequenceSet. We must modify this id on load
     // so that each load of the file gives a unique id
     String uniqueSeqSetId = view.getSequenceSetId() + uniqueSetSuffix;
-    String viewId = (view.getId() == null ? null : view.getId()
-            + uniqueSetSuffix);
+    String viewId = (view.getId() == null ? null
+            : view.getId() + uniqueSetSuffix);
     AlignFrame af = null;
     AlignViewport av = null;
     // now check to see if we really need to create a new viewport.
@@ -3485,8 +3495,8 @@ public class Jalview2XML
       // XML.
       // and then recover its containing af to allow the settings to be applied.
       // TODO: fix for vamsas demo
-      System.err
-              .println("About to recover a viewport for existing alignment: Sequence set ID is "
+      System.err.println(
+              "About to recover a viewport for existing alignment: Sequence set ID is "
                       + uniqueSeqSetId);
       Object seqsetobj = retrieveExistingObj(uniqueSeqSetId);
       if (seqsetobj != null)
@@ -3494,14 +3504,14 @@ public class Jalview2XML
         if (seqsetobj instanceof String)
         {
           uniqueSeqSetId = (String) seqsetobj;
-          System.err
-                  .println("Recovered extant sequence set ID mapping for ID : New Sequence set ID is "
+          System.err.println(
+                  "Recovered extant sequence set ID mapping for ID : New Sequence set ID is "
                           + uniqueSeqSetId);
         }
         else
         {
-          System.err
-                  .println("Warning : Collision between sequence set ID string and existing jalview object mapping.");
+          System.err.println(
+                  "Warning : Collision between sequence set ID string and existing jalview object mapping.");
         }
 
       }
@@ -3510,8 +3520,8 @@ public class Jalview2XML
      * indicate that annotation colours are applied across all groups (pre
      * Jalview 2.8.1 behaviour)
      */
-    boolean doGroupAnnColour = Jalview2XML.isVersionStringLaterThan(
-            "2.8.1", object.getVersion());
+    boolean doGroupAnnColour = Jalview2XML.isVersionStringLaterThan("2.8.1",
+            object.getVersion());
 
     AlignmentPanel ap = null;
     boolean isnewview = true;
@@ -3586,15 +3596,15 @@ public class Jalview2XML
       for (int i = 0; i < jseq.getRnaViewerCount(); i++)
       {
         RnaViewer viewer = jseq.getRnaViewer(i);
-        AppVarna appVarna = findOrCreateVarnaViewer(viewer,
-                uniqueSetSuffix, ap);
+        AppVarna appVarna = findOrCreateVarnaViewer(viewer, uniqueSetSuffix,
+                ap);
 
         for (int j = 0; j < viewer.getSecondaryStructureCount(); j++)
         {
           SecondaryStructure ss = viewer.getSecondaryStructure(j);
           SequenceI seq = seqRefIds.get(jseq.getId());
-          AlignmentAnnotation ann = this.annotationIds.get(ss
-                  .getAnnotationId());
+          AlignmentAnnotation ann = this.annotationIds
+                  .get(ss.getAnnotationId());
 
           /*
            * add the structure to the Varna display (with session state copied
@@ -3648,10 +3658,9 @@ public class Jalview2XML
     /*
      * viewer not found - make it
      */
-    RnaViewerModel model = new RnaViewerModel(postLoadId,
-            viewer.getTitle(), viewer.getXpos(), viewer.getYpos(),
-            viewer.getWidth(), viewer.getHeight(),
-            viewer.getDividerLocation());
+    RnaViewerModel model = new RnaViewerModel(postLoadId, viewer.getTitle(),
+            viewer.getXpos(), viewer.getYpos(), viewer.getWidth(),
+            viewer.getHeight(), viewer.getDividerLocation());
     AppVarna varna = new AppVarna(model, ap);
 
     return varna;
@@ -3695,8 +3704,8 @@ public class Jalview2XML
           // TODO: should check if tp has been manipulated by user - if so its
           // settings shouldn't be modified
           tp.setTitle(tree.getTitle());
-          tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree
-                  .getWidth(), tree.getHeight()));
+          tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(),
+                  tree.getWidth(), tree.getHeight()));
           tp.av = av; // af.viewport; // TODO: verify 'associate with all
           // views'
           // works still
@@ -3716,13 +3725,13 @@ public class Jalview2XML
 
         if (tree.getFontName() != null)
         {
-          tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree
-                  .getFontStyle(), tree.getFontSize()));
+          tp.setTreeFont(new java.awt.Font(tree.getFontName(),
+                  tree.getFontStyle(), tree.getFontSize()));
         }
         else
         {
-          tp.setTreeFont(new java.awt.Font(view.getFontName(), view
-                  .getFontStyle(), tree.getFontSize()));
+          tp.setTreeFont(new java.awt.Font(view.getFontName(),
+                  view.getFontStyle(), tree.getFontSize()));
         }
 
         tp.showPlaceholders(tree.getMarkUnlinked());
@@ -3793,12 +3802,12 @@ public class Jalview2XML
             // TODO: NOW: check that this recovers the PDB file correctly.
             String pdbFile = loadPDBFile(jprovider, ids[p].getId(),
                     ids[p].getFile());
-            jalview.datamodel.SequenceI seq = seqRefIds.get(jseqs[i]
-                    .getId() + "");
+            jalview.datamodel.SequenceI seq = seqRefIds
+                    .get(jseqs[i].getId() + "");
             if (sviewid == null)
             {
-              sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width
-                      + "," + height;
+              sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width + ","
+                      + height;
             }
             if (!structureViewers.containsKey(sviewid))
             {
@@ -3817,8 +3826,9 @@ public class Jalview2XML
             // linkAlignPanel,superposeWithAlignpanel}} from hash
             StructureViewerModel jmoldat = structureViewers.get(sviewid);
             jmoldat.setAlignWithPanel(jmoldat.isAlignWithPanel()
-                    | (structureState.hasAlignwithAlignPanel() ? structureState
-                            .getAlignwithAlignPanel() : false));
+                    | (structureState.hasAlignwithAlignPanel()
+                            ? structureState.getAlignwithAlignPanel()
+                            : false));
 
             /*
              * Default colour by linked panel to false if not specified (e.g.
@@ -3826,8 +3836,9 @@ public class Jalview2XML
              */
             boolean colourWithAlignPanel = jmoldat.isColourWithAlignPanel();
             colourWithAlignPanel |= (structureState
-                    .hasColourwithAlignPanel() ? structureState
-                    .getColourwithAlignPanel() : false);
+                    .hasColourwithAlignPanel()
+                            ? structureState.getColourwithAlignPanel()
+                            : false);
             jmoldat.setColourWithAlignPanel(colourWithAlignPanel);
 
             /*
@@ -3835,8 +3846,9 @@ public class Jalview2XML
              * pre-2.7 projects)
              */
             boolean colourByViewer = jmoldat.isColourByViewer();
-            colourByViewer &= structureState.hasColourByJmol() ? structureState
-                    .getColourByJmol() : true;
+            colourByViewer &= structureState.hasColourByJmol()
+                    ? structureState.getColourByJmol()
+                    : true;
             jmoldat.setColourByViewer(colourByViewer);
 
             if (jmoldat.getStateData().length() < structureState
@@ -3852,8 +3864,7 @@ public class Jalview2XML
               StructureData seqstrmaps = jmoldat.getFileData().get(mapkey);
               if (seqstrmaps == null)
               {
-                jmoldat.getFileData().put(
-                        mapkey,
+                jmoldat.getFileData().put(mapkey,
                         seqstrmaps = jmoldat.new StructureData(pdbFile,
                                 ids[p].getId()));
               }
@@ -3881,8 +3892,8 @@ public class Jalview2XML
         createOrLinkStructureViewer(entry, af, ap, jprovider);
       } catch (Exception e)
       {
-        System.err.println("Error loading structure viewer: "
-                + e.getMessage());
+        System.err.println(
+                "Error loading structure viewer: " + e.getMessage());
         // failed - try the next one
       }
     }
@@ -3974,8 +3985,8 @@ public class Jalview2XML
 
     // TODO use StructureViewer as a factory here, see JAL-1761
     final PDBEntry[] pdbArray = pdbs.toArray(new PDBEntry[pdbs.size()]);
-    final SequenceI[][] seqsArray = allseqs.toArray(new SequenceI[allseqs
-            .size()][]);
+    final SequenceI[][] seqsArray = allseqs
+            .toArray(new SequenceI[allseqs.size()][]);
     String newViewId = viewerData.getKey();
 
     ChimeraViewFrame cvf = new ChimeraViewFrame(chimeraSessionFile,
@@ -4086,8 +4097,8 @@ public class Jalview2XML
        */
       histbug += 10;
       int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", histbug);
-      String val = (diff == -1) ? null : newFileLoc
-              .substring(histbug, diff);
+      String val = (diff == -1) ? null
+              : newFileLoc.substring(histbug, diff);
       if (val != null && val.length() >= 4)
       {
         if (val.contains("e")) // eh? what can it be?
@@ -4105,8 +4116,8 @@ public class Jalview2XML
       }
     }
 
-    final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames
-            .size()]);
+    final String[] pdbf = pdbfilenames
+            .toArray(new String[pdbfilenames.size()]);
     final String[] id = pdbids.toArray(new String[pdbids.size()]);
     final SequenceI[][] sq = seqmaps
             .toArray(new SequenceI[seqmaps.size()][]);
@@ -4125,10 +4136,11 @@ public class Jalview2XML
           JalviewStructureDisplayI sview = null;
           try
           {
-            sview = new StructureViewer(alf.alignPanel
-                    .getStructureSelectionManager()).createView(
-                    StructureViewer.ViewerType.JMOL, pdbf, id, sq,
-                    alf.alignPanel, svattrib, fileloc, rect, sviewid);
+            sview = new StructureViewer(
+                    alf.alignPanel.getStructureSelectionManager())
+                            .createView(StructureViewer.ViewerType.JMOL,
+                                    pdbf, id, sq, alf.alignPanel, svattrib,
+                                    fileloc, rect, sviewid);
             addNewStructureViewer(sview);
           } catch (OutOfMemoryError ex)
           {
@@ -4188,9 +4200,8 @@ public class Jalview2XML
         /*
          * Post jalview 2.4 schema includes structure view id
          */
-        if (sviewid != null
-                && ((StructureViewerBase) frame).getViewId()
-                        .equals(sviewid))
+        if (sviewid != null && ((StructureViewerBase) frame).getViewId()
+                .equals(sviewid))
         {
           comp = (StructureViewerBase) frame;
           break; // break added in 2.9
@@ -4362,8 +4373,9 @@ public class Jalview2XML
 
     for (int i = 0; i < JSEQ.length; i++)
     {
-      af.viewport.setSequenceColour(af.viewport.getAlignment()
-              .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour()));
+      af.viewport.setSequenceColour(
+              af.viewport.getAlignment().getSequenceAt(i),
+              new java.awt.Color(JSEQ[i].getColour()));
     }
 
     if (al.hasSeqrep())
@@ -4403,8 +4415,8 @@ public class Jalview2XML
         for (int r = 0; r < JSEQ[s].getHiddenSequencesCount(); r++)
         {
           isRepresentative = true;
-          SequenceI sequenceToHide = al.getSequenceAt(JSEQ[s]
-                  .getHiddenSequences(r));
+          SequenceI sequenceToHide = al
+                  .getSequenceAt(JSEQ[s].getHiddenSequences(r));
           hidden.addSequence(sequenceToHide, false);
           // remove from hiddenSeqs list so we don't try to hide it twice
           hiddenSeqs.remove(sequenceToHide);
@@ -4417,8 +4429,8 @@ public class Jalview2XML
         }
       }
 
-      SequenceI[] hseqs = hiddenSeqs.toArray(new SequenceI[hiddenSeqs
-              .size()]);
+      SequenceI[] hseqs = hiddenSeqs
+              .toArray(new SequenceI[hiddenSeqs.size()]);
       af.viewport.hideSequence(hseqs);
 
     }
@@ -4434,9 +4446,8 @@ public class Jalview2XML
     af.viewport.setIncrement(view.getConsThreshold());
     af.viewport.setShowJVSuffix(view.getShowFullId());
     af.viewport.setRightAlignIds(view.getRightAlignIds());
-    af.viewport.setFont(
-            new java.awt.Font(view.getFontName(), view.getFontStyle(), view
-                    .getFontSize()), true);
+    af.viewport.setFont(new java.awt.Font(view.getFontName(),
+            view.getFontStyle(), view.getFontSize()), true);
     ViewStyleI vs = af.viewport.getViewStyle();
     vs.setScaleProteinAsCdna(view.isScaleProteinAsCdna());
     af.viewport.setViewStyle(vs);
@@ -4453,8 +4464,8 @@ public class Jalview2XML
     af.viewport.setTextColour(new java.awt.Color(view.getTextCol1()));
     af.viewport.setTextColour2(new java.awt.Color(view.getTextCol2()));
     af.viewport.setThresholdTextColour(view.getTextColThreshold());
-    af.viewport.setShowUnconserved(view.hasShowUnconserved() ? view
-            .isShowUnconserved() : false);
+    af.viewport.setShowUnconserved(
+            view.hasShowUnconserved() ? view.isShowUnconserved() : false);
     af.viewport.getRanges().setStartRes(view.getStartRes());
 
     if (view.getViewName() != null)
@@ -4491,14 +4502,14 @@ public class Jalview2XML
     af.viewport.setGlobalColourScheme(cs);
     af.viewport.getResidueShading().setThreshold(view.getPidThreshold(),
             view.getIgnoreGapsinConsensus());
-    af.viewport.getResidueShading().setConsensus(
-            af.viewport.getSequenceConsensusHash());
+    af.viewport.getResidueShading()
+            .setConsensus(af.viewport.getSequenceConsensusHash());
     af.viewport.setColourAppliesToAllGroups(false);
 
     if (view.getConservationSelected() && cs != null)
     {
-      af.viewport.getResidueShading().setConservationInc(
-              view.getConsThreshold());
+      af.viewport.getResidueShading()
+              .setConservationInc(view.getConsThreshold());
     }
 
     af.changeColour(cs);
@@ -4526,8 +4537,8 @@ public class Jalview2XML
     }
     if (view.hasShowConsensusHistogram())
     {
-      af.viewport.setShowConsensusHistogram(view
-              .getShowConsensusHistogram());
+      af.viewport
+              .setShowConsensusHistogram(view.getShowConsensusHistogram());
     }
     else
     {
@@ -4580,17 +4591,18 @@ public class Jalview2XML
       Map<String, FeatureColourI> featureColours = new Hashtable<>();
       Map<String, Float> featureOrder = new Hashtable<>();
 
-      for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)
+      for (int fs = 0; fs < jms.getFeatureSettings()
+              .getSettingCount(); fs++)
       {
         Setting setting = jms.getFeatureSettings().getSetting(fs);
         if (setting.hasMincolour())
         {
-          FeatureColourI gc = setting.hasMin() ? new FeatureColour(
-                  new Color(setting.getMincolour()), new Color(
-                          setting.getColour()), setting.getMin(),
-                  setting.getMax()) : new FeatureColour(new Color(
-                  setting.getMincolour()), new Color(setting.getColour()),
-                  0, 1);
+          FeatureColourI gc = setting.hasMin()
+                  ? new FeatureColour(new Color(setting.getMincolour()),
+                          new Color(setting.getColour()), setting.getMin(),
+                          setting.getMax())
+                  : new FeatureColour(new Color(setting.getMincolour()),
+                          new Color(setting.getColour()), 0, 1);
           if (setting.hasThreshold())
           {
             gc.setThreshold(setting.getThreshold());
@@ -4619,8 +4631,8 @@ public class Jalview2XML
         }
         else
         {
-          featureColours.put(setting.getType(), new FeatureColour(
-                  new Color(setting.getColour())));
+          featureColours.put(setting.getType(),
+                  new FeatureColour(new Color(setting.getColour())));
         }
         renderOrder[fs] = setting.getType();
         if (setting.hasOrder())
@@ -4629,8 +4641,8 @@ public class Jalview2XML
         }
         else
         {
-          featureOrder.put(setting.getType(), new Float(fs
-                  / jms.getFeatureSettings().getSettingCount()));
+          featureOrder.put(setting.getType(), new Float(
+                  fs / jms.getFeatureSettings().getSettingCount()));
         }
         if (setting.getDisplay())
         {
@@ -4646,8 +4658,8 @@ public class Jalview2XML
       // FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder,
       // fgtable, featureColours, jms.getFeatureSettings().hasTransparency() ?
       // jms.getFeatureSettings().getTransparency() : 0.0, featureOrder);
-      FeatureRendererSettings frs = new FeatureRendererSettings(
-              renderOrder, fgtable, featureColours, 1.0f, featureOrder);
+      FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder,
+              fgtable, featureColours, 1.0f, featureOrder);
       af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()
               .transferSettings(frs);
 
@@ -4657,9 +4669,9 @@ public class Jalview2XML
     {
       for (int c = 0; c < view.getHiddenColumnsCount(); c++)
       {
-        af.viewport.hideColumns(view.getHiddenColumns(c).getStart(), view
-                .getHiddenColumns(c).getEnd() // +1
-                );
+        af.viewport.hideColumns(view.getHiddenColumns(c).getStart(),
+                view.getHiddenColumns(c).getEnd() // +1
+        );
       }
     }
     if (view.getCalcIdParam() != null)
@@ -4744,7 +4756,8 @@ public class Jalview2XML
     /*
      * pre 2.10.2: saved annotationId is AlignmentAnnotation.label
      */
-    if (matchedAnnotation == null && annAlignment.getAlignmentAnnotation() != null)
+    if (matchedAnnotation == null
+            && annAlignment.getAlignmentAnnotation() != null)
     {
       for (int i = 0; i < annAlignment.getAlignmentAnnotation().length; i++)
       {
@@ -4764,22 +4777,22 @@ public class Jalview2XML
     }
     if (matchedAnnotation.getThreshold() == null)
     {
-      matchedAnnotation.setThreshold(new GraphLine(viewAnnColour.getThreshold(),
-              "Threshold", Color.black));
+      matchedAnnotation.setThreshold(new GraphLine(
+              viewAnnColour.getThreshold(), "Threshold", Color.black));
     }
 
     AnnotationColourGradient cs = null;
     if (viewAnnColour.getColourScheme().equals("None"))
     {
-      cs = new AnnotationColourGradient(matchedAnnotation, new Color(
-              viewAnnColour.getMinColour()), new Color(
-              viewAnnColour.getMaxColour()),
+      cs = new AnnotationColourGradient(matchedAnnotation,
+              new Color(viewAnnColour.getMinColour()),
+              new Color(viewAnnColour.getMaxColour()),
               viewAnnColour.getAboveThreshold());
     }
     else if (viewAnnColour.getColourScheme().startsWith("ucs"))
     {
-      cs = new AnnotationColourGradient(matchedAnnotation, getUserColourScheme(
-              jms, viewAnnColour.getColourScheme()),
+      cs = new AnnotationColourGradient(matchedAnnotation,
+              getUserColourScheme(jms, viewAnnColour.getColourScheme()),
               viewAnnColour.getAboveThreshold());
     }
     else
@@ -4838,8 +4851,9 @@ public class Jalview2XML
       for (JvAnnotRow auan : autoAlan)
       {
         visan.put(auan.template.label
-                + (auan.template.getCalcId() == null ? "" : "\t"
-                        + auan.template.getCalcId()), auan);
+                + (auan.template.getCalcId() == null ? ""
+                        : "\t" + auan.template.getCalcId()),
+                auan);
       }
       int hSize = al.getAlignmentAnnotation().length;
       List<JvAnnotRow> reorder = new ArrayList<>();
@@ -4942,8 +4956,9 @@ public class Jalview2XML
       return false;
     }
     String id;
-    if (skipList.containsKey(id = object.getJalviewModelSequence()
-            .getViewport()[0].getSequenceSetId()))
+    if (skipList.containsKey(
+            id = object.getJalviewModelSequence().getViewport()[0]
+                    .getSequenceSetId()))
     {
       if (Cache.log != null && Cache.log.isDebugEnabled())
       {
@@ -4975,8 +4990,8 @@ public class Jalview2XML
   private void recoverDatasetFor(SequenceSet vamsasSet, AlignmentI al,
           boolean ignoreUnrefed)
   {
-    jalview.datamodel.AlignmentI ds = getDatasetFor(vamsasSet
-            .getDatasetId());
+    jalview.datamodel.AlignmentI ds = getDatasetFor(
+            vamsasSet.getDatasetId());
     Vector dseqs = null;
     if (ds == null)
     {
@@ -5125,8 +5140,8 @@ public class Jalview2XML
         }
         // TODO: merges will never happen if we 'know' we have the real dataset
         // sequence - this should be detected when id==dssid
-        System.err
-                .println("DEBUG Notice:  Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // ("
+        System.err.println(
+                "DEBUG Notice:  Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // ("
         // + (pre ? "prepended" : "") + " "
         // + (post ? "appended" : ""));
       }
@@ -5232,8 +5247,9 @@ public class Jalview2XML
     {
       DBRef dr = sequence.getDBRef(d);
       jalview.datamodel.DBRefEntry entry = new jalview.datamodel.DBRefEntry(
-              sequence.getDBRef(d).getSource(), sequence.getDBRef(d)
-                      .getVersion(), sequence.getDBRef(d).getAccessionId());
+              sequence.getDBRef(d).getSource(),
+              sequence.getDBRef(d).getVersion(),
+              sequence.getDBRef(d).getAccessionId());
       if (dr.getMapping() != null)
       {
         entry.setMap(addMapping(dr.getMapping()));
@@ -5262,8 +5278,8 @@ public class Jalview2XML
       fto[_i] = mf.getStart();
       fto[_i + 1] = mf.getEnd();
     }
-    jalview.datamodel.Mapping jmap = new jalview.datamodel.Mapping(dsto,
-            fr, fto, (int) m.getMapFromUnit(), (int) m.getMapToUnit());
+    jalview.datamodel.Mapping jmap = new jalview.datamodel.Mapping(dsto, fr,
+            fto, (int) m.getMapFromUnit(), (int) m.getMapToUnit());
     if (m.getMappingChoice() != null)
     {
       MappingChoice mc = m.getMappingChoice();
@@ -5299,8 +5315,8 @@ public class Jalview2XML
         }
         else
         {
-          System.err
-                  .println("Warning - making up dataset sequence id for DbRef sequence map reference");
+          System.err.println(
+                  "Warning - making up dataset sequence id for DbRef sequence map reference");
           sqid = ((Object) ms).toString(); // make up a new hascode for
           // undefined dataset sequence hash
           // (unlikely to happen)