+ String type = json.get(OBJECT_TYPE).toString();
+ if (OBJECT_TYPE_GENE.equalsIgnoreCase(type))
+ {
+ // got the gene - just returns its id
+ geneId = json.get(JSON_ID).toString();
+ }
+ else if (OBJECT_TYPE_TRANSCRIPT.equalsIgnoreCase(type))
+ {
+ // got the transcript - return its (Gene) Parent
+ geneId = json.get(PARENT).toString();
+ }
+ else if (OBJECT_TYPE_TRANSLATION.equalsIgnoreCase(type))
+ {
+ // got the protein - look up its Parent, restricted to type Transcript
+ String transcriptId = json.get(PARENT).toString();
+ geneId = parseGeneId(getResult(transcriptId, OBJECT_TYPE_TRANSCRIPT));
+ }
+
+ return geneId;
+ }
+
+ /**
+ * Calls the /lookup/id rest service for the given id, and if successful,
+ * parses and returns the gene's chromosomal coordinates
+ *
+ * @param geneId
+ * @return
+ */
+ public GeneLociI getGeneLoci(String geneId)
+ {
+ return parseGeneLoci(getResult(geneId, OBJECT_TYPE_GENE));
+ }
+
+ /**
+ * Parses the /lookup/id response for species, asssembly_name,
+ * seq_region_name, start, end and returns an object that wraps them, or null
+ * if unsuccessful
+ *
+ * @param json
+ * @return
+ */
+ GeneLociI parseGeneLoci(JSONObject json)
+ {
+ if (json == null)
+ {
+ return null;
+ }
+