To do very simple queries on the clinical/phenotype data you can use the LabKey application on the Research Environment desktop. However, in order to do more complex analyses across multiple tables, or query very large tables, it is recommended that you use the provided LabKey APIs.
The LabKey client libraries (APIs) provide secure, auditable, programmatic access to LabKey data and services and allow you to:
Analyse and visualise data stored in LabKey in a statistical tool such as R or Python
Perform routine, automated tasks in a programmatic way.
Query and manipulate data in a repeatable and consistent way.
Currently, LabKey supports working with the following programming languages/environments.
We highly recommend using either the Python LabKey API or the R LabKey API to query the Genomics England clinical/phenotype data.
You firstly need to provide your credentials to the API so that you can access the data you are allowed. These credentials will be stored in a file called
.netrc (dot net rc), located in your home directory.
.netrctemplate by following the steps outlined here: R, RStudio, and R libraries#ConfigurationofR or R, RStudio, and R libraries#ConfigurationofRonHelix
.netrctemplate, open the Terminal application from the Research Environment desktop.
.netrcin nano by typing
nano .netrcand pressing enter/return.
machine labkey-embassy.gel.zone login yourusername password yourPasswordHere
Ctrl+Othen hit enter/return. Exit nano with
Because the file contains your password, it should be set to read-write only for yourself.
ls -alhin the terminal.
-rw------- <username> <username> .netrc
-rw-rw-rw-, they are visible to others and need to be changed.
chmod 600 .netrc, which will set read-write to you only.
For R and Python you will need to make specific changes to your scripts. Please have a look at the following pages for example scripts and how to set up your own script:
R LabKey API - Please make sure that you follow the steps outlined in R, RStudio, and R libraries#ConfigurationofR
Python LabKey API
In case the RLabKey API is incorrectly setup, please have a look here:
- LabKey DOCTYPE error
- LabKey curl_fetch_memory error
If this does not resolve the issue, and you still have problems using the R LabKey API, please contact the Service Desk.