X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJalview2XML.java;h=22977a99d893fbe296487a5d3c44056a8ee6fc7c;hb=d423f22792e47dbc800ae220a58677f988971d06;hp=c952ea02619a8df1412ed29fb593690785c67fa4;hpb=797d4400e51c5786c080d7d746d5968589b5dc78;p=jalview.git diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index c952ea0..22977a9 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.gui; @@ -586,9 +585,9 @@ public class Jalview2XML jmol.pdbentry.getId().toLowerCase()))) continue; matchedFile = jmol.pdbentry.getFile(); // record the file so we - // can get at it if the ID - // match is ambiguous (e.g. - // 1QIP==1qipA) + // can get at it if the ID + // match is ambiguous (e.g. + // 1QIP==1qipA) StructureState state = new StructureState(); state.setVisible(true); state.setXpos(jmol.getX()); @@ -782,7 +781,6 @@ public class Jalview2XML an.setId(aa[i].annotationId); - an.setVisible(aa[i].visible); an.setDescription(aa[i].description); @@ -793,22 +791,25 @@ public class Jalview2XML // sequence rather than its display name an.setSequenceRef(aa[i].sequenceRef.getName()); } - if (aa[i].groupRef!=null) + if (aa[i].groupRef != null) { Object groupIdr = groupRefs.get(aa[i].groupRef); - if (groupIdr==null) + if (groupIdr == null) { // make a locally unique String - groupRefs.put(aa[i].groupRef, groupIdr = (""+System.currentTimeMillis()+aa[i].groupRef.getName()+groupRefs.size())); + groupRefs.put(aa[i].groupRef, + groupIdr = ("" + System.currentTimeMillis() + + aa[i].groupRef.getName() + groupRefs.size())); } an.setGroupRef(groupIdr.toString()); } if (aa[i] == av.quality || aa[i] == av.conservation || aa[i] == av.consensus || aa[i].autoCalculated) { - // new way of indicating autocalculated annotation - + // new way of indicating autocalculated annotation - an.setAutoCalculated(aa[i].autoCalculated); - // write a stub for this annotation - indicate presence of autocalc rows + // write a stub for this annotation - indicate presence of autocalc + // rows an.setLabel(aa[i].label); an.setGraph(true); vamsasSet.addAnnotation(an); @@ -895,9 +896,10 @@ public class Jalview2XML .getGroups().elementAt(i); groups[i].setStart(sg.getStartRes()); groups[i].setEnd(sg.getEndRes()); - groups[i].setName(sg.getName()); - if (groupRefs.containsKey(sg)) { - // group has references so set it's ID field + groups[i].setName(sg.getName()); + if (groupRefs.containsKey(sg)) + { + // group has references so set it's ID field groups[i].setId(groupRefs.get(sg).toString()); } if (sg.cs != null) @@ -1075,15 +1077,17 @@ public class Jalview2XML String[] renderOrder = ap.seqPanel.seqCanvas.getFeatureRenderer().renderOrder; Vector settingsAdded = new Vector(); - Object gstyle=null; - GraduatedColor gcol = null; + Object gstyle = null; + GraduatedColor gcol = null; for (int ro = 0; ro < renderOrder.length; ro++) { - gstyle = ap.seqPanel.seqCanvas.getFeatureRenderer().getFeatureStyle(renderOrder[ro]); + gstyle = ap.seqPanel.seqCanvas.getFeatureRenderer() + .getFeatureStyle(renderOrder[ro]); Setting setting = new Setting(); setting.setType(renderOrder[ro]); - if (gstyle instanceof GraduatedColor) { - gcol = (GraduatedColor) gstyle; + if (gstyle instanceof GraduatedColor) + { + gcol = (GraduatedColor) gstyle; setting.setColour(gcol.getMaxColor().getRGB()); setting.setMincolour(gcol.getMinColor().getRGB()); setting.setMin(gcol.getMin()); @@ -1092,10 +1096,13 @@ public class Jalview2XML setting.setAutoScale(gcol.isAutoScale()); setting.setThreshold(gcol.getThresh()); setting.setThreshstate(gcol.getThreshType()); - } else { - setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer() .getColour(renderOrder[ro]).getRGB()); } - + else + { + setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer() + .getColour(renderOrder[ro]).getRGB()); + } + setting.setDisplay(av.featuresDisplayed .containsKey(renderOrder[ro])); float rorder = ap.seqPanel.seqCanvas.getFeatureRenderer().getOrder( @@ -1391,14 +1398,15 @@ public class Jalview2XML { String id = null; jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme) cs; - boolean newucs=false; + boolean newucs = false; if (!userColours.contains(ucs)) { userColours.add(ucs); - newucs=true; + newucs = true; } id = "ucs" + userColours.indexOf(ucs); - if (newucs) { + if (newucs) + { // actually create the scheme's entry in the XML model java.awt.Color[] colours = ucs.getColours(); jalview.schemabinding.version2.UserColours uc = new jalview.schemabinding.version2.UserColours(); @@ -2048,7 +2056,7 @@ public class Jalview2XML { hideConsensus = false; continue; - } + } // set visiblity for other annotation in this view if (an[i].getId() != null && annotationIds.containsKey(an[i].getId())) @@ -2137,9 +2145,9 @@ public class Jalview2XML } } // and make a note of any group association - if (an[i].getGroupRef()!=null && an[i].getGroupRef().length()>0) + if (an[i].getGroupRef() != null && an[i].getGroupRef().length() > 0) { - groupAnnotRefs.put(an[i].getGroupRef(),jaa); + groupAnnotRefs.put(an[i].getGroupRef(), jaa); } if (an[i].hasScore()) @@ -2148,18 +2156,20 @@ public class Jalview2XML } if (an[i].hasVisible()) jaa.visible = an[i].getVisible(); - + if (an[i].hasCentreColLabels()) jaa.centreColLabels = an[i].getCentreColLabels(); - + if (an[i].hasScaleColLabels()) { jaa.scaleColLabel = an[i].getScaleColLabels(); } if (an[i].hasAutoCalculated() && an[i].isAutoCalculated()) { - // newer files have an 'autoCalculated' flag and store calculation state in viewport properties - jaa.autoCalculated = true; // means annotation will be marked for update at end of load. + // newer files have an 'autoCalculated' flag and store calculation + // state in viewport properties + jaa.autoCalculated = true; // means annotation will be marked for + // update at end of load. } al.addAnnotation(jaa); } @@ -2226,10 +2236,15 @@ public class Jalview2XML sg.setShowunconserved(groups[i].hasShowUnconserved() ? groups[i] .isShowUnconserved() : false); sg.thresholdTextColour = groups[i].getTextColThreshold(); - if (groups[i].hasShowConsensusHistogram()) { - sg.setShowConsensusHistogram(groups[i].isShowConsensusHistogram()); - }; - if (groups[i].hasShowSequenceLogo()) { + if (groups[i].hasShowConsensusHistogram()) + { + sg + .setShowConsensusHistogram(groups[i] + .isShowConsensusHistogram()); + } + ; + if (groups[i].hasShowSequenceLogo()) + { sg.setIncludeAllConsSymbols(groups[i].isShowSequenceLogo()); } if (groups[i].hasIgnoreGapsinConsensus()) @@ -2245,19 +2260,19 @@ public class Jalview2XML c.verdict(false, 25); sg.cs.setConservation(c); } - - if (groups[i].getId()!=null - && groupAnnotRefs.size()>0) + + if (groups[i].getId() != null && groupAnnotRefs.size() > 0) { // re-instate unique group/annotation row reference - jalview.datamodel.AlignmentAnnotation jaa = (jalview.datamodel.AlignmentAnnotation) groupAnnotRefs.get(groups[i].getId()); - if (jaa!=null) + jalview.datamodel.AlignmentAnnotation jaa = (jalview.datamodel.AlignmentAnnotation) groupAnnotRefs + .get(groups[i].getId()); + if (jaa != null) { jaa.groupRef = sg; } } al.addGroup(sg); - + } } @@ -2798,7 +2813,8 @@ public class Jalview2XML } if (view.hasIgnoreGapsinConsensus()) { - af.viewport.ignoreGapsInConsensusCalculation=view.getIgnoreGapsinConsensus(); + af.viewport.ignoreGapsInConsensusCalculation = view + .getIgnoreGapsinConsensus(); } if (view.hasFollowHighlight()) { @@ -2810,14 +2826,19 @@ public class Jalview2XML } if (view.hasShowConsensusHistogram()) { - af.viewport.setShowConsensusHistogram(view.getShowConsensusHistogram()); - } else { + af.viewport.setShowConsensusHistogram(view + .getShowConsensusHistogram()); + } + else + { af.viewport.setShowConsensusHistogram(true); } if (view.hasShowSequenceLogo()) { af.viewport.setShowSequenceLogo(view.getShowSequenceLogo()); - } else { + } + else + { af.viewport.setShowSequenceLogo(false); } if (view.hasShowDbRefTooltip()) @@ -2831,16 +2852,20 @@ public class Jalview2XML if (view.hasShowGroupConsensus()) { af.viewport.setShowGroupConsensus(view.getShowGroupConsensus()); - } else { + } + else + { af.viewport.setShowGroupConsensus(false); } if (view.hasShowGroupConservation()) { af.viewport.setShowGroupConservation(view.getShowGroupConservation()); - } else { + } + else + { af.viewport.setShowGroupConservation(false); } - + // recover featre settings if (jms.getFeatureSettings() != null) { @@ -2852,12 +2877,12 @@ public class Jalview2XML Setting setting = jms.getFeatureSettings().getSetting(fs); if (setting.hasMincolour()) { - GraduatedColor gc = setting.hasMin() ? new GraduatedColor(new java.awt.Color(setting - .getMincolour()), - new java.awt.Color(setting.getColour()), setting.getMin(), setting.getMax()) - : new GraduatedColor(new java.awt.Color(setting - .getMincolour()), - new java.awt.Color(setting.getColour()), 0,1); + GraduatedColor gc = setting.hasMin() ? new GraduatedColor( + new java.awt.Color(setting.getMincolour()), + new java.awt.Color(setting.getColour()), + setting.getMin(), setting.getMax()) : new GraduatedColor( + new java.awt.Color(setting.getMincolour()), + new java.awt.Color(setting.getColour()), 0, 1); if (setting.hasThreshold()) { gc.setThresh(setting.getThreshold()); @@ -2873,7 +2898,8 @@ public class Jalview2XML gc.setColourByLabel(setting.getColourByLabel()); } // and put in the feature colour table. - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(setting.getType(),gc); + af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour( + setting.getType(), gc); } else { @@ -3286,9 +3312,9 @@ public class Jalview2XML { uniqueSetSuffix = ""; jm.getJalviewModelSequence().getViewport(0).setId(null); // we don't - // overwrite the - // view we just - // copied + // overwrite the + // view we just + // copied } if (this.frefedSequence == null) {