Skip to content
Snippets Groups Projects
Commit 22eea1b8 authored by Alex Kanitz's avatar Alex Kanitz
Browse files

Update README.md

parent a35e5a2c
No related branches found
No related tags found
1 merge request!8Labkey api
Pipeline #10068 passed
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
This is the description how to connect to the LabKey through API: In order to connect to the LabKey through API, you will first need to create a file `.netrc` in your home directory:
1. Create a file named ".netrc" in your home directory. This file must include the following three lines:
machine "remote-instance-of-labkey-server" ```bash
login "user-email" touch ${HOME}/.netrc
password "user-password"
Add the following lines to the file:
E.g.:
```console
machine labkey.scicore.unibas.ch machine <remote-instance-of-labkey-server>
login eva.pujadas@unibas.ch login <user-email>
password xxxxx password <user-password>
```
To secure the file, set permissions in a way that only you can see the content of the file:
$ chmod 400 .netrc To secure the file, set permissions in a way that only you can see the content of the file:
2. For running the script labkey_api.py libraries "labkey" and "pandas" are required. Either you install them and run the script with the standard python or you use the module "labkey-api-python/1.1.0-foss-2018b-Python-3.6.6" provided by SciCore. Execute the following command: ```bash
python labkey_api.py arg1 arg2 chmod 400 .netrc
Here, arg1 stands for the project name, arg2 stands for the name of the LabKey table. ```
E.g.: Install the `labkey` and `pandas` packages, ideally from a virtual environment (e.g., `virtualenv` or `conda`):
```bash
pip install labkey pandas
```
Run the LabKey API client script:
```bash
python labkey_api.py project_name labkey_table_nane
```
Example:
```bash
python labkey_api.py TEST_ABOERSCH RNA_Seq_data_template python labkey_api.py TEST_ABOERSCH RNA_Seq_data_template
```
The script outputs the complete LabKey table in the form of pandas data frame. The script outputs the requested LabKey table in the form of a pandas data frame.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment