Search in sources :

Example 1 with EnsemblGenomeBuildVersionJson

use of uk.ac.ebi.spot.goci.model.EnsemblGenomeBuildVersionJson in project goci by EBISPOT.

the class EnsemblGenomeBuildVersion method getGenomeBuildVersion.

/**
     * Getter for the genome build version
     *
     * @return the genome build version
     */
public String getGenomeBuildVersion() throws EnsemblRestIOException {
    RestTemplate restTemplate = new RestTemplate();
    String url = getServer() + getEndpoint();
    String assemblyName = "";
    try {
        EnsemblGenomeBuildVersionJson ensemblGenomeBuildVersionJson = restTemplate.getForObject(url, EnsemblGenomeBuildVersionJson.class);
        getLog().info("Querying " + url);
        assemblyName = ensemblGenomeBuildVersionJson.getAssembly_name();
        if (assemblyName.isEmpty()) {
            throw new EnsemblRestIOException("Unable to determine Ensembl genome build version");
        }
    } catch (Exception e) {
        throw new EnsemblRestIOException("Problem querying Ensembl API for genome build version");
    }
    return assemblyName;
}
Also used : EnsemblGenomeBuildVersionJson(uk.ac.ebi.spot.goci.model.EnsemblGenomeBuildVersionJson) RestTemplate(org.springframework.web.client.RestTemplate) EnsemblRestIOException(uk.ac.ebi.spot.goci.exception.EnsemblRestIOException) EnsemblRestIOException(uk.ac.ebi.spot.goci.exception.EnsemblRestIOException)

Aggregations

RestTemplate (org.springframework.web.client.RestTemplate)1 EnsemblRestIOException (uk.ac.ebi.spot.goci.exception.EnsemblRestIOException)1 EnsemblGenomeBuildVersionJson (uk.ac.ebi.spot.goci.model.EnsemblGenomeBuildVersionJson)1