Package: gpas-sc2
The command line client for interacting with theGlobal Pathogen Analysis Service. Performs fast parallel client-side decontamination and upload, and automatically renames downloaded output files with original sample identifiers for convenience while preserving privacy. Installs with Conda or Docker and supports Ubuntu Linux, MacOS and Windows.Command line interfacePython API (unstable)✅gpas upload✅lib.Batch().upload()✅gpas download✅lib.download_async()✅gpas validate✅validation.validate()✅gpas status✅lib.fetch_status_async()InstallWithcondaMiniconda is recommended (Miniconda installation guide). If using a recent Mac with ARM architecture, you'll need toinstall Miniconda and gpas-cli inside a Rosetta Terminal.# Create and activate the conda environmentcurl-OJhttps://raw.githubusercontent.com/GlobalPathogenAnalysisService/gpas-cli/main/environment.yml
condaenvcreate-fenvironment.yml
condaactivategpas-sc2# Show gpas-cli versiongpas--version# Updating? Run this before creating the conda environmentcondaremove-ngpas-sc2--allWithdockergpas-cli releases are pushed toDocker Hubfor easy installation on most platforms and architectures.# Fetch image, show gpas-cli versiondockerrunoxfordmmm/gpas-cli:latestgpas--version# Fetch image, upload example data using a bound volumedockerrun\-v/Users/bede/Research/Git/gpas-cli/tests/test-data:/test-data\oxfordmmm/gpas-cli:latest\gpasupload\--environmentdev\--token/test-data/token.json\--out-dir/test-data/output\/test-data/large-nanopore-bam.csv# Build image from scratch, show gpas-cli versioncurl-OJhttps://raw.githubusercontent.com/GlobalPathogenAnalysisService/gpas-cli/main/Dockerfile
dockerrun--rm$(dockerbuild-q.)gpas--version# Build image from scratch, upload example datadockerrun\-v/Users/bede/Research/Git/gpas-cli/tests/test-data:/test-data\$(dockerbuild-q.)\gpasupload\--environmentdev\--token/test-data/token.json\--out-dir/test-data/output\/test-data/large-nanopore-bam.csvWithpipOne can alternativelypip installthe PyPI package in a Python 3.10+ environment, and manually installsamtoolsandreadItAndKeepbinary dependencies.# Install inside a new Python environmentpython3-mvenvgpas-sc2sourcegpas-sc2/bin/activate
pipinstallgpas# Show gpas-cli versiongpas--version# If samtools and read-it-and-keep are not in $PATH, tell gpas-cli where to find themexportGPAS_SAMTOOLS_PATH=path/to/samtoolsexportGPAS_READITANDKEEP_PATH=path/to/readItAndKeepWith PyInstallerStatic Linux, MacOS and Windows executables are generated for each release. These are intended for distribution with the GUI client but may also be used independently. These can be downloaded from the 'Artifacts' section of each workflow run listed here:https://github.com/GlobalPathogenAnalysisService/gpas-cli/actions/workflows/distribute.ymlAuthenticationMostgpas-cliactions require a valid API token (token.json). This can be saved using the 'Get API token' button on the 'Upload Client' page of the GPAS portal. If you can't see this button, please ask the GPAS team to enable it for you. And if you'd like to try GPAS, please get in touch!Command line usagegpas validateValidates anupload_csvand checks that the fastq or bam files it references exist.gpasvalidatelarge-nanopore-fastq.csv# Validate supplied tagsgpasvalidate--environmentdev--tokentoken.jsonlarge-nanopore-fastq.csv% gpas validate -h
usage: gpas validate [-h] [--token TOKEN] [--environment {dev,staging,prod}] [--json-messages] upload_csv

Validate an upload CSV. Validates tags remotely if supplied with an authentication token

positional arguments:
  upload_csv            Path of upload CSV

options:
  -h, --help            show this help message and exit
  --token TOKEN         Path of auth token available from GPAS Portal
                        (default: None)
  --environment {dev,staging,prod}
                        GPAS environment to use
                        (default: prod)
  --json-messages       Emit JSON to stdout
                        (default: False)gpas uploadValidates, decontaminates and upload reads specified inupload_csvto the specified GPAS environmentgpasupload--environmentdev--tokentoken.jsonlarge-illumina-bam.csv# Dry run; skip submissiongpasupload--dry-run--environmentdev--tokentoken.jsonlarge-illumina-bam.csv# Offline mode; quit after decontaminationgpasuploadtests/test-data/large-nanopore-fastq.csv% gpas upload -h
usage: gpas upload [-h] [--token TOKEN] [--working-dir WORKING_DIR] [--out-dir OUT_DIR] [--processes PROCESSES] [--dry-run]
                   [--debug] [--environment {dev,staging,prod}] [--json-messages]
                   upload_csv

Validate, decontaminate and upload reads to the GPAS platform

positional arguments:
  upload_csv            Path of upload csv

options:
  -h, --help            show this help message and exit
  --token TOKEN         Path of auth token available from GPAS Portal
                        (default: None)
  --working-dir WORKING_DIR
                        Path of directory in which to make intermediate files
                        (default: /tmp)
  --out-dir OUT_DIR     Path of directory in which to save mapping CSV
                        (default: .)
  --processes PROCESSES
                        Number of tasks to execute in parallel. 0 = auto
                        (default: 0)
  --dry-run             Exit before submitting files
                        (default: False)
  --debug               Emit verbose debug messages
                        (default: False)
  --environment {dev,staging,prod}
                        GPAS environment to use
                        (default: prod)
  --json-messages       Emit JSON to stdout
                        (default: False)gpas downloadDownloadsjson,fasta,vcfandbamoutputs from the GPAS platform by passing either amapping_csvgenerated during batch upload, or a comma-separated list of sample guids. By passing both--mapping-csvand--rename, output files are saved using local sample names without the platform's knowledge.# Download and rename BAMs for a previous uploadgpasdownload--rename--mapping-csvC-a06cbab8.mapping.csv--file-typesbamtoken.json# Download all outputs for a single guidgpasdownload--guids6e024eb1-432c-4b1b-8f57-3911fe87555f--file-typesjson,vcf,bam,fastatoken.json% gpas download -h
usage: gpas download [-h] [--mapping-csv MAPPING_CSV] [--guids GUIDS] [--file-types FILE_TYPES] [--out-dir OUT_DIR] [--rename]
                     [--debug] [--environment {dev,staging,prod}]
                     token

Download analytical outputs from the GPAS platform for given a mapping csv or list of guids

positional arguments:
  token                 Path of auth token (available from GPAS Portal)

options:
  -h, --help            show this help message and exit
  --mapping-csv MAPPING_CSV
                        Path of mapping CSV generated at upload time
                        (default: None)
  --guids GUIDS         Comma-separated list of GPAS sample guids
                        (default: )
  --file-types FILE_TYPES
                        Comma separated list of outputs to download (json,fasta,bam,vcf)
                        (default: fasta)
  --out-dir OUT_DIR     Path of output directory
                        (default: /Users/bede/Research/Git/gpas-cli)
  --rename              Rename outputs using local sample names (requires --mapping-csv)
                        (default: False)
  --debug               Emit verbose debug messages
                        (default: False)
  --environment {dev,staging,prod}
                        GPAS environment to use
                        (default: prod)gpas statusCheck the processing status of an uploaded batch by passing either amapping_csvgenerated at upload time, or a comma-separated list of sample guids.gpasstatus--mapping-csvexample_mapping.csv--environmentdevtoken.json
gpasstatus--guids6e024eb1-432c-4b1b-8f57-3911fe87555f--formatjsontoken.json% gpas status -h
usage: gpas status [-h] [--mapping-csv MAPPING_CSV] [--guids GUIDS] [--format {table,csv,json}] [--rename] [--raw]
                   [--environment {dev,staging,prod}]
                   token

Check the status of samples submitted to the GPAS platform

positional arguments:
  token                 Path of auth token available from GPAS Portal

options:
  -h, --help            show this help message and exit
  --mapping-csv MAPPING_CSV
                        Path of mapping CSV generated at upload time
                        (default: None)
  --guids GUIDS         Comma-separated list of GPAS sample guids
                        (default: )
  --format {table,csv,json}
                        Output format
                        (default: table)
  --rename              Use local sample names (requires --mapping-csv)
                        (default: False)
  --raw                 Emit raw response
                        (default: False)
  --environment {dev,staging,prod}
                        GPAS environment to use
                        (default: prod)Development and testingUse pre-commit to apply black style at commit time (should happen automatically)gitclonehttps://github.com/GlobalPathogenAnalysisService/gpas-clicdgpas-cli
condaenvcreate-fenvironment-dev.yml
condaactivategpas-sc2-dev
pipinstall--upgrade--force-reinstall--editable./# Offline unit testspytesttests/test_gpas.py# The full test suite requires a valid token for dev inside tests/test-datapytest--cov=gpas