X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJalview2XML.java;fp=src%2Fjalview%2Fgui%2FJalview2XML.java;h=1658f0f88d1263ad47442d82317914ef9abac389;hb=be762d8d9c71a7aa3121e845c45911c7192b7827;hp=d625918c56f8407b705a284391bf2f1b4d9a4d18;hpb=d1bb7a31fc091606aedbc255a5766ac79e36fa91;p=jalview.git diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index d625918..1658f0f88 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -361,7 +361,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") @@ -413,8 +414,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++; @@ -437,9 +438,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()) @@ -449,8 +450,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."); } } } @@ -560,9 +561,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; } @@ -582,8 +582,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); @@ -629,8 +629,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; @@ -763,8 +763,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 @@ -857,8 +857,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)) { @@ -948,8 +948,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) @@ -965,8 +965,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()); } } } @@ -1038,8 +1038,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; } @@ -1176,16 +1176,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 { @@ -1201,8 +1200,8 @@ public class Jalview2XML } else if (colourScheme instanceof jalview.schemes.UserColourScheme) { - jGroup.setColour(setUserColourScheme(colourScheme, - userColours, jms)); + jGroup.setColour( + setUserColourScheme(colourScheme, userColours, jms)); } else { @@ -1237,8 +1236,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) { @@ -1276,7 +1275,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 @@ -1288,8 +1288,8 @@ public class Jalview2XML } else { - view.setBgColour(ColourSchemeProperty.getColourName(av - .getGlobalColourScheme())); + view.setBgColour(ColourSchemeProperty + .getColourName(av.getGlobalColourScheme())); } ResidueShaderI vcs = av.getResidueShading(); @@ -1364,16 +1364,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) @@ -1400,7 +1400,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); } @@ -1417,8 +1417,7 @@ public class Jalview2XML } else { - ArrayList hiddenRegions = hidden - .getHiddenColumnsCopy(); + ArrayList hiddenRegions = hidden.getHiddenColumnsCopy(); for (int[] region : hiddenRegions) { HiddenColumns hc = new HiddenColumns(); @@ -1459,8 +1458,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(); @@ -1661,8 +1660,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 @@ -1675,8 +1674,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 @@ -1685,7 +1684,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]) @@ -1729,12 +1729,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()); @@ -1777,11 +1778,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()); } @@ -1861,7 +1861,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)) @@ -1872,8 +1873,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 @@ -1935,8 +1936,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. @@ -1996,8 +1997,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() })); } /** @@ -2239,8 +2240,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( @@ -2251,8 +2252,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); } @@ -2406,8 +2408,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) { @@ -2439,8 +2441,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."); @@ -2469,8 +2471,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 @@ -2496,8 +2498,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) @@ -2647,12 +2650,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); } }); } @@ -2854,8 +2856,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]); } } @@ -2928,7 +2930,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 @@ -3007,7 +3010,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]); } @@ -3052,8 +3056,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) { @@ -3098,8 +3103,8 @@ public class Jalview2XML else { // defer to later - frefedSequence.add(newAlcodMapRef(maps[m].getDnasq(), cf, - mapping)); + frefedSequence.add( + newAlcodMapRef(maps[m].getDnasq(), cf, mapping)); } } } @@ -3140,9 +3145,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 @@ -3184,10 +3188,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() ); @@ -3221,10 +3227,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()) @@ -3355,7 +3362,8 @@ public class Jalview2XML } else { - cs = ColourSchemeProperty.getColourScheme(al, jGroup.getColour()); + cs = ColourSchemeProperty.getColourScheme(al, + jGroup.getColour()); } } int pidThreshold = jGroup.getPidThreshold(); @@ -3382,13 +3390,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()) { @@ -3409,8 +3419,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); @@ -3419,8 +3429,8 @@ public class Jalview2XML if (jGroup.getId() != null && groupAnnotRefs.size() > 0) { // re-instate unique group/annotation row reference - List jaal = groupAnnotRefs.get(jGroup - .getId()); + List jaal = groupAnnotRefs + .get(jGroup.getId()); if (jaal != null) { for (AlignmentAnnotation jaa : jaal) @@ -3466,8 +3476,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. @@ -3480,8 +3490,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) @@ -3489,14 +3499,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."); } } @@ -3505,8 +3515,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; @@ -3581,15 +3591,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 @@ -3643,10 +3653,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; @@ -3690,8 +3699,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 @@ -3711,13 +3720,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()); @@ -3788,12 +3797,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)) { @@ -3812,8 +3821,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. @@ -3821,8 +3831,9 @@ public class Jalview2XML */ boolean colourWithAlignPanel = jmoldat.isColourWithAlignPanel(); colourWithAlignPanel |= (structureState - .hasColourwithAlignPanel() ? structureState - .getColourwithAlignPanel() : false); + .hasColourwithAlignPanel() + ? structureState.getColourwithAlignPanel() + : false); jmoldat.setColourWithAlignPanel(colourWithAlignPanel); /* @@ -3830,8 +3841,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 @@ -3847,8 +3859,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())); } @@ -3876,8 +3887,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 } } @@ -3969,8 +3980,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, @@ -4081,8 +4092,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? @@ -4100,8 +4111,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()][]); @@ -4120,10 +4131,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) { @@ -4183,9 +4195,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 @@ -4357,8 +4368,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()) @@ -4398,8 +4410,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); @@ -4412,8 +4424,8 @@ public class Jalview2XML } } - SequenceI[] hseqs = hiddenSeqs.toArray(new SequenceI[hiddenSeqs - .size()]); + SequenceI[] hseqs = hiddenSeqs + .toArray(new SequenceI[hiddenSeqs.size()]); af.viewport.hideSequence(hseqs); } @@ -4429,9 +4441,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); @@ -4448,8 +4459,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) @@ -4486,14 +4497,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); @@ -4521,8 +4532,8 @@ public class Jalview2XML } if (view.hasShowConsensusHistogram()) { - af.viewport.setShowConsensusHistogram(view - .getShowConsensusHistogram()); + af.viewport + .setShowConsensusHistogram(view.getShowConsensusHistogram()); } else { @@ -4575,17 +4586,18 @@ public class Jalview2XML Map featureColours = new Hashtable<>(); Map 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()); @@ -4614,8 +4626,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()) @@ -4624,8 +4636,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()) { @@ -4641,8 +4653,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); @@ -4652,9 +4664,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) @@ -4739,7 +4751,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++) { @@ -4759,22 +4772,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 @@ -4833,8 +4846,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 reorder = new ArrayList<>(); @@ -4937,8 +4951,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()) { @@ -4970,8 +4985,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) { @@ -5120,8 +5135,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" : "")); } @@ -5227,8 +5242,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())); @@ -5257,8 +5273,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(); @@ -5294,8 +5310,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)