gpas 2.2.2rc2__tar.gz → 2.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gpas-2.2.2rc2 → gpas-2.2.3}/.gitignore +2 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/.pre-commit-config.yaml +6 -6
- {gpas-2.2.2rc2 → gpas-2.2.3}/CHANGELOG.md +23 -1
- {gpas-2.2.2rc2 → gpas-2.2.3}/Dockerfile +1 -1
- {gpas-2.2.2rc2 → gpas-2.2.3}/PKG-INFO +6 -16
- {gpas-2.2.2rc2 → gpas-2.2.3}/README_pypi.md +4 -15
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/build-csv.md +1 -1
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/decontaminate.md +1 -1
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/install-dev.md +1 -1
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/validate.md +2 -2
- {gpas-2.2.2rc2 → gpas-2.2.3}/pyproject.toml +5 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/src/gpas/__init__.py +1 -1
- {gpas-2.2.2rc2 → gpas-2.2.3}/src/gpas/cli.py +63 -57
- gpas-2.2.3/src/gpas/client/env.py +127 -0
- gpas-2.2.3/src/gpas/client/upload_client.py +433 -0
- gpas-2.2.3/src/gpas/constants.py +27 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/src/gpas/errors.py +8 -0
- gpas-2.2.3/src/gpas/http_helpers.py +144 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/src/gpas/log_utils.py +18 -7
- {gpas-2.2.2rc2 → gpas-2.2.3}/src/gpas/models.py +53 -27
- gpas-2.2.3/src/gpas/tasks/__init__.py +67 -0
- gpas-2.2.3/src/gpas/tasks/authentication.py +83 -0
- gpas-2.2.3/src/gpas/tasks/download.py +201 -0
- gpas-2.2.2rc2/src/gpas/create_upload_csv.py → gpas-2.2.3/src/gpas/tasks/prep_samples.py +106 -15
- gpas-2.2.3/src/gpas/tasks/query.py +267 -0
- gpas-2.2.3/src/gpas/tasks/upload.py +504 -0
- gpas-2.2.3/src/gpas/tasks/validate.py +74 -0
- gpas-2.2.3/src/gpas/types.py +273 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/src/gpas/util.py +2 -82
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/conftest.py +8 -4
- gpas-2.2.3/tests/test_auth.py +94 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/test_build_csv.py +4 -3
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/test_cli.py +7 -10
- gpas-2.2.2rc2/tests/test_lib.py → gpas-2.2.3/tests/test_tasks.py +11 -11
- gpas-2.2.3/tests/test_upload.py +711 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/test_util.py +6 -10
- {gpas-2.2.2rc2 → gpas-2.2.3}/uv.lock +2 -0
- gpas-2.2.2rc2/src/gpas/batch_upload_apis.py +0 -278
- gpas-2.2.2rc2/src/gpas/constants.py +0 -26
- gpas-2.2.2rc2/src/gpas/lib.py +0 -904
- gpas-2.2.2rc2/src/gpas/upload_utils.py +0 -821
- gpas-2.2.2rc2/tests/test_upload.py +0 -688
- {gpas-2.2.2rc2 → gpas-2.2.3}/.env.local +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/.github/workflows/test.yml +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/GPL3 +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/LICENSE +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/README.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/assets/example-input-mycobacteria.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/assets/example-input-sarscov2.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/assets/example-mapping.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/auth.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/autocomplete.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/balance.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/download.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/install.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/intro.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/query-raw.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/query-status.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/releases.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/support.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/docs/upload.md +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/environment.yml +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/generate_pypi_readme.sh +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/__init__.py +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/auto_upload_csvs/batch1.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/auto_upload_csvs/batch2.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/auto_upload_csvs/illumina.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/auto_upload_csvs/ont.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/auto_upload_csvs/sars_cov_2_illumina_amp_scheme.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_1_1.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_1_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_1_2.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_1_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_2_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_2_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_3_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_3_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_4_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_4_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_5_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/empty_files/read_5_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/illumina-2.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/illumina-gzipped.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/illumina.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/empty-fastq.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/empty-sample-name.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/empty-specimen-organism.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/invalid-control.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/invalid-fastq-path.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/invalid-instrument-platform.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/invalid-specimen-organism.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/mismatched-fastqs.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/invalid/mixed-instrument-platform.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/myco_illumina_amp.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/ont-2.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/ont-gzipped.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/ont.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/bad_1_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/bad_1_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/empty_1_1.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/empty_1_2.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/human_1_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/human_1_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/sars-cov-2_1_1.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/sars-cov-2_1_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/sars-cov-2_1_2.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/sars-cov-2_1_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/sars-cov-2_2_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/sars-cov-2_2_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/tuberculosis_1_1.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/tuberculosis_1_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/tuberculosis_1_2.fastq +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/reads/tuberculosis_1_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/sars-cov-2_illumina.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/sars_cov_2_illumina_amp_scheme.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/sars_cov_2_illumina_bad_amp_scheme.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/sars_cov_2_illumina_mix_amp_scheme.csv +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/unmatched_files/read_1_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/unmatched_files/read_1_2.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/data/unmatched_files/read_2_1.fastq.gz +0 -0
- {gpas-2.2.2rc2 → gpas-2.2.3}/tests/test_all.py +0 -0
|
@@ -6,7 +6,7 @@ repos:
|
|
|
6
6
|
- exclude: (.git/)
|
|
7
7
|
id: remove-tabs
|
|
8
8
|
repo: https://github.com/Lucas-C/pre-commit-hooks
|
|
9
|
-
rev: v1.
|
|
9
|
+
rev: v1.5.5
|
|
10
10
|
- hooks:
|
|
11
11
|
- id: trailing-whitespace
|
|
12
12
|
exclude: ^test_files/
|
|
@@ -16,15 +16,15 @@ repos:
|
|
|
16
16
|
- id: check-merge-conflict
|
|
17
17
|
- id: check-docstring-first
|
|
18
18
|
repo: https://github.com/pre-commit/pre-commit-hooks
|
|
19
|
-
rev:
|
|
19
|
+
rev: v5.0.0
|
|
20
20
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
21
21
|
# Ruff version.
|
|
22
|
-
rev: v0.
|
|
22
|
+
rev: v0.12.3
|
|
23
23
|
hooks:
|
|
24
24
|
- id: ruff-format
|
|
25
25
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
26
26
|
# Ruff version.
|
|
27
|
-
rev: v0.
|
|
27
|
+
rev: v0.12.3
|
|
28
28
|
hooks:
|
|
29
|
-
- id: ruff
|
|
30
|
-
args: [--fix
|
|
29
|
+
- id: ruff-check
|
|
30
|
+
args: [--fix]
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
##
|
|
1
|
+
## Unreleased
|
|
2
|
+
|
|
3
|
+
## 2.2.3 (2025-09-09)
|
|
4
|
+
|
|
5
|
+
## 2.2.3-RC1 (2025-09-08)
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- [EV-2358](https://eit-oxford.atlassian.net/browse/EV-2358): allow follow redirects
|
|
10
|
+
- [EV-2149](https://eit-oxford.atlassian.net/browse/EV-2149): minimum cli version enforcement.
|
|
11
|
+
- [EV-1909](https://eit-oxford.atlassian.net/browse/EV-1909): Added calls to log mapping csv as downloaded in portal
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- [EV-2339](https://eit-oxford.atlassian.net/browse/EV-2339): Fix doc links form EIT-Pathogena to GPAS org
|
|
16
|
+
- [EV-2299](https://eit-oxford.atlassian.net/browse/EV-2299): Fix validate command creating an empty batch
|
|
17
|
+
- [EV-2386](https://eit-oxford.atlassian.net/browse/EV-2386): Fix --save logic with decontamination
|
|
18
|
+
|
|
19
|
+
## 2.2.2 (2025-08-18)
|
|
20
|
+
|
|
21
|
+
## 2.2.2-RC2 (2025-08-18)
|
|
2
22
|
|
|
3
23
|
- [EV-2329](https://eit-oxford.atlassian.net/browse/EV-2329): Migrate to GlobalPathogenAnalysisService GitHub organisation
|
|
4
24
|
|
|
@@ -22,6 +42,7 @@
|
|
|
22
42
|
|
|
23
43
|
### Fixed
|
|
24
44
|
|
|
45
|
+
- [EV-1960](https://eit-oxford.atlassian.net/browse/EV-1960): refactor lib into tasks, fix mypy issues plus many more QoL fixes.
|
|
25
46
|
- [EV-2139](https://eit-oxford.atlassian.net/browse/EV-2139): fix mapping csv to use correct batch and sample names with rows per sample
|
|
26
47
|
|
|
27
48
|
## 2.2.0-RC2 (2025-06-18)
|
|
@@ -51,6 +72,7 @@
|
|
|
51
72
|
|
|
52
73
|
### Added
|
|
53
74
|
|
|
75
|
+
- [EV-1909](https://eit-oxford.atlassian.net/browse/EV-1909): Added calls to log mapping csv as downloaded in portal
|
|
54
76
|
- Minimum upload chunk size is increased to 10MB
|
|
55
77
|
- Support for the SARS-CoV-2 pipeline.
|
|
56
78
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bioconda-based build against latest PyPI release
|
|
2
2
|
# Created for a specific user. Not part of the pypi release process
|
|
3
3
|
FROM condaforge/miniforge3:latest
|
|
4
|
-
ENV GPAS_CLIENT_VERSION=2.2.
|
|
4
|
+
ENV GPAS_CLIENT_VERSION=2.2.3
|
|
5
5
|
RUN mamba install -c bioconda hostile==1.1.0
|
|
6
6
|
RUN pip install https://pypi.io/packages/source/g/gpas/gpas-${GPAS_CLIENT_VERSION}.tar.gz
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gpas
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: The command line and Python client for GPAS.
|
|
5
5
|
Keywords: gpas,global pathogen analysis service,pathogen,pathogena,eit
|
|
6
6
|
Author-email: GPAS Devs <gpas.support@eit.org>
|
|
@@ -16,6 +16,7 @@ Requires-Dist: pydantic>=2.6.2,<3
|
|
|
16
16
|
Requires-Dist: tenacity==8.2.3
|
|
17
17
|
Requires-Dist: click>=8.1.7
|
|
18
18
|
Requires-Dist: python-dotenv>=1.0
|
|
19
|
+
Requires-Dist: pytest-mock>=3.14.0
|
|
19
20
|
Requires-Dist: flit>=3.9.0 ; extra == "dev"
|
|
20
21
|
Requires-Dist: pre-commit>=4.0.1 ; extra == "dev"
|
|
21
22
|
Requires-Dist: pytest>=8.3.3 ; extra == "dev"
|
|
@@ -271,7 +272,7 @@ gpas upload --skip-decontamination my-first-batch.csv
|
|
|
271
272
|
|
|
272
273
|
**help**
|
|
273
274
|
|
|
274
|
-
This command generates a CSV from a given directory of fastq sample files. An [example](https://github.com/
|
|
275
|
+
This command generates a CSV from a given directory of fastq sample files. An [example](https://github.com/GlobalPathogenAnalysisService/client/tree/2.2.3/docs/assets) of such a CSV file is given in the assets directory. A CSV file in this format is required to run the [gpas upload](#gpas-upload) command.
|
|
275
276
|
|
|
276
277
|
Note: the CSV file must be located in the same directory as the sample.fastq files to be used with the upload command.
|
|
277
278
|
|
|
@@ -303,7 +304,7 @@ gpas build-csv ~/Downloads/samples \
|
|
|
303
304
|
**help**
|
|
304
305
|
|
|
305
306
|
This command will attempt to remove human reads from a given input CSV file, in the same structure as the input CSV that
|
|
306
|
-
would be used for uploading to GPAS, an [example can be found here](https://github.com/
|
|
307
|
+
would be used for uploading to GPAS, an [example can be found here](https://github.com/GlobalPathogenAnalysisService/client/tree/2.2.3/docs/assets).
|
|
307
308
|
|
|
308
309
|
By default, the processed files will be output in the same directory that the command is run in, but you can choose a
|
|
309
310
|
different directory with the `--output-dir` argument.
|
|
@@ -359,22 +360,11 @@ gpas download a5w2e8.mapping.csv --inputs --filenames ""
|
|
|
359
360
|
The complete list of `--filenames` available for download varies by sample, and can be found in the Downloads section of
|
|
360
361
|
sample view pages in GPAS.
|
|
361
362
|
|
|
362
|
-
|
|
363
|
-
<a id="gpas-validate"></a>
|
|
364
|
-
|
|
365
|
-
```text
|
|
366
|
-
Usage: gpas validate [OPTIONS] UPLOAD_CSV
|
|
367
|
-
|
|
368
|
-
Validate a given upload CSV.
|
|
369
|
-
|
|
370
|
-
Options:
|
|
371
|
-
--host TEXT API hostname (for development)
|
|
372
|
-
-h, --help Show this message and exit.
|
|
373
|
-
```
|
|
363
|
+
**help**
|
|
374
364
|
|
|
375
365
|
The `validate` command will check that a Batch can be created from a given CSV and if your user account has permission
|
|
376
366
|
to upload the samples, the individual FastQ files are then checked for validity. These checks are already performed
|
|
377
|
-
by default with the `upload` command but using this can ensure validity without
|
|
367
|
+
by default with the `upload` command but using this can ensure validity without committing to the subsequent upload
|
|
378
368
|
if you're looking to check a CSV during writing it.
|
|
379
369
|
|
|
380
370
|
**help**
|
|
@@ -246,7 +246,7 @@ gpas upload --skip-decontamination my-first-batch.csv
|
|
|
246
246
|
|
|
247
247
|
**help**
|
|
248
248
|
|
|
249
|
-
This command generates a CSV from a given directory of fastq sample files. An [example](https://github.com/
|
|
249
|
+
This command generates a CSV from a given directory of fastq sample files. An [example](https://github.com/GlobalPathogenAnalysisService/client/tree/2.2.3/docs/assets) of such a CSV file is given in the assets directory. A CSV file in this format is required to run the [gpas upload](#gpas-upload) command.
|
|
250
250
|
|
|
251
251
|
Note: the CSV file must be located in the same directory as the sample.fastq files to be used with the upload command.
|
|
252
252
|
|
|
@@ -278,7 +278,7 @@ gpas build-csv ~/Downloads/samples \
|
|
|
278
278
|
**help**
|
|
279
279
|
|
|
280
280
|
This command will attempt to remove human reads from a given input CSV file, in the same structure as the input CSV that
|
|
281
|
-
would be used for uploading to GPAS, an [example can be found here](https://github.com/
|
|
281
|
+
would be used for uploading to GPAS, an [example can be found here](https://github.com/GlobalPathogenAnalysisService/client/tree/2.2.3/docs/assets).
|
|
282
282
|
|
|
283
283
|
By default, the processed files will be output in the same directory that the command is run in, but you can choose a
|
|
284
284
|
different directory with the `--output-dir` argument.
|
|
@@ -334,22 +334,11 @@ gpas download a5w2e8.mapping.csv --inputs --filenames ""
|
|
|
334
334
|
The complete list of `--filenames` available for download varies by sample, and can be found in the Downloads section of
|
|
335
335
|
sample view pages in GPAS.
|
|
336
336
|
|
|
337
|
-
|
|
338
|
-
<a id="gpas-validate"></a>
|
|
339
|
-
|
|
340
|
-
```text
|
|
341
|
-
Usage: gpas validate [OPTIONS] UPLOAD_CSV
|
|
342
|
-
|
|
343
|
-
Validate a given upload CSV.
|
|
344
|
-
|
|
345
|
-
Options:
|
|
346
|
-
--host TEXT API hostname (for development)
|
|
347
|
-
-h, --help Show this message and exit.
|
|
348
|
-
```
|
|
337
|
+
**help**
|
|
349
338
|
|
|
350
339
|
The `validate` command will check that a Batch can be created from a given CSV and if your user account has permission
|
|
351
340
|
to upload the samples, the individual FastQ files are then checked for validity. These checks are already performed
|
|
352
|
-
by default with the `upload` command but using this can ensure validity without
|
|
341
|
+
by default with the `upload` command but using this can ensure validity without committing to the subsequent upload
|
|
353
342
|
if you're looking to check a CSV during writing it.
|
|
354
343
|
|
|
355
344
|
**help**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
**help**
|
|
2
2
|
|
|
3
|
-
This command generates a CSV from a given directory of fastq sample files. An [example](https://github.com/
|
|
3
|
+
This command generates a CSV from a given directory of fastq sample files. An [example](https://github.com/GlobalPathogenAnalysisService/client/tree/__version__/docs/assets) of such a CSV file is given in the assets directory. A CSV file in this format is required to run the [gpas upload](#gpas-upload) command.
|
|
4
4
|
|
|
5
5
|
Note: the CSV file must be located in the same directory as the sample.fastq files to be used with the upload command.
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
**help**
|
|
2
2
|
|
|
3
3
|
This command will attempt to remove human reads from a given input CSV file, in the same structure as the input CSV that
|
|
4
|
-
would be used for uploading to GPAS, an [example can be found here](https://github.com/
|
|
4
|
+
would be used for uploading to GPAS, an [example can be found here](https://github.com/GlobalPathogenAnalysisService/client/tree/__version__/docs/assets).
|
|
5
5
|
|
|
6
6
|
By default, the processed files will be output in the same directory that the command is run in, but you can choose a
|
|
7
7
|
different directory with the `--output-dir` argument.
|
|
@@ -7,7 +7,7 @@ Installation of the client requires the `conda` package manager, as well as
|
|
|
7
7
|
information on how to install that, please refer to [this section](install.md#installing-miniconda).
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
git clone https://github.com/
|
|
10
|
+
git clone https://github.com/GlobalPathogenAnalysisService/client.git
|
|
11
11
|
cd client
|
|
12
12
|
conda env create -y -f environment.yml
|
|
13
13
|
conda activate gpas
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
**help**
|
|
2
2
|
|
|
3
3
|
The `validate` command will check that a Batch can be created from a given CSV and if your user account has permission
|
|
4
4
|
to upload the samples, the individual FastQ files are then checked for validity. These checks are already performed
|
|
5
|
-
by default with the `upload` command but using this can ensure validity without
|
|
5
|
+
by default with the `upload` command but using this can ensure validity without committing to the subsequent upload
|
|
6
6
|
if you're looking to check a CSV during writing it.
|
|
@@ -26,6 +26,7 @@ dependencies = [
|
|
|
26
26
|
"tenacity==8.2.3",
|
|
27
27
|
"click>=8.1.7",
|
|
28
28
|
"python-dotenv>=1.0",
|
|
29
|
+
"pytest-mock>=3.14.0",
|
|
29
30
|
]
|
|
30
31
|
|
|
31
32
|
[project.scripts]
|
|
@@ -48,6 +49,7 @@ select = [
|
|
|
48
49
|
"D",
|
|
49
50
|
"DJ",
|
|
50
51
|
"E",
|
|
52
|
+
"F",
|
|
51
53
|
"I",
|
|
52
54
|
"N",
|
|
53
55
|
"SIM",
|
|
@@ -120,6 +122,9 @@ dev-dependencies = [
|
|
|
120
122
|
"pytest-mock>=3.14.0",
|
|
121
123
|
]
|
|
122
124
|
|
|
125
|
+
[[tool.mypy.overrides]]
|
|
126
|
+
module = ["hostile.*", "httpx.*", "tenacity.*", "click.*", "tqdm.*", "dotenv.*"]
|
|
127
|
+
ignore_missing_imports = true
|
|
123
128
|
|
|
124
129
|
[tool.pytest.ini_options]
|
|
125
130
|
markers = ["slow: marks tests as slow (deselect with '-m \"not slow\"')"]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import json
|
|
1
|
+
import json
|
|
2
2
|
import logging
|
|
3
3
|
import sys
|
|
4
4
|
from datetime import date, datetime
|
|
@@ -7,8 +7,8 @@ from pathlib import Path
|
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
|
|
10
|
-
from gpas import constants,
|
|
11
|
-
from gpas.
|
|
10
|
+
from gpas import constants, models, tasks, util
|
|
11
|
+
from gpas.client import env
|
|
12
12
|
from gpas.errors import AuthorizationError
|
|
13
13
|
from gpas.log_utils import configure_debug_logging
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ from gpas.log_utils import configure_debug_logging
|
|
|
20
20
|
)
|
|
21
21
|
def main(*, debug: bool = False) -> None:
|
|
22
22
|
"""GPAS command line interface."""
|
|
23
|
-
|
|
23
|
+
tasks.check_for_newer_version()
|
|
24
24
|
util.display_cli_version()
|
|
25
25
|
configure_debug_logging(debug)
|
|
26
26
|
|
|
@@ -40,15 +40,15 @@ def main(*, debug: bool = False) -> None:
|
|
|
40
40
|
)
|
|
41
41
|
def auth(*, host: str | None = None, check_expiry: bool = False) -> None:
|
|
42
42
|
"""Authenticate with GPAS."""
|
|
43
|
-
host =
|
|
43
|
+
host = env.get_host(host)
|
|
44
44
|
if check_expiry:
|
|
45
|
-
expiry =
|
|
46
|
-
if expiry and
|
|
45
|
+
expiry = env.get_token_expiry(host)
|
|
46
|
+
if expiry and env.is_auth_token_live(host):
|
|
47
47
|
logging.info(f"Current token for {host} expires at {expiry}")
|
|
48
48
|
return
|
|
49
49
|
else:
|
|
50
50
|
logging.info(f"You do not have a valid token for {host}")
|
|
51
|
-
|
|
51
|
+
tasks.authenticate(host=host)
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
@main.command()
|
|
@@ -63,8 +63,8 @@ def balance(
|
|
|
63
63
|
host: str | None = None,
|
|
64
64
|
) -> None:
|
|
65
65
|
"""Check your GPAS account balance."""
|
|
66
|
-
host =
|
|
67
|
-
|
|
66
|
+
host = env.get_host(host)
|
|
67
|
+
tasks.fetch_credit_balance(host=host)
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
@main.command()
|
|
@@ -111,7 +111,7 @@ def decontaminate(
|
|
|
111
111
|
"""Decontaminate reads from provided csv samples."""
|
|
112
112
|
batch = models.create_batch_from_csv(input_csv, skip_fastq_check)
|
|
113
113
|
batch.validate_all_sample_fastqs()
|
|
114
|
-
cleaned_batch_metadata =
|
|
114
|
+
cleaned_batch_metadata = tasks.decontaminate_samples_with_hostile(
|
|
115
115
|
batch, threads, output_dir
|
|
116
116
|
)
|
|
117
117
|
batch.update_sample_metadata(metadata=cleaned_batch_metadata)
|
|
@@ -169,8 +169,8 @@ def upload(
|
|
|
169
169
|
Creates a mapping CSV file which can be used to download output
|
|
170
170
|
files with original sample names.
|
|
171
171
|
"""
|
|
172
|
-
host =
|
|
173
|
-
|
|
172
|
+
host = env.get_host(host)
|
|
173
|
+
tasks.check_version_compatibility(host=host)
|
|
174
174
|
if skip_fastq_check and skip_decontamination:
|
|
175
175
|
logging.warning(
|
|
176
176
|
"Cannot skip FastQ checks and decontamination due to metadata requirements for upload, continuing with"
|
|
@@ -179,19 +179,21 @@ def upload(
|
|
|
179
179
|
skip_fastq_check = False
|
|
180
180
|
batch = models.create_batch_from_csv(upload_csv, skip_fastq_check)
|
|
181
181
|
|
|
182
|
-
if
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
if env.is_auth_token_live(host):
|
|
183
|
+
tasks.fetch_credit_balance(host=host)
|
|
184
|
+
tasks.validate_upload_permissions(batch, protocol=env.get_protocol(), host=host)
|
|
185
185
|
if skip_decontamination:
|
|
186
186
|
batch.validate_all_sample_fastqs()
|
|
187
187
|
batch.update_sample_metadata()
|
|
188
188
|
else:
|
|
189
|
-
cleaned_batch_metadata =
|
|
189
|
+
cleaned_batch_metadata = tasks.decontaminate_samples_with_hostile(
|
|
190
190
|
batch, threads, output_dir=output_dir
|
|
191
191
|
)
|
|
192
192
|
batch.update_sample_metadata(metadata=cleaned_batch_metadata)
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
tasks.upload_batch(
|
|
194
|
+
batch=batch, save=save, skip_decontamination=skip_decontamination
|
|
195
|
+
)
|
|
196
|
+
tasks.fetch_credit_balance(host=host)
|
|
195
197
|
else:
|
|
196
198
|
raise AuthorizationError()
|
|
197
199
|
|
|
@@ -234,10 +236,10 @@ def download(
|
|
|
234
236
|
|
|
235
237
|
That are created during upload.
|
|
236
238
|
"""
|
|
237
|
-
host =
|
|
238
|
-
if
|
|
239
|
+
host = env.get_host(host)
|
|
240
|
+
if env.is_auth_token_live(host):
|
|
239
241
|
if util.validate_guids(util.parse_comma_separated_string(samples)):
|
|
240
|
-
|
|
242
|
+
tasks.download(
|
|
241
243
|
samples=samples,
|
|
242
244
|
filenames=filenames,
|
|
243
245
|
inputs=inputs,
|
|
@@ -245,7 +247,7 @@ def download(
|
|
|
245
247
|
host=host,
|
|
246
248
|
)
|
|
247
249
|
elif Path(samples).is_file():
|
|
248
|
-
|
|
250
|
+
tasks.download(
|
|
249
251
|
mapping_csv=Path(samples),
|
|
250
252
|
filenames=filenames,
|
|
251
253
|
inputs=inputs,
|
|
@@ -269,38 +271,40 @@ def query_raw(samples: str, *, host: str | None = None) -> None:
|
|
|
269
271
|
|
|
270
272
|
SAMPLES should be command separated list of GUIDs or path to mapping CSV.
|
|
271
273
|
"""
|
|
272
|
-
host =
|
|
274
|
+
host = env.get_host(host)
|
|
273
275
|
if util.validate_guids(util.parse_comma_separated_string(samples)):
|
|
274
|
-
result =
|
|
276
|
+
result = tasks.fetch_sample_metadata(samples=samples, host=host)
|
|
275
277
|
elif (sample_path := Path(samples)).is_file():
|
|
276
|
-
result =
|
|
278
|
+
result = tasks.fetch_sample_metadata(mapping_csv=sample_path, host=host)
|
|
277
279
|
else:
|
|
278
280
|
raise ValueError(
|
|
279
281
|
f"{samples} is neither a valid mapping CSV path nor a comma-separated list of valid GUIDs"
|
|
280
282
|
)
|
|
281
|
-
print(
|
|
283
|
+
print(json.dumps(result, indent=4)) # noqa: T201
|
|
282
284
|
|
|
283
285
|
|
|
284
286
|
@main.command()
|
|
285
287
|
@click.argument("samples", type=str)
|
|
286
|
-
@click.option("--
|
|
288
|
+
@click.option("--output_json", is_flag=True, help="Output status in JSON format")
|
|
287
289
|
@click.option("--host", type=str, default=None, help="API hostname (for development)")
|
|
288
|
-
def query_status(
|
|
290
|
+
def query_status(
|
|
291
|
+
samples: str, *, output_json: bool = False, host: str | None = None
|
|
292
|
+
) -> None:
|
|
289
293
|
"""Fetch processing status for one or more SAMPLES.
|
|
290
294
|
|
|
291
295
|
SAMPLES should be command separated list of GUIDs or path to mapping CSV.
|
|
292
296
|
"""
|
|
293
|
-
host =
|
|
297
|
+
host = env.get_host(host)
|
|
294
298
|
if util.validate_guids(util.parse_comma_separated_string(samples)):
|
|
295
|
-
result =
|
|
299
|
+
result = tasks.fetch_sample_status(samples=samples, host=host)
|
|
296
300
|
elif (sample_path := Path(samples)).is_file():
|
|
297
|
-
result =
|
|
301
|
+
result = tasks.fetch_sample_status(mapping_csv=sample_path, host=host)
|
|
298
302
|
else:
|
|
299
303
|
raise ValueError(
|
|
300
304
|
f"{samples} is neither a valid mapping CSV path nor a comma-separated list of valid GUIDs"
|
|
301
305
|
)
|
|
302
|
-
if
|
|
303
|
-
print(
|
|
306
|
+
if output_json:
|
|
307
|
+
print(json.dumps(result, indent=4)) # noqa: T201
|
|
304
308
|
else:
|
|
305
309
|
for name, status in result.items():
|
|
306
310
|
print(f"{name} \t{status}") # noqa: T201
|
|
@@ -309,7 +313,7 @@ def query_status(samples: str, *, json: bool = False, host: str | None = None) -
|
|
|
309
313
|
@main.command()
|
|
310
314
|
def download_index() -> None:
|
|
311
315
|
"""Download and cache host decontamination index."""
|
|
312
|
-
|
|
316
|
+
tasks.download_index()
|
|
313
317
|
|
|
314
318
|
|
|
315
319
|
@main.command()
|
|
@@ -319,10 +323,12 @@ def download_index() -> None:
|
|
|
319
323
|
@click.option("--host", type=str, default=None, help="API hostname (for development)")
|
|
320
324
|
def validate(upload_csv: Path, *, host: str | None = None) -> None:
|
|
321
325
|
"""Validate a given upload CSV."""
|
|
322
|
-
host =
|
|
326
|
+
host = env.get_host(host)
|
|
323
327
|
batch = models.create_batch_from_csv(upload_csv)
|
|
324
|
-
|
|
325
|
-
|
|
328
|
+
tasks.validate_csv(host, batch)
|
|
329
|
+
tasks.validate_upload_permissions(
|
|
330
|
+
batch=batch, protocol=env.get_protocol(), host=host
|
|
331
|
+
)
|
|
326
332
|
batch.validate_all_sample_fastqs()
|
|
327
333
|
logging.info(f"Successfully validated {upload_csv}")
|
|
328
334
|
|
|
@@ -352,27 +358,27 @@ def validate(upload_csv: Path, *, host: str | None = None) -> None:
|
|
|
352
358
|
type=str,
|
|
353
359
|
help="3-letter Country Code",
|
|
354
360
|
required=True,
|
|
355
|
-
default=constants.
|
|
361
|
+
default=constants.DEFAULT_COUNTRY,
|
|
356
362
|
show_default=True,
|
|
357
363
|
)
|
|
358
364
|
@click.option(
|
|
359
365
|
"--instrument-platform",
|
|
360
366
|
type=click.Choice(["illumina", "ont"]),
|
|
361
|
-
default=constants.
|
|
367
|
+
default=constants.DEFAULT_INSTRUMENTPLATFORM,
|
|
362
368
|
help="Sequencing technology",
|
|
363
369
|
)
|
|
364
370
|
@click.option(
|
|
365
371
|
"--subdivision",
|
|
366
372
|
type=str,
|
|
367
373
|
help="Subdivision",
|
|
368
|
-
default=constants.
|
|
374
|
+
default=constants.DEFAULT_SUBDIVISION,
|
|
369
375
|
show_default=True,
|
|
370
376
|
)
|
|
371
377
|
@click.option(
|
|
372
378
|
"--district",
|
|
373
379
|
type=str,
|
|
374
380
|
help="District",
|
|
375
|
-
default=constants.
|
|
381
|
+
default=constants.DEFAULT_DISTRICT,
|
|
376
382
|
show_default=True,
|
|
377
383
|
)
|
|
378
384
|
@click.option(
|
|
@@ -380,12 +386,12 @@ def validate(upload_csv: Path, *, host: str | None = None) -> None:
|
|
|
380
386
|
"pipeline",
|
|
381
387
|
type=click.Choice(["mycobacteria", "sars-cov-2"]),
|
|
382
388
|
help="Specimen organism",
|
|
383
|
-
default=constants.
|
|
389
|
+
default=constants.DEFAULT_PIPELINE,
|
|
384
390
|
show_default=True,
|
|
385
391
|
)
|
|
386
392
|
@click.option(
|
|
387
393
|
"--amplicon-scheme",
|
|
388
|
-
type=click.Choice(
|
|
394
|
+
type=click.Choice(tasks.fetch_amplicon_schemes()),
|
|
389
395
|
help="Amplicon scheme, use only when SARS-CoV-2 is the specimen organism",
|
|
390
396
|
default=None,
|
|
391
397
|
show_default=True,
|
|
@@ -393,21 +399,21 @@ def validate(upload_csv: Path, *, host: str | None = None) -> None:
|
|
|
393
399
|
@click.option(
|
|
394
400
|
"--ont_read_suffix",
|
|
395
401
|
type=str,
|
|
396
|
-
default=constants.
|
|
402
|
+
default=constants.DEFAULT_ONT_READ_SUFFIX,
|
|
397
403
|
help="Read file ending for ONT fastq files",
|
|
398
404
|
show_default=True,
|
|
399
405
|
)
|
|
400
406
|
@click.option(
|
|
401
407
|
"--illumina_read1_suffix",
|
|
402
408
|
type=str,
|
|
403
|
-
default=constants.
|
|
409
|
+
default=constants.DEFAULT_ILLUMINA_READ1_SUFFIX,
|
|
404
410
|
help="Read file ending for Illumina read 1 files",
|
|
405
411
|
show_default=True,
|
|
406
412
|
)
|
|
407
413
|
@click.option(
|
|
408
414
|
"--illumina_read2_suffix",
|
|
409
415
|
type=str,
|
|
410
|
-
default=constants.
|
|
416
|
+
default=constants.DEFAULT_ILLUMINA_READ2_SUFFIX,
|
|
411
417
|
help="Read file ending for Illumina read 2 files",
|
|
412
418
|
show_default=True,
|
|
413
419
|
)
|
|
@@ -419,15 +425,15 @@ def build_csv(
|
|
|
419
425
|
batch_name: str,
|
|
420
426
|
collection_date: datetime,
|
|
421
427
|
country: str,
|
|
422
|
-
subdivision: str = constants.
|
|
423
|
-
district: str = constants.
|
|
424
|
-
pipeline: str = constants.
|
|
428
|
+
subdivision: str = constants.DEFAULT_SUBDIVISION,
|
|
429
|
+
district: str = constants.DEFAULT_DISTRICT,
|
|
430
|
+
pipeline: str = constants.DEFAULT_PIPELINE,
|
|
425
431
|
amplicon_scheme: str | None = None,
|
|
426
432
|
host_organism: str = "homo sapiens",
|
|
427
|
-
ont_read_suffix: str = constants.
|
|
428
|
-
illumina_read1_suffix: str = constants.
|
|
429
|
-
illumina_read2_suffix: str = constants.
|
|
430
|
-
max_batch_size: int = constants.
|
|
433
|
+
ont_read_suffix: str = constants.DEFAULT_ONT_READ_SUFFIX,
|
|
434
|
+
illumina_read1_suffix: str = constants.DEFAULT_ILLUMINA_READ1_SUFFIX,
|
|
435
|
+
illumina_read2_suffix: str = constants.DEFAULT_ILLUMINA_READ2_SUFFIX,
|
|
436
|
+
max_batch_size: int = constants.DEFAULT_MAX_BATCH_SIZE,
|
|
431
437
|
) -> None:
|
|
432
438
|
r"""Command to create upload csv from SAMPLES_FOLDER containing sample fastqs.
|
|
433
439
|
|
|
@@ -440,7 +446,7 @@ def build_csv(
|
|
|
440
446
|
output_csv = Path(output_csv)
|
|
441
447
|
samples_folder = Path(samples_folder)
|
|
442
448
|
|
|
443
|
-
upload_data = UploadData(
|
|
449
|
+
upload_data = models.UploadData(
|
|
444
450
|
batch_name=batch_name,
|
|
445
451
|
instrument_platform=instrument_platform, # type: ignore
|
|
446
452
|
collection_date=collection_date,
|
|
@@ -456,7 +462,7 @@ def build_csv(
|
|
|
456
462
|
max_batch_size=max_batch_size,
|
|
457
463
|
)
|
|
458
464
|
|
|
459
|
-
build_upload_csv(
|
|
465
|
+
tasks.build_upload_csv(
|
|
460
466
|
samples_folder,
|
|
461
467
|
output_csv,
|
|
462
468
|
upload_data,
|
|
@@ -467,7 +473,7 @@ def build_csv(
|
|
|
467
473
|
@click.option("--host", type=str, default=None, help="API hostname (for development)")
|
|
468
474
|
def get_amplicon_schemes(*, host: str | None = None) -> None:
|
|
469
475
|
"""Get valid amplicon schemes from the server."""
|
|
470
|
-
schemes =
|
|
476
|
+
schemes = tasks.fetch_amplicon_schemes(host=host)
|
|
471
477
|
logging.info("Valid amplicon schemes:")
|
|
472
478
|
for scheme in schemes:
|
|
473
479
|
logging.info(scheme)
|