Python client
Installation
-
LabxDB-tools depends on requests, urllib3 and pyfnutils Python modules. To install it and its dependencies:
pip3 install labxdb-tools --user -
Make sure
$HOME/.local/binis in your PATH; the scriptimport_seqfor example should be executable. If not, configure your PATH in your~/.bashrc:export PATH=$PATH:$HOME/.local/bin
Dependencies
-
import_seq
Install zstd, wget and squashfs-tools with your favourite package manager. For example:
pacman -S zstd wget squashfs-toolsNotesquashfs-toolsis not mandatory. After download, remaining files can be (i) kept as-is or (ii) deleted using the option--delete_download. -
import_sra
Install
fastq-dumpfrom the NCBI SRA (Sequence Read Archive) tools:wget https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/current/sratoolkit.current-ubuntu64.tar.gz tar xvfz sratoolkit.current-ubuntu64.tar.gz cp sratoolkit.*-ubuntu64/bin/fastq-dump-orig* $HOME/.local/bin/fastq-dump
Configuration
To access LabxDB databases, clients need URL, path, login and passwords. They can be provided as environment variables or in a configuration file.
By environment variables
In your '~/.bashrc:
export LABXDB_HTTP_URL="http://127.0.0.1:8081/"
export LABXDB_HTTP_PATH_SEQ="seq/"
export LABXDB_HTTP_LOGIN=""
export LABXDB_HTTP_PASSWORD=""
By configuration file
In any file within any of these folders:
$HTS_CONFIG_PATH.HTS_CONFIG_PATHcan be defined by the user.$XDG_CONFIG_HOME/hts.XDG_CONFIG_HOMEis defined by your desktop environment.
Example configuration:
- Create a folder
/etc/hts - Open a file
/etc/hts/labxdb.jsonand write (in JSON format):{ "labxdb_http_url": "http://127.0.0.1:8081/", "labxdb_http_path_seq": "seq/", "labxdb_http_login": "", "labxdb_http_password": "" } - Open a file
/etc/hts/path.jsonand write (in JSON format):{ "path_seq_raw": "/data/seq/raw", "path_seq_run": "/data/seq/by_run", "path_seq_prepared": "/data/seq/prepared" } - Add in
~/.bashrc:export HTS_CONFIG_PATH="/etc/hts"
TipAlternatively, create the JSON config file in the folder of your choice and manually specify its location using the
--path_config option. All scripts in LabxDB-python accept this option.