use of uk.ac.ebi.spot.goci.model.EnsemblDbsnpVersionJson in project goci by EBISPOT.
the class EnsemblDbsnpVersion method getDbsnpVersion.
/**
* Getter for the dbSNP version
*
* @return the dbSNP version
*/
public int getDbsnpVersion() throws EnsemblRestIOException {
RestTemplate restTemplate = new RestTemplate();
String url = getServer() + getEndpoint();
String version = "";
try {
getLog().info("Querying " + url);
//Ensembl returns an array data structure for this call
// Have to do some wrangling to get dbSNP version
EnsemblDbsnpVersionJson[] response = restTemplate.getForObject(url, EnsemblDbsnpVersionJson[].class);
version = response[0].getVersion();
if (version.isEmpty()) {
throw new EnsemblRestIOException("Unable to determine Ensembl dbSNP version");
}
} catch (Exception e) {
throw new EnsemblRestIOException("Problem querying Ensembl API for dbSNP version");
}
return Integer.parseInt(version);
}
Aggregations