Skip to main content

The command line interface for GPAS

Project description

GPAS CLI

The command line and Python API client for the GPAS mycobacterial platform. Enables secure sample upload with client-side human read removal and retrieval of analytical outputs.

Install

Installing Miniconda

If a conda package manager is already installed, skip to Installing the GPAS CLI, otherwise:

Linux

  • In a terminal console, install Miniconda, following instructions and accepting default options:
    curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    bash Miniconda3-latest-Linux-x86_64.sh
    

MacOS

The GPAS CLI requires an x86_64 conda installation. If your Mac has an Apple processor, you must disable or delete any existing arm64 conda installations before continuing.

  • If your Mac has an Apple processor, using Terminal, firstly run:
    arch -x86_64 zsh
    
  • Install Miniconda using Terminal, following instructions and accepting default options:
    curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
    bash Miniconda3-latest-MacOSX-x86_64.sh
    

Installing or updating the GPAS CLI

  • If using a Mac with an Apple processor, using Terminal, firstly run:

    arch -x86_64 zsh
    
  • Perform the installation/upgrade:

    conda create --yes -n gpas -c conda-forge -c bioconda hostile
    conda activate gpas
    pip install gpas
    
  • Test:

    gpas --version
    

Usage

Ensure that the conda environment is active:

conda activate gpas

Help

Run gpas --help for an overview of CLI subcommands. For help with a specific subcommand, use e.g. gpas auth --help

Authentication (gpas auth)

The first time you use the CLI, you will need to authenticate by running gpas auth and entering your username and password. This token will be used automatically for subsequent commands.

gpas auth
Enter your username: bede.constantinides@ndm.ox.ac.uk
Enter your password: ***************

Uploading samples (gpas upload)

Performs metadata validation and client-side removal of human reads in each of your samples before uploading sequences to the GPAS platform.

gpas upload tests/data/illumina.csv

This generates a mapping CSV (e.g. a5w2e8.mapping.csv) linking your local sample names with their randomly generated remote identifiers (GUIDs). Keep this file safe as it's useful for linking results later.

Downloading output files (gpas download)

Download the output files associated with a batch of samples given the mapping CSV generated during upload, or one or more sample GUIDs. When a mapping CSV is used, downloaded file names are prefixed with the sample names provided at upload by default. Otherwise downloaded files are prefixed with the sample GUID.

# Download the main reports for all samples in a5w2e8.mapping.csv
gpas download a5w2e8.mapping.csv

# Download the main and speciation reports for samples in a5w2e8.mapping.csv
gpas download a5w2e8.mapping.csv --filenames main_report.json,speciation_report.json

# Download the main report for sample 3bf7d6f9-c883-4273-adc0-93bb96a499f6
gpas download 3bf7d6f9-c883-4273-adc0-93bb96a499f6

# Save downloaded files to a specific directory
gpas download a5w2e8.mapping.csv --out-dir results

Support

For technical support, please open an issue or contact support@gpas.global

Development

Development install

git clone https://github.com/GlobalPathogenAnalysisService/cli.git
cd cli
conda env create -y -f environment-dev.yml
pip install --editable .

Updating

git pull origin main
gpas --version

Using a local development server

export GPAS_HOST="localhost:8000"
export GPAS_PROTOCOL="http"

To unset:

unset GPAS_HOST
unset GPAS_PROTOCOL

Releasing a new version

pytest
# Increment version string inside src/gpas/__init__.py
git tag 0.xx.0  # Tag new version
git push origin main --tags  # Push including tags
flit build
flit publish  # Uploads to PyPI given appropriate permission
# Announce in Slack CLI channel
# PR gpas/gpas/settings.py with new version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpas-0.16.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

gpas-0.16.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file gpas-0.16.0.tar.gz.

File metadata

  • Download URL: gpas-0.16.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for gpas-0.16.0.tar.gz
Algorithm Hash digest
SHA256 7d96d504f7e97a396f324de71df25ab3c70f8d9f37fec043a5c06b1702ad81ff
MD5 fec33f4519283367b04190ebb55b068a
BLAKE2b-256 c9374354b03ff23d5be25ba6ae15ca0b2f7d6deac38710dca8167f722743097d

See more details on using hashes here.

File details

Details for the file gpas-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: gpas-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for gpas-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb1d5f380c87bf09802a8d3dfb7b3b1499826cda22a0168de5e89bca9dd3c9bc
MD5 8c27a3bdded1d35b032676e4791a9b39
BLAKE2b-256 53a3a3f29d49a1fa9fe732a74d6980d4e41dfcf92912a8947f7e182b857b01b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page