grz-cli 1.1.2__tar.gz → 1.2.0__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.
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.0](https://github.com/BfArM-MVH/grz-tools/compare/grz-cli-v1.1.2...grz-cli-v1.2.0) (2025-08-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * **grz-cli,grzctl:** bump grz dependencies to latest ([#359](https://github.com/BfArM-MVH/grz-tools/issues/359)) ([b31c88b](https://github.com/BfArM-MVH/grz-tools/commit/b31c88bfa32cf257e6db9b2bb80d302493dbd469))
9
+ * **grz-cli:** add command to compute submission ID from metadata ([#348](https://github.com/BfArM-MVH/grz-tools/issues/348)) ([674d0f1](https://github.com/BfArM-MVH/grz-tools/commit/674d0f1acb3b048cdbde2eb10056faf74033c309))
10
+ * **grz-cli:** also report grz library versions ([#355](https://github.com/BfArM-MVH/grz-tools/issues/355)) ([58d047e](https://github.com/BfArM-MVH/grz-tools/commit/58d047ec3492df172067312203da49c8af83a1a8))
11
+ * **grz-cli:** also write submission ID to logs on upload ([#347](https://github.com/BfArM-MVH/grz-tools/issues/347)) ([1de43aa](https://github.com/BfArM-MVH/grz-tools/commit/1de43aa5807f22bff47683c2da356f607180ef51))
12
+ * **grz-cli:** write command line to logs ([#354](https://github.com/BfArM-MVH/grz-tools/issues/354)) ([bc28b23](https://github.com/BfArM-MVH/grz-tools/commit/bc28b23ae617d7c8837e872c24858b50d35bf25a))
13
+ * **grzctl:** also report grz library versions ([58d047e](https://github.com/BfArM-MVH/grz-tools/commit/58d047ec3492df172067312203da49c8af83a1a8))
14
+
15
+
16
+ ### Documentation
17
+
18
+ * **grz-cli:** add docs for submit command to README ([#351](https://github.com/BfArM-MVH/grz-tools/issues/351)) ([8d4b138](https://github.com/BfArM-MVH/grz-tools/commit/8d4b13850da435dfee60060caf4a47ddbe59a4d4))
19
+ * **grz-cli:** clean and update README ([#352](https://github.com/BfArM-MVH/grz-tools/issues/352)) ([5c037b7](https://github.com/BfArM-MVH/grz-tools/commit/5c037b749b5cd97b44a53c61618e35787ab11f2a))
20
+
3
21
  ## [1.1.2](https://github.com/BfArM-MVH/grz-tools/compare/grz-cli-v1.1.1...grz-cli-v1.1.2) (2025-08-05)
4
22
 
5
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grz-cli
3
- Version: 1.1.2
3
+ Version: 1.2.0
4
4
  Summary: Tool for validation, encryption and upload of MV submissions to GDCs.
5
5
  Project-URL: Homepage, https://github.com/BfArM-MVH/grz-tools
6
6
  Project-URL: Repository, https://github.com/BfArM-MVH/grz-tools
@@ -16,8 +16,8 @@ Requires-Python: >=3.12
16
16
  Requires-Dist: boto3<2,>=1.36
17
17
  Requires-Dist: click<9,>=8.2
18
18
  Requires-Dist: crypt4gh<2,>=1.7
19
- Requires-Dist: grz-common<2,>=1.2.1
20
- Requires-Dist: grz-pydantic-models<3,>=2.1.2
19
+ Requires-Dist: grz-common<2,>=1.3.0
20
+ Requires-Dist: grz-pydantic-models<3,>=2.2.1
21
21
  Requires-Dist: jsonschema<5,>=4.23.0
22
22
  Requires-Dist: platformdirs<5,>=4.3.6
23
23
  Requires-Dist: pydantic-settings<2.10,>=2.9.0
@@ -29,93 +29,61 @@ Requires-Dist: rich==13.*
29
29
  Requires-Dist: tqdm<5,>=4.66.5
30
30
  Description-Content-Type: text/markdown
31
31
 
32
- # GRZ CLI
32
+ # `grz-cli`
33
+
34
+ A command-line tool for validating, encrypting, and uploading submissions to a genomDE Model Project GDC (Genome Data Center).
33
35
 
34
- A command-line tool for validating, encrypting, uploading and downloading submissions to/from a GDC/GRZ (Genomrechenzentrum).
35
36
 
36
37
  ## Table of Contents
37
38
 
38
- - [Introduction](#introduction)
39
- - [Features](#features)
40
39
  - [Installation](#installation)
41
40
  - [Requirements](#requirements)
42
- - [End-user setup](#end-user-setup)
43
- - [Installation via `conda` (recommended)](#installation-via-conda-recommended)
44
- - [Installation via `pip` (not recommended)](#installation-via-pip-not-recommended)
41
+ - [Using Conda (recommended)](#using-conda-recommended)
42
+ - [Using Docker](#using-docker)
45
43
  - [Usage](#usage)
46
44
  - [Configuration](#configuration)
47
- - [Exemplary submission procedure](#exemplary-submission-procedure)
45
+ - [Submission Layout](#submission-layout)
46
+ - [Example submission procedure](#example-submission-procedure)
47
+ - [Troubleshooting](#troubleshooting)
48
48
  - [Command-Line Interface](#command-line-interface)
49
- - [Testing](#testing)
50
49
  - [Contributing](#contributing)
51
50
  - [License](#license)
52
51
  - [Acknowledgements](#acknowledgements)
53
52
 
54
- ## Introduction
55
-
56
- This tool provides a way to validate files, encrypt/decrypt files using the [crypt4gh](https://crypt4gh.readthedocs.io/en/latest/) library and upload/download the encrypted files to an S3 bucket of a GDC/GRZ. It also logs the progress and outcomes of these operations in a metadata file.
57
53
 
58
- It is recommended to have the following folder structure for a single submission:
59
-
60
- ```
61
- EXAMPLE_SUBMISSION
62
- ├── files
63
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read1.fastq.gz
64
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read2.fastq.gz
65
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.vcf
66
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read1.fastq.gz
67
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read2.fastq.gz
68
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.vcf
69
- │ ├── target_regions.bed
70
- └── metadata
71
- └── metadata.json
72
- ```
73
-
74
- The current version of the tool requires the `working_dir` to have at least as much free disk space as the total size of the data being submitted.
75
- ## Features
54
+ ## Installation
76
55
 
77
- - **Validation**: Validate file checksums, basic file metadata and BfArM requirements.
78
- - **Encryption**: Encrypt files using `crypt4gh`.
79
- - **Decryption**: Encrypt files using `crypt4gh`.
80
- - **Upload**: Upload encrypted files directly to a GRZ either (via built-in `boto3`).
81
- - **Download**: Download encrypted files from a GRZ (via built-in `boto3`).
82
- - **Logging**: Log progress and results of operations
56
+ ### Requirements
83
57
 
58
+ The current version of the tool requires the working directory to have at least as much free disk space as the total size of the data being submitted.
84
59
 
85
- ## Installation
60
+ Beside of the disk space requirements for the submission data, this tool also requires a Linux environment.
61
+ For example:
86
62
 
87
- ### Requirements
88
- Beside of the disk space requirements for the submission data, this tool also requires a linux environment, e.g.:
89
63
  - Linux server
90
- - Virtual machine running linux
64
+ - Virtual machine running Linux
91
65
  - Docker container
92
- - Windows subsystem for linux
93
- - ...
94
-
66
+ - Windows Subsystem for Linux
95
67
 
96
- ### End-user setup
97
- The recommended method to install this tool is using the conda package manager.
98
68
 
69
+ ### Using [Conda](https://conda.io) (recommended)
99
70
 
100
- #### Installation via `conda` (recommended)
71
+ If Conda is not yet available on your system, we recommend to install it through the [Miniforge Conda installer](https://github.com/conda-forge/miniforge) by running the following commands:
101
72
 
102
- If `conda` is not yet available on your system, we recommend to install the [Miniforge conda distribution](https://github.com/conda-forge/miniforge) by running the following commands:
103
73
  ```bash
104
74
  curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
105
75
  bash Miniforge3-$(uname)-$(uname -m).sh
106
76
  ```
107
- There are also alternative ways to install conda:
108
- - [Micromamba, a single executable that does not require a base environment](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html)
109
- - [Official installation instructions](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html)
110
77
 
111
78
  Next, install the `grz-cli` tool:
79
+
112
80
  ```bash
113
- # create conda environment and activate it
114
- conda create -n grz-tools -c conda-forge -c bioconda "grz-cli"
81
+ conda create -n grz-tools -c conda-forge -c bioconda grz-cli
115
82
  conda activate grz-tools
83
+ grz-cli --help
116
84
  ```
117
85
 
118
- ##### Update instructions
86
+ #### Updating
119
87
 
120
88
  Use the following command to update the tool:
121
89
 
@@ -124,59 +92,97 @@ conda update -n grz-tools -c conda-forge -c bioconda grz-cli
124
92
  ```
125
93
 
126
94
 
127
- #### Installation via `pip` (not recommended)
128
- While installation via `pip` is possible, it is not recommended because users must ensure
129
- that the correct Python version is already installed and that they are using a virtual python environment.
95
+ ### Using pip (not recommended)
96
+
97
+ While installation via `pip` is possible, it is not recommended because users should create/manage a Python virtual environment and must ensure that the correct Python version is being used.
130
98
 
131
99
  ```bash
132
100
  pip install grz-cli
133
101
  ```
134
- ##### Update instructions:
102
+
103
+ #### Updating
104
+
135
105
  Use the following command to update the tool:
106
+
136
107
  ```bash
137
108
  pip upgrade grz-cli
138
109
  ```
139
110
 
140
111
 
141
- #### Docker
112
+ ### Using Docker
113
+
142
114
  Docker images are available via biocontainers at [https://biocontainers.pro/tools/grz-cli](https://biocontainers.pro/tools/grz-cli).
143
115
 
144
- The build process can take at least a few days after the Bioconda release, so double-check that the latest version in Bioconda is also the latest Docker image version.
116
+ The build process can take at least a few days after the Bioconda release, so double-check that the [latest version in Bioconda](https://anaconda.org/bioconda/grz-cli) is also the latest Docker image version.
145
117
 
146
118
  ## Usage
147
119
 
148
120
  ### Configuration
149
- **The configuration file will be provided by your associated GRZ, please place it into `~/.config/grz-cli/config.yaml`.**
150
121
 
151
- The tool requires a configuration file in YAML format to specify the S3 bucket and other options.
152
- For an exemplary configuration, see [resources/config.yaml](resources/config.yaml).
122
+ **The configuration file will be provided by your associated GRZ.**
123
+ **Do not create this file as an LE.**
124
+
125
+ The tool requires a configuration file in YAML format to specify the S3 API parameters and other validation options.
153
126
 
154
- S3 access and secret key can be listed either in the config file or as environment variable (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`).
127
+ This file may be placed at `~/.config/grz-cli/config.yaml` or provided each time to `grz-cli` using the `--config-file` option on the command line.
155
128
 
156
- ### Exemplary submission procedure
157
- After preparing your submission as outlined above, you can use the following commands to validate, encrypt and upload the submission:
158
- ```sh
159
- # Validate the submission
160
- grz-cli validate --submission-dir EXAMPLE_SUBMISSION
129
+ The S3 secrets can either be directly within the config file or as defined with the usual AWS environment variables: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
161
130
 
162
- # Encrypt the submission
163
- grz-cli encrypt --submission-dir EXAMPLE_SUBMISSION
131
+ ### Submission Layout
132
+
133
+ It is recommended to have the following folder structure for a single submission:
164
134
 
165
- # Upload the submission
166
- grz-cli upload --submission-dir EXAMPLE_SUBMISSION
135
+ ```
136
+ EXAMPLE_SUBMISSION
137
+ ├── files
138
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read1.fastq.gz
139
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read2.fastq.gz
140
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.vcf
141
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read1.fastq.gz
142
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read2.fastq.gz
143
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.vcf
144
+ │ └─── target_regions.bed
145
+ └── metadata
146
+ └── metadata.json
147
+ ```
148
+
149
+ The only requirements are that `metadata/metadata.json` exists and the `files/` directory contains all of the other files.
150
+ Data files may be nested under subfolders inside `files/` for better organization.
151
+ For example, each donor could have their own folder for files.
152
+
153
+
154
+ ### Example submission procedure
155
+
156
+ After preparing your submission as outlined above, you can use the following command to validate, encrypt and upload the submission:
157
+
158
+ ```bash
159
+ grz-cli submit --submission-dir EXAMPLE_SUBMISSION
167
160
  ```
168
161
 
169
162
  ### Troubleshooting
170
- **In case of issues, please re-run your commands with `grz-cli --log-level DEBUG --log-file <your-log-file.log> [...]` and submit the log file to the GRZ data steward!**
163
+
164
+ In case of issues, please re-run your commands with `grz-cli --log-level DEBUG --log-file path/to/write/file.log [...]` and submit the log file to the GDC data steward.
171
165
 
172
166
  ## Command-Line Interface
173
167
 
174
168
  `grz-cli` provides a command-line interface with the following subcommands:
175
169
 
170
+ ### submit
171
+
172
+ The `submit` command is the recommended command for submitting data to genome data centers.
173
+ It combines the `validate`, `encrypt`, and `upload` commands (see below).
174
+
175
+ - `-s, --submission-dir`: Path to the submission directory containing both 'metadata/' and 'files/' directories [**Required**]
176
+ - `-c, --config-file`: Path to config file [_optional_]
177
+
178
+ ```bash
179
+ grz-cli submit --submission-dir foo
180
+ ```
181
+
182
+
176
183
  ### validate
177
184
 
178
185
  It is recommended to run this command before continuing with encryption and upload.
179
- Progress files are stored relative to the submission directory.
180
186
 
181
187
  - `--submission-dir`: Path to the submission directory containing both 'metadata/' and 'files/' directories [**Required**]
182
188
 
@@ -188,7 +194,7 @@ grz_cli validate --submission-dir foo
188
194
 
189
195
  ### encrypt
190
196
 
191
- If a working directory is not provided, then the current directory is used automatically. The log-files are going to be stored in the sub-folder of the working directory.
197
+ If a working directory is not provided, then the current directory is used automatically.
192
198
  Files are stored in a folder named `encrypted_files` as a sub-folder of the working directory.
193
199
 
194
200
  - `-s, --submission-dir`: Path to the submission directory containing both 'metadata/' and 'files/' directories [**Required**]
@@ -202,7 +208,7 @@ grz-cli encrypt --submission-dir foo
202
208
 
203
209
  Upload the submission into a S3 structure of a GRZ.
204
210
 
205
- - `-s, --submission-dir`: Path to the submission directory containing both 'metadata/' and 'encrypted_files/' directories [**Required**]
211
+ - `-s, --submission-dir`: Path to the submission directory containing both `metadata/` and `encrypted_files/` directories [**Required**]
206
212
  - `-c, --config-file`: Path to config file [_optional_]
207
213
 
208
214
  Example usage:
@@ -211,12 +217,19 @@ Example usage:
211
217
  grz-cli upload --submission-dir foo
212
218
  ```
213
219
 
214
- ## Testing
220
+ ### get-id
215
221
 
216
- Please note that binary files used for testing are managed with [Git LFS](https://git-lfs.com), which will be needed to clone them locally with the git repository.
222
+ *Available in grz-cli v1.2.0 or higher.*
217
223
 
218
- To run the tests, navigate to the root directory of your project and invoke `pytest`.
219
- Alternatively, install `uv` and `tox` and run `uv run tox`.
224
+ Compute and print the submission ID from a submission's JSON metadata.
225
+
226
+ This is useful in case you forget to store the ID printed during upload.
227
+
228
+ Example usage:
229
+
230
+ ```bash
231
+ grz-cli get-id path/to/metadata.json
232
+ ```
220
233
 
221
234
  ## Contributing
222
235
 
@@ -231,11 +244,17 @@ After cloning the desired branch of the `grz-tools` repo locally, you can run `g
231
244
  uv run --project path/to/cloned/grz-tools grz-cli --help
232
245
  ```
233
246
 
247
+ ### Testing
248
+
249
+ Please note that binary files used for testing are managed with [Git LFS](https://git-lfs.com), which will be needed to clone them locally with the git repository.
250
+
251
+ To run the tests, navigate to the root directory of your project and invoke `pytest`.
252
+ Alternatively, install `uv` and `tox` and run `uv run tox`.
253
+
234
254
  ## License
235
255
 
236
256
  This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
237
257
 
238
258
  ## Acknowledgements
239
259
 
240
- Parts of `crypt4gh` code is used in modified form
241
-
260
+ Parts of [Crypt4GH](https://github.com/EGA-archive/crypt4gh) are used in modified form.
@@ -1,90 +1,58 @@
1
- # GRZ CLI
1
+ # `grz-cli`
2
+
3
+ A command-line tool for validating, encrypting, and uploading submissions to a genomDE Model Project GDC (Genome Data Center).
2
4
 
3
- A command-line tool for validating, encrypting, uploading and downloading submissions to/from a GDC/GRZ (Genomrechenzentrum).
4
5
 
5
6
  ## Table of Contents
6
7
 
7
- - [Introduction](#introduction)
8
- - [Features](#features)
9
8
  - [Installation](#installation)
10
9
  - [Requirements](#requirements)
11
- - [End-user setup](#end-user-setup)
12
- - [Installation via `conda` (recommended)](#installation-via-conda-recommended)
13
- - [Installation via `pip` (not recommended)](#installation-via-pip-not-recommended)
10
+ - [Using Conda (recommended)](#using-conda-recommended)
11
+ - [Using Docker](#using-docker)
14
12
  - [Usage](#usage)
15
13
  - [Configuration](#configuration)
16
- - [Exemplary submission procedure](#exemplary-submission-procedure)
14
+ - [Submission Layout](#submission-layout)
15
+ - [Example submission procedure](#example-submission-procedure)
16
+ - [Troubleshooting](#troubleshooting)
17
17
  - [Command-Line Interface](#command-line-interface)
18
- - [Testing](#testing)
19
18
  - [Contributing](#contributing)
20
19
  - [License](#license)
21
20
  - [Acknowledgements](#acknowledgements)
22
21
 
23
- ## Introduction
24
-
25
- This tool provides a way to validate files, encrypt/decrypt files using the [crypt4gh](https://crypt4gh.readthedocs.io/en/latest/) library and upload/download the encrypted files to an S3 bucket of a GDC/GRZ. It also logs the progress and outcomes of these operations in a metadata file.
26
22
 
27
- It is recommended to have the following folder structure for a single submission:
28
-
29
- ```
30
- EXAMPLE_SUBMISSION
31
- ├── files
32
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read1.fastq.gz
33
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read2.fastq.gz
34
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.vcf
35
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read1.fastq.gz
36
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read2.fastq.gz
37
- │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.vcf
38
- │ ├── target_regions.bed
39
- └── metadata
40
- └── metadata.json
41
- ```
42
-
43
- The current version of the tool requires the `working_dir` to have at least as much free disk space as the total size of the data being submitted.
44
- ## Features
23
+ ## Installation
45
24
 
46
- - **Validation**: Validate file checksums, basic file metadata and BfArM requirements.
47
- - **Encryption**: Encrypt files using `crypt4gh`.
48
- - **Decryption**: Encrypt files using `crypt4gh`.
49
- - **Upload**: Upload encrypted files directly to a GRZ either (via built-in `boto3`).
50
- - **Download**: Download encrypted files from a GRZ (via built-in `boto3`).
51
- - **Logging**: Log progress and results of operations
25
+ ### Requirements
52
26
 
27
+ The current version of the tool requires the working directory to have at least as much free disk space as the total size of the data being submitted.
53
28
 
54
- ## Installation
29
+ Beside of the disk space requirements for the submission data, this tool also requires a Linux environment.
30
+ For example:
55
31
 
56
- ### Requirements
57
- Beside of the disk space requirements for the submission data, this tool also requires a linux environment, e.g.:
58
32
  - Linux server
59
- - Virtual machine running linux
33
+ - Virtual machine running Linux
60
34
  - Docker container
61
- - Windows subsystem for linux
62
- - ...
63
-
35
+ - Windows Subsystem for Linux
64
36
 
65
- ### End-user setup
66
- The recommended method to install this tool is using the conda package manager.
67
37
 
38
+ ### Using [Conda](https://conda.io) (recommended)
68
39
 
69
- #### Installation via `conda` (recommended)
40
+ If Conda is not yet available on your system, we recommend to install it through the [Miniforge Conda installer](https://github.com/conda-forge/miniforge) by running the following commands:
70
41
 
71
- If `conda` is not yet available on your system, we recommend to install the [Miniforge conda distribution](https://github.com/conda-forge/miniforge) by running the following commands:
72
42
  ```bash
73
43
  curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
74
44
  bash Miniforge3-$(uname)-$(uname -m).sh
75
45
  ```
76
- There are also alternative ways to install conda:
77
- - [Micromamba, a single executable that does not require a base environment](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html)
78
- - [Official installation instructions](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html)
79
46
 
80
47
  Next, install the `grz-cli` tool:
48
+
81
49
  ```bash
82
- # create conda environment and activate it
83
- conda create -n grz-tools -c conda-forge -c bioconda "grz-cli"
50
+ conda create -n grz-tools -c conda-forge -c bioconda grz-cli
84
51
  conda activate grz-tools
52
+ grz-cli --help
85
53
  ```
86
54
 
87
- ##### Update instructions
55
+ #### Updating
88
56
 
89
57
  Use the following command to update the tool:
90
58
 
@@ -93,59 +61,97 @@ conda update -n grz-tools -c conda-forge -c bioconda grz-cli
93
61
  ```
94
62
 
95
63
 
96
- #### Installation via `pip` (not recommended)
97
- While installation via `pip` is possible, it is not recommended because users must ensure
98
- that the correct Python version is already installed and that they are using a virtual python environment.
64
+ ### Using pip (not recommended)
65
+
66
+ While installation via `pip` is possible, it is not recommended because users should create/manage a Python virtual environment and must ensure that the correct Python version is being used.
99
67
 
100
68
  ```bash
101
69
  pip install grz-cli
102
70
  ```
103
- ##### Update instructions:
71
+
72
+ #### Updating
73
+
104
74
  Use the following command to update the tool:
75
+
105
76
  ```bash
106
77
  pip upgrade grz-cli
107
78
  ```
108
79
 
109
80
 
110
- #### Docker
81
+ ### Using Docker
82
+
111
83
  Docker images are available via biocontainers at [https://biocontainers.pro/tools/grz-cli](https://biocontainers.pro/tools/grz-cli).
112
84
 
113
- The build process can take at least a few days after the Bioconda release, so double-check that the latest version in Bioconda is also the latest Docker image version.
85
+ The build process can take at least a few days after the Bioconda release, so double-check that the [latest version in Bioconda](https://anaconda.org/bioconda/grz-cli) is also the latest Docker image version.
114
86
 
115
87
  ## Usage
116
88
 
117
89
  ### Configuration
118
- **The configuration file will be provided by your associated GRZ, please place it into `~/.config/grz-cli/config.yaml`.**
119
90
 
120
- The tool requires a configuration file in YAML format to specify the S3 bucket and other options.
121
- For an exemplary configuration, see [resources/config.yaml](resources/config.yaml).
91
+ **The configuration file will be provided by your associated GRZ.**
92
+ **Do not create this file as an LE.**
93
+
94
+ The tool requires a configuration file in YAML format to specify the S3 API parameters and other validation options.
122
95
 
123
- S3 access and secret key can be listed either in the config file or as environment variable (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`).
96
+ This file may be placed at `~/.config/grz-cli/config.yaml` or provided each time to `grz-cli` using the `--config-file` option on the command line.
124
97
 
125
- ### Exemplary submission procedure
126
- After preparing your submission as outlined above, you can use the following commands to validate, encrypt and upload the submission:
127
- ```sh
128
- # Validate the submission
129
- grz-cli validate --submission-dir EXAMPLE_SUBMISSION
98
+ The S3 secrets can either be directly within the config file or as defined with the usual AWS environment variables: `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
130
99
 
131
- # Encrypt the submission
132
- grz-cli encrypt --submission-dir EXAMPLE_SUBMISSION
100
+ ### Submission Layout
101
+
102
+ It is recommended to have the following folder structure for a single submission:
133
103
 
134
- # Upload the submission
135
- grz-cli upload --submission-dir EXAMPLE_SUBMISSION
104
+ ```
105
+ EXAMPLE_SUBMISSION
106
+ ├── files
107
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read1.fastq.gz
108
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.read2.fastq.gz
109
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_normal.vcf
110
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read1.fastq.gz
111
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.read2.fastq.gz
112
+ │ ├── aaaaaaaa00000000aaaaaaaa00000000_blood_tumor.vcf
113
+ │ └─── target_regions.bed
114
+ └── metadata
115
+ └── metadata.json
116
+ ```
117
+
118
+ The only requirements are that `metadata/metadata.json` exists and the `files/` directory contains all of the other files.
119
+ Data files may be nested under subfolders inside `files/` for better organization.
120
+ For example, each donor could have their own folder for files.
121
+
122
+
123
+ ### Example submission procedure
124
+
125
+ After preparing your submission as outlined above, you can use the following command to validate, encrypt and upload the submission:
126
+
127
+ ```bash
128
+ grz-cli submit --submission-dir EXAMPLE_SUBMISSION
136
129
  ```
137
130
 
138
131
  ### Troubleshooting
139
- **In case of issues, please re-run your commands with `grz-cli --log-level DEBUG --log-file <your-log-file.log> [...]` and submit the log file to the GRZ data steward!**
132
+
133
+ In case of issues, please re-run your commands with `grz-cli --log-level DEBUG --log-file path/to/write/file.log [...]` and submit the log file to the GDC data steward.
140
134
 
141
135
  ## Command-Line Interface
142
136
 
143
137
  `grz-cli` provides a command-line interface with the following subcommands:
144
138
 
139
+ ### submit
140
+
141
+ The `submit` command is the recommended command for submitting data to genome data centers.
142
+ It combines the `validate`, `encrypt`, and `upload` commands (see below).
143
+
144
+ - `-s, --submission-dir`: Path to the submission directory containing both 'metadata/' and 'files/' directories [**Required**]
145
+ - `-c, --config-file`: Path to config file [_optional_]
146
+
147
+ ```bash
148
+ grz-cli submit --submission-dir foo
149
+ ```
150
+
151
+
145
152
  ### validate
146
153
 
147
154
  It is recommended to run this command before continuing with encryption and upload.
148
- Progress files are stored relative to the submission directory.
149
155
 
150
156
  - `--submission-dir`: Path to the submission directory containing both 'metadata/' and 'files/' directories [**Required**]
151
157
 
@@ -157,7 +163,7 @@ grz_cli validate --submission-dir foo
157
163
 
158
164
  ### encrypt
159
165
 
160
- If a working directory is not provided, then the current directory is used automatically. The log-files are going to be stored in the sub-folder of the working directory.
166
+ If a working directory is not provided, then the current directory is used automatically.
161
167
  Files are stored in a folder named `encrypted_files` as a sub-folder of the working directory.
162
168
 
163
169
  - `-s, --submission-dir`: Path to the submission directory containing both 'metadata/' and 'files/' directories [**Required**]
@@ -171,7 +177,7 @@ grz-cli encrypt --submission-dir foo
171
177
 
172
178
  Upload the submission into a S3 structure of a GRZ.
173
179
 
174
- - `-s, --submission-dir`: Path to the submission directory containing both 'metadata/' and 'encrypted_files/' directories [**Required**]
180
+ - `-s, --submission-dir`: Path to the submission directory containing both `metadata/` and `encrypted_files/` directories [**Required**]
175
181
  - `-c, --config-file`: Path to config file [_optional_]
176
182
 
177
183
  Example usage:
@@ -180,12 +186,19 @@ Example usage:
180
186
  grz-cli upload --submission-dir foo
181
187
  ```
182
188
 
183
- ## Testing
189
+ ### get-id
184
190
 
185
- Please note that binary files used for testing are managed with [Git LFS](https://git-lfs.com), which will be needed to clone them locally with the git repository.
191
+ *Available in grz-cli v1.2.0 or higher.*
186
192
 
187
- To run the tests, navigate to the root directory of your project and invoke `pytest`.
188
- Alternatively, install `uv` and `tox` and run `uv run tox`.
193
+ Compute and print the submission ID from a submission's JSON metadata.
194
+
195
+ This is useful in case you forget to store the ID printed during upload.
196
+
197
+ Example usage:
198
+
199
+ ```bash
200
+ grz-cli get-id path/to/metadata.json
201
+ ```
189
202
 
190
203
  ## Contributing
191
204
 
@@ -200,11 +213,17 @@ After cloning the desired branch of the `grz-tools` repo locally, you can run `g
200
213
  uv run --project path/to/cloned/grz-tools grz-cli --help
201
214
  ```
202
215
 
216
+ ### Testing
217
+
218
+ Please note that binary files used for testing are managed with [Git LFS](https://git-lfs.com), which will be needed to clone them locally with the git repository.
219
+
220
+ To run the tests, navigate to the root directory of your project and invoke `pytest`.
221
+ Alternatively, install `uv` and `tox` and run `uv run tox`.
222
+
203
223
  ## License
204
224
 
205
225
  This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
206
226
 
207
227
  ## Acknowledgements
208
228
 
209
- Parts of `crypt4gh` code is used in modified form
210
-
229
+ Parts of [Crypt4GH](https://github.com/EGA-archive/crypt4gh) are used in modified form.
@@ -22,11 +22,11 @@ dependencies = [
22
22
  "pydantic >=2.9.2,<2.10",
23
23
  "pydantic-settings >=2.9.0,<2.10",
24
24
  "platformdirs >=4.3.6,<5",
25
- "grz-pydantic-models >=2.1.2,<3",
25
+ "grz-pydantic-models >=2.2.1,<3",
26
26
  "pysam ==0.23.*",
27
27
  "rich ==13.*",
28
28
  "requests >=2.32.3,<3",
29
- "grz-common >=1.2.1,<2",
29
+ "grz-common >=1.3.0,<2",
30
30
  ]
31
31
  classifiers = [
32
32
  "Programming Language :: Python :: 3",
@@ -0,0 +1 @@
1
+ __version__ = "1.2.0"
@@ -4,13 +4,18 @@ CLI module for handling command-line interface operations.
4
4
 
5
5
  import logging
6
6
  import logging.config
7
+ import shutil
8
+ import subprocess
9
+ import sys
7
10
  from importlib.metadata import version
11
+ from textwrap import dedent
8
12
 
9
13
  import click
10
14
  import grz_pydantic_models.submission.metadata
11
15
  from grz_common.logging import setup_cli_logging
12
16
 
13
17
  from .commands.encrypt import encrypt
18
+ from .commands.get_id import get_id
14
19
  from .commands.submit import submit
15
20
  from .commands.upload import upload
16
21
  from .commands.validate import validate
@@ -40,7 +45,17 @@ def build_cli():
40
45
  @click.version_option(
41
46
  version=version("grz-cli"),
42
47
  prog_name="grz-cli",
43
- message=f"%(prog)s v%(version)s (currently accepted metadata schema versions: {', '.join(grz_pydantic_models.submission.metadata.get_accepted_versions())})",
48
+ message=dedent(f"""\
49
+ %(prog)s v%(version)s
50
+ Currently accepted metadata schema versions: {", ".join(grz_pydantic_models.submission.metadata.get_accepted_versions())}
51
+ grz-common v{version("grz-common")}
52
+ grz-pydantic-models v{version("grz-pydantic-models")}
53
+ """)
54
+ + (
55
+ subprocess.run(["grz-check", "--version"], capture_output=True, text=True).stdout.strip() # noqa: S603, S607
56
+ if shutil.which("grz-check") is not None
57
+ else ""
58
+ ),
44
59
  )
45
60
  @click.option("--log-file", metavar="FILE", type=str, help="Path to log file")
46
61
  @click.option(
@@ -59,10 +74,13 @@ def build_cli():
59
74
  """
60
75
  setup_cli_logging(log_file, log_level)
61
76
 
77
+ log.info(f"Running command: {' '.join(sys.argv)}")
78
+
62
79
  cli.add_command(validate)
63
80
  cli.add_command(encrypt)
64
81
  cli.add_command(upload)
65
82
  cli.add_command(submit)
83
+ cli.add_command(get_id)
66
84
 
67
85
  return cli
68
86
 
@@ -0,0 +1,18 @@
1
+ """Command for computing the submission ID from the submission metadata."""
2
+
3
+ import io
4
+ import logging
5
+
6
+ import click
7
+ from grz_pydantic_models.submission.metadata import GrzSubmissionMetadata
8
+
9
+ log = logging.getLogger(__name__)
10
+
11
+
12
+ @click.command("get-id")
13
+ @click.argument("metadata", type=click.File("r"))
14
+ def get_id(metadata: io.TextIOWrapper):
15
+ """
16
+ Compute the submission ID for a given metadata JSON file.
17
+ """
18
+ click.echo(GrzSubmissionMetadata.model_validate_json(metadata.read()).submission_id)
@@ -39,6 +39,8 @@ def upload(
39
39
  threads=threads,
40
40
  )
41
41
  # output the generated submission ID
42
- click.echo(worker_inst.upload(config.s3))
42
+ submission_id = worker_inst.upload(config.s3)
43
+ log.info(f"Generated submission ID for upload: {submission_id}")
44
+ click.echo(submission_id)
43
45
 
44
46
  log.info("Upload finished!")
@@ -1 +0,0 @@
1
- __version__ = "1.1.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes