This is a REST api wrapper around "r-geno-tools-engine". For more detailed documentation, please check r-geno-tools-engine's readme.
To generate the openapi.json
file one can run in R
:
source("r-geno-tools-api.R")
spec <- utils::modifyList(list(servers = list(list(url = ""))),
genoApi$getApiSpec())
writeLines(jsonlite::toJSON(spec,
complex = "list",
auto_unbox = TRUE,
pretty = T,
digits = NA,
na = 'string'),
con = "openapi.json")
To this project use docker to build and deploy the API.
To build an image of the api, one can just run this command in the app folder:
docker build -t utbiomet/rgenotoolapi ./
docker push utbiomet/rgenotoolapi:latest
docker run -d --rm --name rgenotoolapi -p 8080:8080 utbiomet/rgenotoolapi
docker exec -u 0 -it rgenotoolapi bash
To test the API, first launch a local instance of the API on port 8181
. This can be done through several ways, for example in R
run:
source('r-geno-tools-api.R');
genoApi$run(port = 8080, host = '0.0.0.0')
Or you can run the Docker container (mapping the API on the port 8181
):
docker run -d --rm --name rgenotoolapi -p 8080:8080 utbiomet/rgenotoolapi
Then run the script tests/testthat.R
:
Rscript tests/testthat.R
For manually testing, you can use these urls when the api is running in docker:
file:///r-geno-tools-api/r-geno-tools-engine/data/results/gwasResult.json
file:///r-geno-tools-api/r-geno-tools-engine/data/geno/testMarkerData01.vcf.gz
file:///r-geno-tools-api/r-geno-tools-engine/data/pheno/testPhenoData01.csv
file:///r-geno-tools-api/r-geno-tools-engine/data/pedigree/testPedData_char.csv
For trait this one is in the pheno file: Flowering.time.at.Arkansas