Skip to content

Commit eea71b2

Browse files
fix: improve CLI help & set mode=slurm as default (#97)
* docs: improve CLI help & set mode=slurm as default * chore: update CHANGELOG.md * ci: use mode=local * ci: remove reference to deprecated code * fix: ensure bins are executable * ci: bump python to 3.11
1 parent 233b79d commit eea71b2

8 files changed

Lines changed: 53 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
timeout-minutes: 2
1818
strategy:
1919
matrix:
20-
python-version: ["3.10"]
20+
python-version: ["3.11"]
2121

2222
steps:
2323
- uses: actions/checkout@v3
@@ -34,7 +34,6 @@ jobs:
3434
run: |
3535
python -m pip install --upgrade pip setuptools
3636
pip install .[dev,test]
37-
python -c 'from logan.src.util import chmod_bins_exec; chmod_bins_exec()'
3837
- name: Check CLI basics
3938
run: |
4039
which logan
@@ -43,12 +42,14 @@ jobs:
4342
- name: Test stub run for Fastqs
4443
run: |
4544
logan init
46-
logan run -profile ci_stub \
47-
--sample_sheet .tests/pairs.tsv \
48-
--fastq_input ".tests/*R{1,2}_001.fastq.gz" \
49-
--vc --cnv --sv --gl --qc \
50-
--split_regions 2 \
51-
--genome hg38 \
52-
--outdir output_tn_fqs \
53-
--intervals .tests/interval.bed \
54-
-preview
45+
logan run \
46+
-profile ci_stub \
47+
--mode local \
48+
--sample_sheet .tests/pairs.tsv \
49+
--fastq_input ".tests/*R{1,2}_001.fastq.gz" \
50+
--vc --cnv --sv --gl --qc \
51+
--split_regions 2 \
52+
--genome hg38 \
53+
--outdir output_tn_fqs \
54+
--intervals .tests/interval.bed \
55+
-preview

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## LOGAN development version
22

3+
- Improve help message for `logan run`. (#97, @kelly-sovacool)
4+
- the default `--mode` is now `slurm`.
5+
36
# LOGAN 0.3.0
47

58
- LOGAN now depends on ccbr_tools v0.4 for updated jobby & spooker utilities. (#95, @kelly-sovacool)

bin/hello-world.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ def main():
1212

1313

1414
if __name__ == "__main__":
15-
main(sys.argv)
15+
main(sys.argv)

bin/logan

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
TOOLDIR=$(realpath $(dirname $(dirname ${BASH_SOURCE})))
66

7-
${TOOLDIR}/main.py "$@"
7+
${TOOLDIR}/main.py "$@"

bin/make_freec_exome_paired.pl

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
print C "makePileup = $makePileup\n";
4848
print C "fastaFile = $fastaFile\n";
4949
print C "minimalCoveragePerPosition = 10\n";
50-
print C "SNPfile = $SNPfile";
50+
print C "SNPfile = $SNPfile";

bin/reformat_bed.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@
8282
# freec_bed.write(freec_bed_output)
8383

8484
### Update loop variables
85-
last_start = curr_cols[1]
85+
last_start = curr_cols[1]

main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python
2+
import os
3+
import re
4+
import sys
5+
6+
# add script directory to the path to allow logan CLI to work out-of-the-box
7+
# without the need to install it via pip first
8+
SCRIPT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")
9+
sys.path.append(SCRIPT_DIR)
10+
from src.__main__ import main
11+
12+
if (
13+
__name__ == "__main__"
14+
): # this block is adapted from the executable file created by `pip install`
15+
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
16+
sys.exit(main())

src/__main__.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,21 @@ def cli():
5252

5353

5454
help_msg_extra = """
55+
\b
56+
Nextflow options:
57+
-profile <profile> Nextflow profile to use (e.g. test)
58+
-params-file <file> Nextflow params file to use (e.g. assets/params.yml)
59+
-preview Preview the processes that will run without executing them
60+
5561
\b
5662
EXAMPLES:
5763
Execute with slurm:
58-
logan run ... --mode slurm
64+
logan run --output path/to/outdir --mode slurm
5965
Preview the processes that will run:
60-
logan run ... --mode local -preview
66+
logan run --output path/to/outdir --mode local -preview
6167
Add nextflow args (anything supported by `nextflow run`):
62-
logan run ... -work-dir path/to/workDir
63-
Run with a specific installation of logan:
64-
logan run --main path/to/logan/main.nf ...
65-
Run with a specific tag, branch, or commit from GitHub:
66-
logan run --main CCBR/LOGAN -r v0.1.0 ...
68+
logan run --output path/to/outdir --mode slurm -profile test
69+
logan run --output path/to/outdir --mode slurm -profile test -params-file assets/params.yml
6770
"""
6871

6972

@@ -82,6 +85,7 @@ def cli():
8285
type=str,
8386
default=repo_base("main.nf"),
8487
show_default=True,
88+
hidden=True,
8589
)
8690
@click.option(
8791
"--output",
@@ -95,7 +99,7 @@ def cli():
9599
"_mode",
96100
help="Run mode (slurm, local)",
97101
type=str,
98-
default="local",
102+
default="slurm",
99103
show_default=True,
100104
)
101105
@click.option(
@@ -109,7 +113,12 @@ def cli():
109113
)
110114
@click.argument("nextflow_args", nargs=-1)
111115
def run(main_path, output, _mode, force_all, **kwargs):
112-
"""Run the workflow"""
116+
"""
117+
Run the workflow
118+
119+
Note: you must first run `logan init --output <output_dir>` to initialize
120+
the output directory.
121+
"""
113122
if ( # this is the only acceptable github repo option for logan
114123
main_path != "CCBR/LOGAN"
115124
):

0 commit comments

Comments
 (0)