Skip to content

Commit b6ad55f

Browse files
authored
fix: bamcoverage without effective genome size (#2941)
Running deeptools bamcoverage without an effective genome size did not work previously. This PR fixes that issue. ### QC <!-- Make sure that you can tick the boxes below. --> * [x] I confirm that: For all wrappers added by this PR, * there is a test case which covers any introduced changes, * `input:` and `output:` file paths in the resulting rule can be changed arbitrarily, * either the wrapper can only use a single core, or the example rule contains a `threads: x` statement with `x` being a reasonable default, * rule names in the test case are in [snake_case](https://en.wikipedia.org/wiki/Snake_case) and somehow tell what the rule is about or match the tools purpose or name (e.g., `map_reads` for a step that maps reads), * all `environment.yaml` specifications follow [the respective best practices](https://stackoverflow.com/a/64594513/2352071), * the `environment.yaml` pinning has been updated by running `snakedeploy pin-conda-envs environment.yaml` on a linux machine, * wherever possible, command line arguments are inferred and set automatically (e.g. based on file extensions in `input:` or `output:`), * all fields of the example rules in the `Snakefile`s and their entries are explained via comments (`input:`/`output:`/`params:` etc.), * `stderr` and/or `stdout` are logged correctly (`log:`), depending on the wrapped tool, * temporary files are either written to a unique hidden folder in the working directory, or (better) stored where the Python function `tempfile.gettempdir()` points to (see [here](https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir); this also means that using any Python `tempfile` default behavior works), * the `meta.yaml` contains a link to the documentation of the respective tool or command, * `Snakefile`s pass the linting (`snakemake --lint`), * `Snakefile`s are formatted with [snakefmt](https://github.com/snakemake/snakefmt), * Python wrapper scripts are formatted with [black](https://black.readthedocs.io). * Conda environments use a minimal amount of channels, in recommended ordering. E.g. for bioconda, use (conda-forge, bioconda, nodefaults, as conda-forge should have highest priority and defaults channels are usually not needed because most packages are in conda-forge nowadays).
1 parent 8f4d223 commit b6ad55f

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

bio/deeptools/bamcoverage/test/Snakefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ rule test_deeptools_bamcoverage_default_eff_len:
2828
"logs/coverage_efault_eff_len.log",
2929
wrapper:
3030
"master/bio/deeptools/bamcoverage"
31+
32+
33+
rule test_deeptools_bamcoverage_no_params:
34+
input:
35+
bam="a.sorted.bam",
36+
bai="a.sorted.bam.bai",
37+
output:
38+
"a.coverage_no_params.bw",
39+
log:
40+
"logs/coverage.log",
41+
wrapper:
42+
"master/bio/deeptools/bamcoverage"

bio/deeptools/bamcoverage/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
},
101101
}
102102

103-
effective_genome_size = snakemake.params.get("effective_genome_size")
103+
effective_genome_size = snakemake.params.get("effective_genome_size", "")
104104
if not effective_genome_size:
105105
genome = snakemake.params.get("genome")
106106
read_length = snakemake.params.get("read_length")

test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,6 +2870,21 @@ def test_deeptools_bamcoverage_eff():
28702870
)
28712871

28722872

2873+
@skip_if_not_modified
2874+
def test_deeptools_bamcoverage_no_params():
2875+
run(
2876+
"bio/deeptools/bamcoverage",
2877+
[
2878+
"snakemake",
2879+
"--cores",
2880+
"1",
2881+
"a.coverage_no_params.bw",
2882+
"--use-conda",
2883+
"-F",
2884+
],
2885+
)
2886+
2887+
28732888
@skip_if_not_modified
28742889
def test_deeptools_alignmentsieve():
28752890
run(

0 commit comments

Comments
 (0)