From: gmungoc Date: Wed, 24 May 2017 14:45:16 +0000 (+0100) Subject: JAL-2529 add object_type=cdna to EnsemblCdna parameters X-Git-Tag: Release_2_10_3b1~238 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5950febf61a94e527963a1eb68b0c59dd3387163;p=jalview.git JAL-2529 add object_type=cdna to EnsemblCdna parameters --- diff --git a/src/jalview/ext/ensembl/EnsemblCdna.java b/src/jalview/ext/ensembl/EnsemblCdna.java index dc000c6..6d031b7 100644 --- a/src/jalview/ext/ensembl/EnsemblCdna.java +++ b/src/jalview/ext/ensembl/EnsemblCdna.java @@ -24,6 +24,9 @@ import jalview.datamodel.SequenceFeature; import jalview.io.gff.SequenceOntologyFactory; import jalview.io.gff.SequenceOntologyI; +import java.util.HashMap; +import java.util.Map; + import com.stevesoft.pat.Regex; /** @@ -44,6 +47,13 @@ public class EnsemblCdna extends EnsemblSeqProxy private static final Regex ACCESSION_REGEX = new Regex( "(ENS([A-Z]{3}|)[TG][0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)"); + private static Map params = new HashMap(); + + static + { + params.put("object_type", "transcript"); + } + /* * fetch exon features on genomic sequence (to identify the cdna regions) * and cds and variation features (to retain) @@ -128,4 +138,14 @@ public class EnsemblCdna extends EnsemblSeqProxy return false; } + /** + * Parameter object_type=cdna added to ensure cdna and not peptide is returned + * (JAL-2529) + */ + @Override + protected Map getAdditionalParameters() + { + return params; + } + } diff --git a/src/jalview/ext/ensembl/EnsemblSeqProxy.java b/src/jalview/ext/ensembl/EnsemblSeqProxy.java index dda77d7..dcf2eb4 100644 --- a/src/jalview/ext/ensembl/EnsemblSeqProxy.java +++ b/src/jalview/ext/ensembl/EnsemblSeqProxy.java @@ -48,6 +48,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; /** * Base class for Ensembl sequence fetchers @@ -468,11 +470,31 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient urlstring.append("?type=").append(getSourceEnsemblType().getType()); urlstring.append(("&Accept=text/x-fasta")); + Map params = getAdditionalParameters(); + if (params != null) + { + for (Entry entry : params.entrySet()) + { + urlstring.append("&").append(entry.getKey()).append("=") + .append(entry.getValue()); + } + } + URL url = new URL(urlstring.toString()); return url; } /** + * Override this method to add any additional x=y URL parameters needed + * + * @return + */ + protected Map getAdditionalParameters() + { + return null; + } + + /** * A sequence/id POST request currently allows up to 50 queries * * @see http://rest.ensembl.org/documentation/info/sequence_id_post diff --git a/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java b/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java index c8fa3c2..aa2c315 100644 --- a/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java +++ b/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java @@ -168,8 +168,6 @@ public class EnsemblSeqProxyTest Alignment ral = new Alignment(sqs); for (SequenceI tr : trueSqs) { - // 12/05/2017 failing for EnsemblCdna which is returning protein - // Ensembl helpdesk ticket 187998 SequenceI[] rseq; Assert.assertNotNull( rseq = ral.findSequenceMatch(tr.getName()),