forked from snakemake/snakemake-wrappers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for regions file and arbitrary FAI/GZI paths (snake…
…make#2936) <!-- 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 --> <!-- Add a description of your PR here--> ### 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). --------- Co-authored-by: Christian Meesters <[email protected]>
- Loading branch information
1 parent
2b45d76
commit 5243881
Showing
8 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
name: samtools faidx | ||
description: index reference sequence in FASTA format from reference sequence. | ||
url: http://www.htslib.org/doc/samtools-faidx.html | ||
authors: | ||
- Michael Chambers | ||
- Filipe G. Vieira | ||
input: | ||
- reference sequence file (.fa) | ||
- regions: file with regions | ||
- fai: index for reference file (optional) | ||
- gzi: index for BGZip'ed reference file (optional) | ||
output: | ||
- indexed reference sequence file (.fai) | ||
notes: | | ||
* The `extra` param allows for additional program arguments (not `-o`). | ||
* For more information see, http://www.htslib.org/doc/samtools-faidx.html | ||
- fai: index for reference file (optional) | ||
- gzi: index for BGZip'ed reference file (optional) | ||
params: | ||
- region: region to extract from input file (optional) | ||
- extra: additional program arguments (not `-o`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,69 @@ | ||
rule samtools_index: | ||
rule samtools_faidx: | ||
input: | ||
"{sample}.fa", | ||
output: | ||
"{sample}.fa.fai", | ||
"out/{sample}.fa.fai", | ||
log: | ||
"{sample}.log", | ||
params: | ||
extra="", # optional params string | ||
extra="", | ||
wrapper: | ||
"master/bio/samtools/faidx" | ||
|
||
|
||
rule samtools_faidx_named: | ||
input: | ||
"{sample}.fa", | ||
output: | ||
fai="out/{sample}.named.fa.fai", | ||
log: | ||
"{sample}.named.log", | ||
params: | ||
extra="", | ||
wrapper: | ||
"master/bio/samtools/faidx" | ||
|
||
|
||
rule samtools_faidx_bgzip: | ||
input: | ||
"{sample}.fa.bgz", | ||
output: | ||
fai="out/{sample}.fas.bgz.fai", | ||
gzi="out/{sample}.fas.bgz.gzi", | ||
log: | ||
"{sample}.bzgip.log", | ||
params: | ||
extra="", | ||
wrapper: | ||
"master/bio/samtools/faidx" | ||
|
||
|
||
rule samtools_faidx_region: | ||
input: | ||
"{sample}.fa", | ||
fai="idx/{sample}.fa.fai", | ||
output: | ||
"out/{sample}.fas", | ||
log: | ||
"{sample}.region.log", | ||
params: | ||
region="ref", | ||
extra="--length 5", | ||
wrapper: | ||
"master/bio/samtools/faidx" | ||
|
||
|
||
rule samtools_faidx_bgzip_region: | ||
input: | ||
"{sample}.fa.bgz", | ||
fai="idx/{sample}.fa.bgz.fai", | ||
gzi="idx/{sample}.fa.bgz.gzi", | ||
output: | ||
"out/{sample}.bgz.fas", | ||
log: | ||
"{sample}.bgzip_region.log", | ||
params: | ||
region="ref", | ||
extra="--length 5", | ||
wrapper: | ||
"master/bio/samtools/faidx" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ref 45 5 45 46 | ||
ref2 40 57 40 41 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ref 45 5 45 46 | ||
ref2 40 57 40 41 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters