Skip to content

Commit

Permalink
fix: Add tests to Sickle and fixed typo (#1126)
Browse files Browse the repository at this point in the history
<!-- Ensure that the PR title follows conventional commit style (<type>:
<description>)-->
<!-- Possible types are here:
https://github.com/commitizen/conventional-commit-types/blob/master/index.json
-->

### Description

<!-- Add a description of your PR here-->

Fixing issue #1125 

### 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),
* 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).
  • Loading branch information
fgvieira committed Mar 15, 2023
1 parent 7422b0b commit 02518ff
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 14 deletions.
15 changes: 7 additions & 8 deletions bio/sickle/pe/test/Snakefile
@@ -1,17 +1,16 @@
rule sickle_pe:
input:
r1="input_R1.fq",
r2="input_R2.fq"
r1="reads/{sample}.1.fastq",
r2="reads/{sample}.2.fastq"
output:
r1="output_R1.fq",
r2="output_R2.fq",
rs="output_single.fq",
r1="{sample}.1.fastq",
r2="{sample}.2.fastq",
rs="{sample}.single.fastq",
log:
"logs/sickle/{sample}.log"
params:
qual_type="sanger",
# optional extra parameters
extra=""
log:
# optional log file
"logs/sickle/job.log"
wrapper:
"master/bio/sickle/pe"
4 changes: 4 additions & 0 deletions bio/sickle/pe/test/reads/a.1.fastq
@@ -0,0 +1,4 @@
@1
ACGGCAT
+
!!!!!!!
4 changes: 4 additions & 0 deletions bio/sickle/pe/test/reads/a.2.fastq
@@ -0,0 +1,4 @@
@1
ACGGCAT
+
!!!!!!!
12 changes: 6 additions & 6 deletions bio/sickle/se/test/Snakefile
@@ -1,13 +1,13 @@
rule sickle_pe:
rule sickle_se:
input:
"input_R1.fq"
"reads/{sample}.1.fastq"
output:
"output_R1.fq"
"{sample}.1.fastq"
log:
"logs/sickle/{sample}.log"
params:
qual_type="sanger",
# optional extra parameters
extra=""
log:
"logs/sickle/job.log"
wrapper:
"master/bio/sickle/pe"
"master/bio/sickle/se"
4 changes: 4 additions & 0 deletions bio/sickle/se/test/reads/a.1.fastq
@@ -0,0 +1,4 @@
@1
ACGGCAT
+
!!!!!!!
29 changes: 29 additions & 0 deletions test.py
Expand Up @@ -139,6 +139,35 @@ def run(wrapper, cmd, check_log=None):
os.chdir(origdir)



@skip_if_not_modified
def test_sickle_pe():
run(
"bio/sickle/pe",
[
"snakemake",
"--cores",
"1",
"--use-conda",
"a.1.fastq",
"a.2.fastq",
"a.single.fastq",
],
)

@skip_if_not_modified
def test_sickle_se():
run(
"bio/sickle/se",
[
"snakemake",
"--cores",
"1",
"--use-conda",
"a.1.fastq",
],
)

@skip_if_not_modified
def test_bwa_memx_index():
run(
Expand Down

0 comments on commit 02518ff

Please sign in to comment.