Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: move pindel region bed files to input #594

Merged
merged 7 commits into from Oct 13, 2022

Conversation

maehler
Copy link
Contributor

@maehler maehler commented Oct 13, 2022

Description

Recently I discovered that if you pass a non-existent bed file as a value for the command line parameters -j/--include or -J/--exclude in pindel, the program behaves as if empty files are being passed. Since these are supplied in params.extra, no checks are done on them.

I realise that this is not an issue with the wrapper, per se, but the pindel repo has been archived, and I think that modifying the wrapper might be a good way to catch potential mistakes.

Not sure whether my implementation is the best way to handle things, so thoughts and opinions are welcome.

QC

  • 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 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,
  • 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 Snakefiles 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; 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,
  • Snakefiles pass the linting (snakemake --lint),
  • Snakefiles are formatted with snakefmt,
  • Python wrapper scripts are formatted with black.
  • 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).

@fgvieira
Copy link
Collaborator

fgvieira commented Oct 13, 2022

Why not just have the BED file as an input file? This way snakemake will check if the file exists.

And the prefix, if necesary, should be inferred by the wrapper, not specified in the rule's param.prefix.

@maehler
Copy link
Contributor Author

maehler commented Oct 13, 2022

I was thinking to have the bed files as inputs, but that more or less also makes them required, which I kind of wanted to avoid. If I recall correctly, it is possible to set an input to an empty list for it to not fail, and that could then be handled by the wrapper, but that's also kind of ugly. What do you think?

Good point about the prefix. I just followed the existing wrapper blindly. Having the prefix managed by the wrapper would be much cleaner.

@maehler
Copy link
Contributor Author

maehler commented Oct 13, 2022

I was thinking to have the bed files as inputs, but that more or less also makes them required, which I kind of wanted to avoid. If I recall correctly, it is possible to set an input to an empty list for it to not fail, and that could then be handled by the wrapper, but that's also kind of ugly.

Or no, I'm being a square. Whether the argument would be optional or not would be handled by the wrapper. Much cleaner.

@maehler
Copy link
Contributor Author

maehler commented Oct 13, 2022

@fgvieira should I open a new PR, or just modify this one?

@fgvieira
Copy link
Collaborator

Just modify this one...

@maehler maehler marked this pull request as draft October 13, 2022 10:16
@maehler maehler changed the title fix: check existence of pindel region bed files feat: move pindel region bed files to input Oct 13, 2022
@maehler maehler marked this pull request as ready for review October 13, 2022 10:54
@fgvieira
Copy link
Collaborator

It looks great! Just some small cosmetic suggestions. 😄

bio/pindel/call/wrapper.py Outdated Show resolved Hide resolved
bio/pindel/call/wrapper.py Outdated Show resolved Hide resolved
@maehler
Copy link
Contributor Author

maehler commented Oct 13, 2022

It looks great! Just some small cosmetic suggestions. 😄

Great, thanks for the input! This turned out a lot better.

@fgvieira
Copy link
Collaborator

It seems there is a conflict on test.py. Can you take a look at it?

@maehler
Copy link
Contributor Author

maehler commented Oct 13, 2022

Should be good to go now.

@fgvieira fgvieira merged commit 8f52877 into snakemake:master Oct 13, 2022
@maehler maehler deleted the pindel-check-bedfiles branch October 13, 2022 13:35
johanneskoester pushed a commit that referenced this pull request Oct 17, 2022
🤖 I have created a release \*beep\* \*boop\*
---
##
[1.17.0](https://www.github.com/snakemake/snakemake-wrappers/compare/v1.16.0...v1.17.0)
(2022-10-13)


### Features

* move pindel region bed files to input
([#594](https://www.github.com/snakemake/snakemake-wrappers/issues/594))
([8f52877](https://www.github.com/snakemake/snakemake-wrappers/commit/8f52877aeb5d6510e34ebe846a4fbe2d0e9a2458))
---


This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Phlya pushed a commit to Phlya/snakemake-wrappers that referenced this pull request Jan 10, 2023
### Description

Recently I discovered that if you pass a non-existent bed file as a
value for the command line parameters `-j/--include` or `-J/--exclude`
in pindel, the program behaves as if empty files are being passed. Since
these are supplied in `params.extra`, no checks are done on them.

I realise that this is not an issue with the wrapper, per se, but the
pindel repo has been archived, and I think that modifying the wrapper
might be a good way to catch potential mistakes.

Not sure whether my implementation is the best way to handle things, so
thoughts and opinions are welcome.

### QC

* [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).

Co-authored-by: Filipe G. Vieira <fgarrettvieira@gmail.com>
Phlya pushed a commit to Phlya/snakemake-wrappers that referenced this pull request Jan 10, 2023
🤖 I have created a release \*beep\* \*boop\*
---
##
[1.17.0](https://www.github.com/snakemake/snakemake-wrappers/compare/v1.16.0...v1.17.0)
(2022-10-13)


### Features

* move pindel region bed files to input
([snakemake#594](https://www.github.com/snakemake/snakemake-wrappers/issues/594))
([8f52877](https://www.github.com/snakemake/snakemake-wrappers/commit/8f52877aeb5d6510e34ebe846a4fbe2d0e9a2458))
---


This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants