X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJalview2XML.java;h=ee67b55fda3dc71532edeadb62db2a920b0783b9;hb=9f7269a91e9d2fd7992c11939aa797446783ce61;hp=08deba4b501cff24acebca5c6f13452b09817875;hpb=4be05f596362591c5758f2f7a6552956f692ca3b;p=jalview.git diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 08deba4..ee67b55 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1236,12 +1236,18 @@ public class Jalview2XML } } } - if (calcIdSet.size()>0) + if (calcIdSet.size() > 0) { - for (String calcId:calcIdSet) + for (String calcId : calcIdSet) { - if (calcId.trim().length()>0) { - view.addCalcIdParam(createCalcIdParam(calcId, av)); + if (calcId.trim().length() > 0) + { + CalcIdParam cidp = createCalcIdParam(calcId, av); + // Some calcIds have no parameters. + if (cidp != null) + { + view.addCalcIdParam(cidp); + } } } } @@ -1345,15 +1351,14 @@ public class Jalview2XML } AAConsSettings settings = new AAConsSettings(calcIdParam.isAutoUpdate(), service, parmSet, argList); av.setCalcIdSettingsFor(calcIdParam.getCalcId(), settings, calcIdParam.isNeedsUpdate()); + return true; } else { warn("Cannot resolve a service for the parameters used in this project. Try configuring a JABAWS server."); return false; } } - else - throw new Error("Unsupported Version for calcIdparam " - + calcIdParam.toString()); - return false; + throw new Error("Unsupported Version for calcIdparam " + + calcIdParam.toString()); } /** * External mapping between jalview objects and objects yielding a valid and @@ -2307,24 +2312,20 @@ public class Jalview2XML jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), an[i].getDescription(), anot); } - if (autoForView) + // register new annotation + if (an[i].getId() != null) { - // register new annotation - if (an[i].getId() != null) - { - annotationIds.put(an[i].getId(), jaa); - jaa.annotationId = an[i].getId(); - } - // recover sequence association - if (an[i].getSequenceRef() != null) + annotationIds.put(an[i].getId(), jaa); + jaa.annotationId = an[i].getId(); + } + // recover sequence association + if (an[i].getSequenceRef() != null) + { + if (al.findName(an[i].getSequenceRef()) != null) { - if (al.findName(an[i].getSequenceRef()) != null) - { - jaa.createSequenceMapping( - al.findName(an[i].getSequenceRef()), 1, true); - al.findName(an[i].getSequenceRef()).addAlignmentAnnotation( - jaa); - } + jaa.createSequenceMapping(al.findName(an[i].getSequenceRef()), + 1, true); + al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(jaa); } } // and make a note of any group association @@ -3368,7 +3369,23 @@ public class Jalview2XML ); } } - + if (view.getCalcIdParam() != null) + { + for (CalcIdParam calcIdParam : view.getCalcIdParam()) + { + if (calcIdParam != null) + { + if (recoverCalcIdParam(calcIdParam, af.viewport)) + { + } + else + { + warn("Couldn't recover parameters for " + + calcIdParam.getCalcId()); + } + } + } + } af.setMenusFromViewport(af.viewport); // TODO: we don't need to do this if the viewport is aready visible. Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), @@ -3398,21 +3415,32 @@ public class Jalview2XML } for (JvAnnotRow auan : autoAlan) { - visan.put(auan.template.label, auan); + visan.put(auan.template.label+(auan.template.getCalcId()==null ? "" : "\t"+auan.template.getCalcId()), auan); } int hSize = al.getAlignmentAnnotation().length; ArrayList reorder = new ArrayList(); + // work through any autoCalculated annotation already on the view + // removing it if it should be placed in a different location on the + // annotation panel. + List remains=new ArrayList(visan.keySet()); for (int h = 0; h < hSize; h++) { jalview.datamodel.AlignmentAnnotation jalan = al .getAlignmentAnnotation()[h]; if (jalan.autoCalculated) { - JvAnnotRow valan = visan.get(jalan.label); + String k; + JvAnnotRow valan = visan.get(k=jalan.label); + if (jalan.getCalcId()!=null) + { + valan = visan.get(k=jalan.label+ "\t"+jalan.getCalcId()); + } + if (valan != null) { // delete the auto calculated row from the alignment - al.deleteAnnotation(al.getAlignmentAnnotation()[h], false); + al.deleteAnnotation(jalan, false); + remains.remove(k); hSize--; h--; if (valan != nullAnnot) @@ -3434,6 +3462,16 @@ public class Jalview2XML } } } + // Add any (possibly stale) autocalculated rows that were not appended to the view during construction + for (String other:remains) + { + JvAnnotRow othera=visan.get(other); + if (othera!=nullAnnot && othera.template.getCalcId()!=null && othera.template.getCalcId().length()>0) + { + reorder.add(othera); + } + } + // now put the automatic annotation in its correct place int s = 0, srt[] = new int[reorder.size()]; JvAnnotRow[] rws = new JvAnnotRow[reorder.size()]; for (JvAnnotRow jvar : reorder)