From 61869bbe7d7764ea9546996b47e488d11cf576d3 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 18 Jan 2019 09:59:45 +0000 Subject: [PATCH] JAL-3143 'id' not 'ID' attribute drives generation of variant link --- src/jalview/analysis/AlignmentUtils.java | 13 ++++++++----- src/jalview/ext/ensembl/EnsemblSequenceFetcher.java | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index d1217bf..0dfd383 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -74,12 +74,15 @@ import java.util.TreeMap; */ public class AlignmentUtils { - private static final int CODON_LENGTH = 3; private static final String SEQUENCE_VARIANT = "sequence_variant:"; - private static final String ID = "ID"; + /* + * the 'id' attribute is provided for variant features fetched from + * Ensembl using its REST service with JSON format + */ + public static final String VARIANT_ID = "id"; /** * A data model to hold the 'normal' base value at a position, and an optional @@ -2575,15 +2578,15 @@ public class AlignmentUtils peptidePos, var.getSource()); StringBuilder attributes = new StringBuilder(32); - String id = (String) var.variant.getValue(ID); + String id = (String) var.variant.getValue(VARIANT_ID); if (id != null) { if (id.startsWith(SEQUENCE_VARIANT)) { id = id.substring(SEQUENCE_VARIANT.length()); } - sf.setValue(ID, id); - attributes.append(ID).append("=").append(id); + sf.setValue(VARIANT_ID, id); + attributes.append(VARIANT_ID).append("=").append(id); // TODO handle other species variants JAL-2064 StringBuilder link = new StringBuilder(32); try diff --git a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java index 9e3fef4..4da0e3c 100644 --- a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java +++ b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java @@ -20,6 +20,7 @@ */ package jalview.ext.ensembl; +import jalview.analysis.AlignmentUtils; import jalview.bin.Cache; import jalview.datamodel.DBRefSource; import jalview.ws.seqfetcher.DbSourceProxyImpl; @@ -64,7 +65,7 @@ abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl protected static final String PARENT = "Parent"; - protected static final String JSON_ID = "id"; + protected static final String JSON_ID = AlignmentUtils.VARIANT_ID; // "id"; protected static final String OBJECT_TYPE = "object_type"; -- 1.7.10.2