From 155de980b5be7385abed490ca959ccf562c41a13 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 30 May 2012 19:26:19 +0100 Subject: [PATCH] updated schema to store and recover belowAlignment and calcId for JAL-1109 and JAL-1110 --- schemas/vamsas.xsd | 5 + src/jalview/gui/Jalview2XML.java | 17 ++- src/jalview/schemabinding/version2/.castor.cdr | 2 +- src/jalview/schemabinding/version2/Annotation.java | 123 +++++++++++++++++--- .../version2/descriptors/AnnotationDescriptor.java | 95 ++++++++++++--- 5 files changed, 205 insertions(+), 37 deletions(-) diff --git a/schemas/vamsas.xsd b/schemas/vamsas.xsd index 0843deb..9d4b679 100755 --- a/schemas/vamsas.xsd +++ b/schemas/vamsas.xsd @@ -214,6 +214,11 @@ is an autocalculated annotation row + + is to be shown below the alignment - introduced in Jalview 2.8 for visualizing T-COFFEE alignment scores + + Optional string identifier used to group sets of annotation produced by a particular calculation. Values are opaque strings but have semantic meaning to Jalview's renderer, data importer and calculation system. + diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 52f66e8..39bd626 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -811,13 +811,13 @@ public class Jalview2XML { annotationIds.put(aa[i].annotationId, aa[i]); } - + an.setId(aa[i].annotationId); an.setVisible(aa[i].visible); an.setDescription(aa[i].description); - + if (aa[i].sequenceRef != null) { // TODO later annotation sequenceRef should be the XML ID of the @@ -842,6 +842,7 @@ public class Jalview2XML an.setCentreColLabels(aa[i].centreColLabels); an.setScaleColLabels(aa[i].scaleColLabel); an.setShowAllColLabels(aa[i].showAllColLabels); + an.setBelowAlignment(aa[i].belowAlignment); if (aa[i].graph > 0) { @@ -874,6 +875,12 @@ public class Jalview2XML { an.setScore(aa[i].getScore()); } + + if (aa[i].getCalcId()!=null) + { + an.setCalcId(aa[i].getCalcId()); + } + AnnotationElement ae; if (aa[i].annotations != null) { @@ -2261,6 +2268,12 @@ public class Jalview2XML { jaa.graphHeight = an[i].getGraphHeight(); } + if (an[i].hasBelowAlignment()) + { + jaa.belowAlignment=an[i].isBelowAlignment(); + } + jaa.setCalcId(an[i].getCalcId()); + if (jaa.autoCalculated) { autoAlan.add(new JvAnnotRow(i, jaa)); diff --git a/src/jalview/schemabinding/version2/.castor.cdr b/src/jalview/schemabinding/version2/.castor.cdr index cd0b1e7..33cd4bf 100644 --- a/src/jalview/schemabinding/version2/.castor.cdr +++ b/src/jalview/schemabinding/version2/.castor.cdr @@ -1,4 +1,4 @@ -#Wed Aug 03 09:15:24 BST 2011 +#Thu May 24 20:06:46 BST 2012 jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java index 285e730..039c227 100644 --- a/src/jalview/schemabinding/version2/Annotation.java +++ b/src/jalview/schemabinding/version2/Annotation.java @@ -1,20 +1,3 @@ -/******************************************************************************* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle - * - * This file is part of Jalview. - * - * 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. - * - * 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 . - *******************************************************************************/ /* * This class was automatically generated with * Castor 1.1, using an XML @@ -180,6 +163,25 @@ public class Annotation implements java.io.Serializable { private boolean _has_autoCalculated; /** + * is to be shown below the alignment - introduced in Jalview + * 2.8 for visualizing T-COFFEE alignment scores + */ + private boolean _belowAlignment = true; + + /** + * keeps track of state for field: _belowAlignment + */ + private boolean _has_belowAlignment; + + /** + * Optional string identifier used to group sets of annotation + * produced by a particular calculation. Values are opaque + * strings but have semantic meaning to Jalview's renderer, + * data importer and calculation system. + */ + private java.lang.String _calcId; + + /** * Field _annotationElementList. */ private java.util.Vector _annotationElementList; @@ -251,6 +253,13 @@ public class Annotation implements java.io.Serializable { /** */ + public void deleteBelowAlignment( + ) { + this._has_belowAlignment= false; + } + + /** + */ public void deleteCentreColLabels( ) { this._has_centreColLabels= false; @@ -397,6 +406,34 @@ public class Annotation implements java.io.Serializable { } /** + * Returns the value of field 'belowAlignment'. The field + * 'belowAlignment' has the following description: is to be + * shown below the alignment - introduced in Jalview 2.8 for + * visualizing T-COFFEE alignment scores + * + * @return the value of field 'BelowAlignment'. + */ + public boolean getBelowAlignment( + ) { + return this._belowAlignment; + } + + /** + * Returns the value of field 'calcId'. The field 'calcId' has + * the following description: Optional string identifier used + * to group sets of annotation produced by a particular + * calculation. Values are opaque strings but have semantic + * meaning to Jalview's renderer, data importer and calculation + * system. + * + * @return the value of field 'CalcId'. + */ + public java.lang.String getCalcId( + ) { + return this._calcId; + } + + /** * Returns the value of field 'centreColLabels'. * * @return the value of field 'CentreColLabels'. @@ -579,6 +616,16 @@ public class Annotation implements java.io.Serializable { } /** + * Method hasBelowAlignment. + * + * @return true if at least one BelowAlignment has been added + */ + public boolean hasBelowAlignment( + ) { + return this._has_belowAlignment; + } + + /** * Method hasCentreColLabels. * * @return true if at least one CentreColLabels has been added @@ -701,6 +748,19 @@ public class Annotation implements java.io.Serializable { } /** + * Returns the value of field 'belowAlignment'. The field + * 'belowAlignment' has the following description: is to be + * shown below the alignment - introduced in Jalview 2.8 for + * visualizing T-COFFEE alignment scores + * + * @return the value of field 'BelowAlignment'. + */ + public boolean isBelowAlignment( + ) { + return this._belowAlignment; + } + + /** * Returns the value of field 'centreColLabels'. * * @return the value of field 'CentreColLabels'. @@ -887,6 +947,35 @@ public class Annotation implements java.io.Serializable { } /** + * Sets the value of field 'belowAlignment'. The field + * 'belowAlignment' has the following description: is to be + * shown below the alignment - introduced in Jalview 2.8 for + * visualizing T-COFFEE alignment scores + * + * @param belowAlignment the value of field 'belowAlignment'. + */ + public void setBelowAlignment( + final boolean belowAlignment) { + this._belowAlignment = belowAlignment; + this._has_belowAlignment = true; + } + + /** + * Sets the value of field 'calcId'. The field 'calcId' has the + * following description: Optional string identifier used to + * group sets of annotation produced by a particular + * calculation. Values are opaque strings but have semantic + * meaning to Jalview's renderer, data importer and calculation + * system. + * + * @param calcId the value of field 'calcId'. + */ + public void setCalcId( + final java.lang.String calcId) { + this._calcId = calcId; + } + + /** * Sets the value of field 'centreColLabels'. * * @param centreColLabels the value of field 'centreColLabels'. diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java index e922cd2..f12cbbd 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java @@ -1,20 +1,3 @@ -/******************************************************************************* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle - * - * This file is part of Jalview. - * - * 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. - * - * 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 . - *******************************************************************************/ /* * This class was automatically generated with * Castor 1.1, using an XML @@ -693,6 +676,84 @@ public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDes fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); + //-- _belowAlignment + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_belowAlignment", "belowAlignment", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if (!target.hasBelowAlignment()) { return null; } + return (target.getBelowAlignment() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteBelowAlignment(); + return; + } + target.setBelowAlignment( ((java.lang.Boolean) value).booleanValue()); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _belowAlignment + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _calcId + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_calcId", "calcId", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + return target.getCalcId(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + target.setCalcId( (java.lang.String) value); + } catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance(java.lang.Object parent) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _calcId + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator; + typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + fieldValidator.setValidator(typeValidator); + typeValidator.setWhiteSpace("preserve"); + } + desc.setValidator(fieldValidator); //-- initialize element descriptors //-- _annotationElementList -- 1.7.10.2