Skip to content

Commit 04a0930

Browse files
committed
fix version output
1 parent fb2b9f0 commit 04a0930

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11

22
# Changelog
33

4+
## v0.2.2 rpetit3/camlhmp "Even a few baby birds" 2024/07/22
5+
6+
### `Fixed`
7+
8+
- `--version` flag now works as expected
9+
410
## v0.2.1 rpetit3/camlhmp "And a bunch of birds" 2024/07/22
511

612
### `Added`

camlhmp/cli/blast.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,24 @@
5757

5858
@click.command()
5959
@click.option(
60-
"--input", "-i", required=True, help="Input file in FASTA format to classify"
60+
"--input",
61+
"-i",
62+
required=False if "--version" in sys.argv else True,
63+
help="Input file in FASTA format to classify",
6164
)
6265
@click.option(
6366
"--yaml",
6467
"-y",
6568
required=True,
66-
default=os.environ.get("CAML_YAML", ""),
69+
default=os.environ.get("CAML_YAML", None),
6770
show_default=True,
6871
help="YAML file documenting the targets and types",
6972
)
7073
@click.option(
7174
"--targets",
7275
"-t",
73-
required=True,
74-
default=os.environ.get("CAML_TARGETS", ""),
76+
required=False if "--version" in sys.argv else True,
77+
default=os.environ.get("CAML_TARGETS", None),
7578
show_default=True,
7679
help="Query targets in FASTA format",
7780
)
@@ -106,7 +109,7 @@
106109
@click.option("--force", is_flag=True, help="Overwrite existing reports")
107110
@click.option("--verbose", is_flag=True, help="Increase the verbosity of output")
108111
@click.option("--silent", is_flag=True, help="Only critical errors will be printed")
109-
@click.option("--version", "-V", is_flag=True, help="Print schema and camlhmp version")
112+
@click.option("--version", is_flag=True, help="Print schema and camlhmp version")
110113
def camlhmp_blast(
111114
input,
112115
yaml,
@@ -133,10 +136,6 @@ def camlhmp_blast(
133136
logging.ERROR if silent else logging.DEBUG if verbose else logging.INFO
134137
)
135138

136-
# Create the output directory
137-
logging.debug(f"Creating output directory: {outdir}")
138-
Path(outdir).mkdir(parents=True, exist_ok=True)
139-
140139
# Verify input files are available
141140
yaml_path = validate_file(yaml)
142141

@@ -152,6 +151,10 @@ def camlhmp_blast(
152151
targets_path = validate_file(targets)
153152
logging.debug(f"Processing {targets}")
154153

154+
# Create the output directory
155+
logging.debug(f"Creating output directory: {outdir}")
156+
Path(outdir).mkdir(parents=True, exist_ok=True)
157+
155158
# Output files
156159
result_tsv = f"{outdir}/{prefix}.tsv".replace("//", "/")
157160
blast_tsv = f"{outdir}/{prefix}.{framework['engine']['tool']}.tsv".replace(

camlhmp/cli/blast_region.py

+13-8
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,24 @@
5757

5858
@click.command()
5959
@click.option(
60-
"--input", "-i", required=True, help="Input file in FASTA format to classify"
60+
"--input",
61+
"-i",
62+
required=False if "--version" in sys.argv else True,
63+
help="Input file in FASTA format to classify"
6164
)
6265
@click.option(
6366
"--yaml",
6467
"-y",
6568
required=True,
66-
default=os.environ.get("CAML_YAML", ""),
69+
default=os.environ.get("CAML_YAML", None),
6770
show_default=True,
6871
help="YAML file documenting the targets and types",
6972
)
7073
@click.option(
7174
"--targets",
7275
"-t",
73-
required=True,
74-
default=os.environ.get("CAML_TARGETS", ""),
76+
required=False if "--version" in sys.argv else True,
77+
default=os.environ.get("CAML_TARGETS", None),
7578
show_default=True,
7679
help="Query targets in FASTA format",
7780
)
@@ -106,7 +109,7 @@
106109
@click.option("--force", is_flag=True, help="Overwrite existing reports")
107110
@click.option("--verbose", is_flag=True, help="Increase the verbosity of output")
108111
@click.option("--silent", is_flag=True, help="Only critical errors will be printed")
109-
@click.option("--version", "-V", is_flag=True, help="Print schema and camlhmp version")
112+
@click.option("--version", is_flag=True, help="Print schema and camlhmp version")
110113
def camlhmp_blast_region(
111114
input,
112115
yaml,
@@ -133,9 +136,7 @@ def camlhmp_blast_region(
133136
logging.ERROR if silent else logging.DEBUG if verbose else logging.INFO
134137
)
135138

136-
# Create the output directory
137-
logging.debug(f"Creating output directory: {outdir}")
138-
Path(outdir).mkdir(parents=True, exist_ok=True)
139+
print(f"yaml {yaml}")
139140

140141
# Verify input files are available
141142
yaml_path = validate_file(yaml)
@@ -152,6 +153,10 @@ def camlhmp_blast_region(
152153
targets_path = validate_file(targets)
153154
logging.debug(f"Processing {targets}")
154155

156+
# Create the output directory
157+
logging.debug(f"Creating output directory: {outdir}")
158+
Path(outdir).mkdir(parents=True, exist_ok=True)
159+
155160
# Output files
156161
result_tsv = f"{outdir}/{prefix}.tsv".replace("//", "/")
157162
blast_tsv = f"{outdir}/{prefix}.{framework['engine']['tool']}.tsv".replace(

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "camlhmp"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "Classification through yAML Heuristic Mapping Protocol"
55
authors = [
66
"Robert A. Petit III <robbie.petit@gmail.com>",

0 commit comments

Comments
 (0)