X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fext%2Fensembl%2FEnsemblLookup.java;h=0d1b5540c9728a4fbb47f71ff5aa3c5f2307344f;hb=f8b17a9e7363b8a9e7cd12d61bc6d611c7c97d7d;hp=eb8f90ee738dcb1391137e6d0e755284df00bdf4;hpb=604cbee405a837565ba1a74aa9bddd62aed685ab;p=jalview.git diff --git a/src/jalview/ext/ensembl/EnsemblLookup.java b/src/jalview/ext/ensembl/EnsemblLookup.java index eb8f90e..0d1b554 100644 --- a/src/jalview/ext/ensembl/EnsemblLookup.java +++ b/src/jalview/ext/ensembl/EnsemblLookup.java @@ -20,28 +20,40 @@ */ package jalview.ext.ensembl; +import jalview.bin.Cache; import jalview.datamodel.AlignmentI; +import jalview.datamodel.GeneLociI; +import jalview.util.MapList; import java.io.BufferedReader; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.function.Function; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; /** - * A client for the Ensembl lookup REST endpoint; used to find the Parent gene - * identifier given a transcript identifier. + * A client for the Ensembl lookup REST endpoint * * @author gmcarstairs - * */ public class EnsemblLookup extends EnsemblRestClient { + private static final String SPECIES = "species"; + + private static final String PARENT = "Parent"; + + private static final String OBJECT_TYPE_TRANSLATION = "Translation"; + private static final String OBJECT_TYPE_TRANSCRIPT = "Transcript"; + private static final String ID = "id"; + private static final String OBJECT_TYPE_GENE = "Gene"; + private static final String OBJECT_TYPE = "object_type"; /** * Default constructor (to use rest.ensembl.org) @@ -87,7 +99,7 @@ public class EnsemblLookup extends EnsemblRestClient protected URL getUrl(String identifier) { String url = getDomain() + "/lookup/id/" + identifier - + "?content-type=application/json"; + + CONTENT_TYPE_JSON; try { return new URL(url); @@ -116,13 +128,44 @@ public class EnsemblLookup extends EnsemblRestClient } /** - * Calls the Ensembl lookup REST endpoint and retrieves the 'Parent' for the + * Calls the Ensembl lookup REST endpoint and returns + *