From ceaf2c72b7ccb3eeba3cf0da895d5c031f6c5fdd Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 28 May 2025 11:38:20 -0400 Subject: [PATCH 1/6] docs: improve CLI help & set mode=slurm as default --- CHANGELOG.md | 3 +++ src/__main__.py | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99f82e2..4efc396 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## LOGAN development version +- Improve help message for `logan run`. (#??, @kelly-sovacool) + - the default `--mode` is now `slurm`. + # LOGAN 0.3.0 - LOGAN now depends on ccbr_tools v0.4 for updated jobby & spooker utilities. (#95, @kelly-sovacool) diff --git a/src/__main__.py b/src/__main__.py index 1cd478a..ca00096 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -52,18 +52,21 @@ def cli(): help_msg_extra = """ +\b +Nextflow options: +-profile Nextflow profile to use (e.g. test) +-params-file Nextflow params file to use (e.g. assets/params.yml) +-preview Preview the processes that will run without executing them + \b EXAMPLES: Execute with slurm: - logan run ... --mode slurm + logan run --output path/to/outdir --mode slurm Preview the processes that will run: - logan run ... --mode local -preview + logan run --output path/to/outdir --mode local -preview Add nextflow args (anything supported by `nextflow run`): - logan run ... -work-dir path/to/workDir -Run with a specific installation of logan: - logan run --main path/to/logan/main.nf ... -Run with a specific tag, branch, or commit from GitHub: - logan run --main CCBR/LOGAN -r v0.1.0 ... + logan run --output path/to/outdir --mode slurm -profile test + logan run --output path/to/outdir --mode slurm -profile test -params-file assets/params.yml """ @@ -82,6 +85,7 @@ def cli(): type=str, default=repo_base("main.nf"), show_default=True, + hidden=True, ) @click.option( "--output", @@ -95,7 +99,7 @@ def cli(): "_mode", help="Run mode (slurm, local)", type=str, - default="local", + default="slurm", show_default=True, ) @click.option( @@ -109,7 +113,12 @@ def cli(): ) @click.argument("nextflow_args", nargs=-1) def run(main_path, output, _mode, force_all, **kwargs): - """Run the workflow""" + """ + Run the workflow + + Note: you must first run `logan init --output ` to initialize + the output directory. + """ if ( # this is the only acceptable github repo option for logan main_path != "CCBR/LOGAN" ): From abd4922f20c6bfa1e93d5def584758e350ace82f Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 28 May 2025 11:41:02 -0400 Subject: [PATCH 2/6] chore: update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4efc396..f9c00c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## LOGAN development version -- Improve help message for `logan run`. (#??, @kelly-sovacool) +- Improve help message for `logan run`. (#97, @kelly-sovacool) - the default `--mode` is now `slurm`. # LOGAN 0.3.0 From ab8c532653c881d742cdd3980f86207d65fadc14 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 28 May 2025 11:43:11 -0400 Subject: [PATCH 3/6] ci: use mode=local --- .github/workflows/build.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fa37f7..9dae24b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,12 +43,14 @@ jobs: - name: Test stub run for Fastqs run: | logan init - logan run -profile ci_stub \ - --sample_sheet .tests/pairs.tsv \ - --fastq_input ".tests/*R{1,2}_001.fastq.gz" \ - --vc --cnv --sv --gl --qc \ - --split_regions 2 \ - --genome hg38 \ - --outdir output_tn_fqs \ - --intervals .tests/interval.bed \ - -preview + logan run \ + -profile ci_stub \ + --mode local \ + --sample_sheet .tests/pairs.tsv \ + --fastq_input ".tests/*R{1,2}_001.fastq.gz" \ + --vc --cnv --sv --gl --qc \ + --split_regions 2 \ + --genome hg38 \ + --outdir output_tn_fqs \ + --intervals .tests/interval.bed \ + -preview From 7ae00870c521c789cccdd4dce0071e58d30c82a1 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 28 May 2025 11:45:22 -0400 Subject: [PATCH 4/6] ci: remove reference to deprecated code --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dae24b..2ec6975 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,6 @@ jobs: run: | python -m pip install --upgrade pip setuptools pip install .[dev,test] - python -c 'from logan.src.util import chmod_bins_exec; chmod_bins_exec()' - name: Check CLI basics run: | which logan From 5d413eee413c2f56b9c19d26eac37f6b36a9f951 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 28 May 2025 11:50:36 -0400 Subject: [PATCH 5/6] fix: ensure bins are executable --- bin/hello-world.py | 2 +- bin/logan | 2 +- bin/make_freec_exome_paired.pl | 2 +- bin/reformat_bed.py | 2 +- main.py | 16 ++++++++++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) mode change 100644 => 100755 bin/hello-world.py mode change 100644 => 100755 bin/logan mode change 100644 => 100755 bin/make_freec_exome_paired.pl mode change 100644 => 100755 bin/reformat_bed.py create mode 100755 main.py diff --git a/bin/hello-world.py b/bin/hello-world.py old mode 100644 new mode 100755 index a5df617..54280ff --- a/bin/hello-world.py +++ b/bin/hello-world.py @@ -12,4 +12,4 @@ def main(): if __name__ == "__main__": - main(sys.argv) \ No newline at end of file + main(sys.argv) diff --git a/bin/logan b/bin/logan old mode 100644 new mode 100755 index 07b7af3..8cd6cae --- a/bin/logan +++ b/bin/logan @@ -4,4 +4,4 @@ TOOLDIR=$(realpath $(dirname $(dirname ${BASH_SOURCE}))) -${TOOLDIR}/main.py "$@" \ No newline at end of file +${TOOLDIR}/main.py "$@" diff --git a/bin/make_freec_exome_paired.pl b/bin/make_freec_exome_paired.pl old mode 100644 new mode 100755 index eb192a2..3e11fb2 --- a/bin/make_freec_exome_paired.pl +++ b/bin/make_freec_exome_paired.pl @@ -47,4 +47,4 @@ print C "makePileup = $makePileup\n"; print C "fastaFile = $fastaFile\n"; print C "minimalCoveragePerPosition = 10\n"; -print C "SNPfile = $SNPfile"; \ No newline at end of file +print C "SNPfile = $SNPfile"; diff --git a/bin/reformat_bed.py b/bin/reformat_bed.py old mode 100644 new mode 100755 index fc64c5b..69a4320 --- a/bin/reformat_bed.py +++ b/bin/reformat_bed.py @@ -82,4 +82,4 @@ # freec_bed.write(freec_bed_output) ### Update loop variables - last_start = curr_cols[1] \ No newline at end of file + last_start = curr_cols[1] diff --git a/main.py b/main.py new file mode 100755 index 0000000..dd67ba5 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +import os +import re +import sys + +# add script directory to the path to allow logan CLI to work out-of-the-box +# without the need to install it via pip first +SCRIPT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "src") +sys.path.append(SCRIPT_DIR) +from src.__main__ import main + +if ( + __name__ == "__main__" +): # this block is adapted from the executable file created by `pip install` + sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0]) + sys.exit(main()) From aae12be93a8ea68c7905f95523313a8b63dbfd37 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 28 May 2025 11:50:56 -0400 Subject: [PATCH 6/6] ci: bump python to 3.11 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ec6975..d85db9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 2 strategy: matrix: - python-version: ["3.10"] + python-version: ["3.11"] steps: - uses: actions/checkout@v3