X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fproject%2FJalview2XML.java;h=2b1b68725bad745622df6dd1794fe1edaa27c09b;hb=335e6b12c126bcb6825cd3f66422677db7cd91c7;hp=4b9c3481ae746f5e7fbac020b32a2d1936c3a469;hpb=3659ecfe7bb17dd25a0a6b5c94a7d9dab4525136;p=jalview.git diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 4b9c348..2b1b687 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -89,6 +89,8 @@ import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import jalview.datamodel.ContactMatrix; +import jalview.datamodel.ContactMatrixI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.GeneLocus; import jalview.datamodel.GraphLine; @@ -148,6 +150,7 @@ import jalview.viewmodel.ViewportRanges; import jalview.viewmodel.seqfeatures.FeatureRendererModel; import jalview.viewmodel.seqfeatures.FeatureRendererSettings; import jalview.viewmodel.seqfeatures.FeaturesDisplayed; +import jalview.ws.datamodel.alphafold.PAEContactMatrix; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.jabaws2.Jws2Instance; @@ -192,6 +195,7 @@ import jalview.xml.binding.jalview.JalviewUserColours.Colour; import jalview.xml.binding.jalview.MapListType.MapListFrom; import jalview.xml.binding.jalview.MapListType.MapListTo; import jalview.xml.binding.jalview.Mapping; +import jalview.xml.binding.jalview.MatrixType; import jalview.xml.binding.jalview.NoValueColour; import jalview.xml.binding.jalview.ObjectFactory; import jalview.xml.binding.jalview.PcaDataType; @@ -1510,7 +1514,7 @@ public class Jalview2XML ov.getCanvas().getResidueColour().getRGB()); overview.setHiddenColour(ov.getCanvas().getHiddenColour().getRGB()); view.setOverview(overview); - } + } if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) { view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(), @@ -2289,6 +2293,22 @@ public class Jalview2XML line.setColour(annotation.getThreshold().colour.getRGB()); an.setThresholdLine(line); } + if (annotation.graph==AlignmentAnnotation.CONTACT_MAP) + { + if (annotation.sequenceRef.getContactMaps()!=null) + { + ContactMatrixI cm = annotation.sequenceRef.getContactMatrixFor(annotation); + if (cm!=null) + { + MatrixType xmlmat = new MatrixType(); + xmlmat.setType(cm.getType()); + xmlmat.setRows(BigInteger.valueOf(cm.getWidth())); + xmlmat.setCols(BigInteger.valueOf(cm.getHeight())); + xmlmat.setValue(ContactMatrix.contactToFloatString(cm)); + an.getContactmatrix().add(xmlmat); + } + } + } } else { @@ -3902,6 +3922,40 @@ public class Jalview2XML jaa.setProperty(prop.getName(), prop.getValue()); } } + if (jaa.graph == AlignmentAnnotation.CONTACT_MAP) + { + if (annotation.getContactmatrix() != null + && annotation.getContactmatrix().size() > 0) + { + for (MatrixType xmlmat : annotation.getContactmatrix()) + { + if (PAEContactMatrix.PAEMATRIX.equals(xmlmat.getType())) + { + if (!xmlmat.getRows().equals(xmlmat.getCols())) + { + Console.error("Can't handle non square PAE Matrices"); + } + else + { + float[][] elements = ContactMatrix + .fromFloatStringToContacts(xmlmat.getValue(), + xmlmat.getCols().intValue(), + xmlmat.getRows().intValue()); + + PAEContactMatrix newpae = new PAEContactMatrix( + jaa.sequenceRef, elements); + jaa.sequenceRef.addContactListFor(jaa, newpae); + } + } + else + { + Console.error("Ignoring CONTACT_MAP annotation with type " + + xmlmat.getType()); + } + } + } + } + if (jaa.autoCalculated) { autoAlan.add(new JvAnnotRow(i, jaa)); @@ -4122,7 +4176,7 @@ public class Jalview2XML loadPCAViewers(jalviewModel, ap); loadPDBStructures(jprovider, jseqs, af, ap); loadRnaViewers(jprovider, jseqs, ap); - loadOverview(view, af); + loadOverview(view, jalviewModel.getVersion(), af); } // and finally return. return af; @@ -4135,8 +4189,13 @@ public class Jalview2XML * @param view * @param af */ - protected void loadOverview(Viewport view, AlignFrame af) + protected void loadOverview(Viewport view, String version, AlignFrame af) { + if (!isVersionStringLaterThan("2.11.3", + version) && view.getOverview()==null) + { + return; + } /* * first close any Overview that was opened automatically * (if so configured in Preferences) so that the view is @@ -4676,7 +4735,7 @@ public class Jalview2XML * - minimum version we are comparing against * @param version * - version of data being processsed - * @return + * @return true if version is equal to or later than supported */ public static boolean isVersionStringLaterThan(String supported, String version) @@ -5146,7 +5205,10 @@ public class Jalview2XML + annotationId); return null; } - if (matchedAnnotation.getThreshold() == null) + // belt-and-braces create a threshold line if the + // colourscheme needs one but the matchedAnnotation doesn't have one + if (safeInt(viewAnnColour.getAboveThreshold()) != 0 + && matchedAnnotation.getThreshold() == null) { matchedAnnotation.setThreshold( new GraphLine(safeFloat(viewAnnColour.getThreshold()),