*/
public class EnsemblLookup extends EnsemblRestClient
{
-
- private static final String OBJECT_TYPE_TRANSLATION = "Translation";
- private static final String PARENT = "Parent";
- 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";
-
- /**
- * keep track of last identifier retrieved to break loops
- */
- private String lastId;
-
/**
* Default constructor (to use rest.ensembl.org)
*/
return true;
}
- @Override
- protected String getRequestMimeType(boolean multipleIds)
- {
- return "application/json";
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return "application/json";
- }
-
/**
* Returns the gene id related to the given identifier, which may be for a
* gene, transcript or protein
}
/**
- * Calls the Ensembl lookup REST endpoint and retrieves the 'Parent' for the
- * given identifier, or null if not found
+ * Returns the gene id related to the given identifier (which may be for a
+ * gene, transcript or protein)
*
* @param identifier
* @param objectType
- * (optional)
* @return
*/
public String getGeneId(String identifier, String objectType)
BufferedReader br = null;
try
{
-
URL url = getUrl(identifier, objectType);
-
- if (identifier.equals(lastId))
- {
- System.err.println("** Ensembl lookup " + url.toString()
- + " looping on Parent!");
- return null;
- }
-
- lastId = identifier;
-
if (url != null)
{
br = getHttpResponse(url, ids);