From: Jim Procter Date: Thu, 22 Jul 2021 17:04:01 +0000 (+0100) Subject: JAL-3848 ensure annotation from a service gets a calcId so it can be updated and... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=eb3461a71b073a0e7a9a2dba6481b5ed3fca71e9;p=jalview.git JAL-3848 ensure annotation from a service gets a calcId so it can be updated and tracked across multiple views - nb - service.getId() probably isn’t the right value to use for this! --- 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); }