Skip to content

Commit

Permalink
Merge pull request #7 from DOED-DAAD/dev
Browse files Browse the repository at this point in the history
updated cli parser options
  • Loading branch information
mattheww95 authored Oct 22, 2024
2 parents 9e60e20 + 768ef39 commit 2b3f7c4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,60 @@ hatch run +py=3.10 test:mikrokondo-tools

The above command will display command groups with help messages, and each sub command has additional help options.

Console installation has not been tested.
```console
pip install mikrokondo-tools
```

## Usage

Running `mikrokondo-tools` generates the following help message with available options for usage:

```
Usage: mikrokondo-tools [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
-h, --help Show this message and exit.
Commands:
download Download a database for mikrokondo
samplesheet Generate a sample sheet for mikrokondo.
```

The `download` option generates the following output:

```
Usage: mikrokondo-tools download [OPTIONS]
Download a external file for use in mikrokondo. This script only downloads
the file and will not untar or unzip them.
Options:
-f, --file [gtdb-sketch|gtdb-shigella|dehost|kraken-std|bakta-light|bakta-full]
Pick an option from the list to download
[required]
-o, --output PATH An existing directory to download files to.
[default: your/current/directory]
-h, --help Show this message and exit.
```


The `samplesheet` option produces the following output:

```
Usage: mikrokondo-tools samplesheet [OPTIONS] SAMPLE_DIRECTORY
Options:
-o, --output-sheet PATH The file to write your created output sheet to,
this directory must already exist. [required]
-1, --read-1-suffix TEXT A suffix to identify read 1 [default: _R1_]
-2, --read-2-suffix TEXT A suffix to identify read 2 [default: _R2_]
-s, --schema-input PATH An optional schema_input.json file pre-downloaded
for mikrokondo.
-h, --help Show this message and exit.
```


## License

Copyright Government of Canada 2023
Expand Down
5 changes: 3 additions & 2 deletions src/mikrokondo_tools/cli/download/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
from mikrokondo_tools.download import download as dwnld

options = {"gtdb-sketch": dwnld.Constants.sketch_url,
"gtdb-shigella": dwnld.Constants.shigella_sketch,
"dehost": dwnld.Constants.dehost_idx,
"kraken-std": dwnld.Constants.kraken2_std,
"bakta-light": dwnld.Constants.bakta_light,
"bakta-full": dwnld.Constants.bakta_full}

@click.command(short_help="Download a database for mikrokondo", no_args_is_help=True)
@click.command(short_help="Download a database for mikrokondo", no_args_is_help=True, context_settings={'show_default': True})
@click.option("-f", "--file", "file", type=click.Choice(options.keys()), required = True,
help="Pick an option from the list to download")
@click.option("-o", "--output", "output", default=os.getcwd(), type=click.Path(), help="An existing directory to download files too.")
@click.option("-o", "--output", "output", default=os.getcwd(), type=click.Path(), help="An existing directory to download files to.")
def download(file, output):
"""Download a external file for use in mikrokondo. This script only downloads the file and will not untar or unzip them.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/mikrokondo_tools/cli/samplesheet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from mikrokondo_tools.samplesheet import samplesheet as ss
import mikrokondo_tools.utils as u

@click.command(short_help="Generate a sample sheet for mikrokondo.", no_args_is_help=True)
@click.command(short_help="Generate a sample sheet for mikrokondo.", no_args_is_help=True, context_settings={'show_default': True})
@click.option("-o", "--output-sheet", "output_sheet", required=True, type=click.Path(), help="The file to write your created output sheet to, this directory must already exist.")
@click.option("-1", "--read-1-suffix", "read_1", type=click.STRING, help="A suffix to identify read 1", default="_R1_")
@click.option("-2", "--read-2-suffix", "read_2", type=click.STRING, help="A suffix to identify read 2", default="_R2_")
Expand Down
1 change: 1 addition & 0 deletions src/mikrokondo_tools/download/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@dataclass(frozen=True)
class Constants:
sketch_url: str = "https://zenodo.org/records/8408361/files/GTDBSketch_20231003.msh"
shigella_sketch: str = "https://zenodo.org/records/13969103/files/EnteroRef_GTDBSketch_20231003_V2.msh"
dehost_idx: str = "https://zenodo.org/records/8408557/files/PhiPacHum_m2.idx"
kraken2_std: str = "https://genome-idx.s3.amazonaws.com/kraken/k2_standard_20240112.tar.gz"
bakta_light: str = "https://zenodo.org/records/10522951/files/db-light.tar.gz"
Expand Down
2 changes: 2 additions & 0 deletions tests/download/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def test_constants_connection(uri):
@pytest.mark.parametrize( "input_url,value",
[("https://zenodo.org/records/8408361/files/GTDBSketch_20231003.msh",
"GTDBSketch_20231003.msh"),
("https://zenodo.org/records/13969103/files/EnteroRef_GTDBSketch_20231003_V2.msh",
"EnteroRef_GTDBSketch_20231003_V2.msh"),
("https://zenodo.org/records/8408557/files/PhiPacHum_m2.idx",
"PhiPacHum_m2.idx"),
("https://genome-idx.s3.amazonaws.com/kraken/k2_standard_20240112.tar.gz",
Expand Down

0 comments on commit 2b3f7c4

Please sign in to comment.