From b1c9b42f08c639868c2509dffacdf29f299c5f0d Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 3 Jul 2012 16:01:26 +0100 Subject: [PATCH] JAL-961 allow calcId to be specified independently of alignment annotation row label --- src/jalview/datamodel/Alignment.java | 8 +++++--- src/jalview/datamodel/AlignmentI.java | 10 ++++++---- src/jalview/io/TCoffeeScoreFile.java | 2 +- src/jalview/ws/jws2/AAConsClient.java | 5 +++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 6c11936..271374f 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1381,12 +1381,14 @@ public class Alignment implements AlignmentI @Override public AlignmentAnnotation findOrCreateAnnotation(String name, - boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef) + String calcId, boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef) { + assert(name!=null); for (AlignmentAnnotation annot : getAlignmentAnnotation()) { if (annot.autoCalculated == autoCalc - && annot.getCalcId().equals(name) + && (name.equals(annot.label)) + && (calcId==null || annot.getCalcId().equals(calcId)) && annot.sequenceRef == seqRef && annot.groupRef == groupRef) { return annot; @@ -1395,7 +1397,7 @@ public class Alignment implements AlignmentI AlignmentAnnotation annot = new AlignmentAnnotation(name, name, new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH); annot.hasText = false; - annot.setCalcId(new String(name)); + annot.setCalcId(new String(calcId)); annot.autoCalculated = autoCalc; if (seqRef != null) { diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index d09c41d..7e55e36 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -438,15 +438,17 @@ public interface AlignmentI extends AnnotatedCollectionI /** * search for or create a specific annotation row on the alignment - * - * @param method - CalcId for the annotation (must match) + * @param name name for annotation (must match) + * @param calcId calcId for the annotation (null or must match) * @param autoCalc - value of autocalc flag for the annotation * @param seqRef - null or specific sequence reference * @param groupRef - null or specific group reference + * @param method - CalcId for the annotation (must match) + * * @return existing annotation matching the given attributes */ - public AlignmentAnnotation findOrCreateAnnotation(String name, boolean autoCalc, - SequenceI seqRef, SequenceGroup groupRef); + public AlignmentAnnotation findOrCreateAnnotation(String name, String calcId, + boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef); /** * move the given group up or down in the alignment by the given number of rows. diff --git a/src/jalview/io/TCoffeeScoreFile.java b/src/jalview/io/TCoffeeScoreFile.java index cf33671..9c75878 100644 --- a/src/jalview/io/TCoffeeScoreFile.java +++ b/src/jalview/io/TCoffeeScoreFile.java @@ -482,7 +482,7 @@ public class TCoffeeScoreFile extends AlignFile { } } // this will overwrite any existing t-coffee scores for the alignment - AlignmentAnnotation aa=al.findOrCreateAnnotation(TCOFFEE_SCORE,false,s,null); + AlignmentAnnotation aa=al.findOrCreateAnnotation(TCOFFEE_SCORE,TCOFFEE_SCORE,false,s, null); if (s!=null) { aa.label="T-COFFEE"; diff --git a/src/jalview/ws/jws2/AAConsClient.java b/src/jalview/ws/jws2/AAConsClient.java index 2c2c7cb..b2c9d4d 100644 --- a/src/jalview/ws/jws2/AAConsClient.java +++ b/src/jalview/ws/jws2/AAConsClient.java @@ -73,8 +73,9 @@ public class AAConsClient extends JabawsAlignCalcWorker { // simple annotation row annotation = alignViewport.getAlignment() - .findOrCreateAnnotation(scr.getMethod(), true, null, - null); + .findOrCreateAnnotation(scr.getMethod(), getCalcId(), true, + null, null); + Annotation[] elm = new Annotation[alWidth]; if (alWidth == gapMap.length) // scr.getScores().size()) { -- 1.7.10.2