From eb3461a71b073a0e7a9a2dba6481b5ed3fca71e9 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 22 Jul 2021 18:04:01 +0100 Subject: [PATCH] =?utf8?q?JAL-3848=20ensure=20annotation=20from=20a=20servic?= =?utf8?q?e=20gets=20a=20calcId=20so=20it=20can=20be=20updated=20and=20track?= =?utf8?q?ed=20across=20multiple=20views=20-=20nb=20-=20service.getId()=20pr?= =?utf8?q?obably=20isn=E2=80=99t=20the=20right=20value=20to=20use=20for=20th?= =?utf8?q?is!?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/io/AnnotationFile.java | 23 +++++++++++++++++++- .../slivkaws/SlivkaAnnotationServiceInstance.java | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 2182b24..9daae63 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -33,6 +33,7 @@ import java.util.Vector; import jalview.analysis.Conservation; import jalview.api.AlignViewportI; +import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; @@ -65,6 +66,11 @@ public class AnnotationFile private String lastread = ""; /** + * default calcId string for new annotation + */ + private String defaultCalcId = null; + + /** * Constructor */ public AnnotationFile() @@ -664,6 +670,21 @@ public class AnnotationFile return readAnnotationFile(al, null, file, sourceType); } + /** + * read an annotation file onto the alignment, but apply the given calcId + * @param aln + * @param calcId + * @param file + * @param url + * @return + */ + public boolean readAnnotationFileWithCalcId(Alignment aln, String calcId, String file, + DataSourceType url) + { + defaultCalcId=calcId; + return readAnnotationFile(aln, null, file, url); + } + public boolean readAnnotationFile(AlignmentI al, HiddenColumns hidden, Object file, DataSourceType sourceType) { @@ -1004,7 +1025,7 @@ public class AnnotationFile annotation = new AlignmentAnnotation(label, description, (index == 0) ? null : annotations, 0, 0, graphStyle); - + annotation.setCalcId(defaultCalcId); annotation.score = score; if (!overrideAutoAnnot && autoAnnots .containsKey(autoAnnotsKey(annotation, refSeq, groupRef))) diff --git a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java index 3c80fbc..c42d42e 100644 --- a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java +++ b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java @@ -83,7 +83,7 @@ public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements } Alignment aln = new Alignment(seqs.toArray(new SequenceI[0])); if (annotFile == null - || !new AnnotationFile().readAnnotationFile(aln, annotFile.getContentUrl().toString(), DataSourceType.URL)) + || !new AnnotationFile().readAnnotationFileWithCalcId(aln, service.getId(), annotFile.getContentUrl().toString(), DataSourceType.URL)) { Cache.log.debug("No annotation from slivka job\n" + annotFile); } -- 1.7.10.2