sequana_wrappers 26.3.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sequana_wrappers-26.3.19/LICENSE +29 -0
- sequana_wrappers-26.3.19/PKG-INFO +458 -0
- sequana_wrappers-26.3.19/README.md +441 -0
- sequana_wrappers-26.3.19/pyproject.toml +15 -0
- sequana_wrappers-26.3.19/sequana_wrappers/__init__.py +33 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/README.md +31 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/test/Makefile +5 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/test/Snakefile +14 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/test/test.bam +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bamtools/stats/v1/cmd.py +3 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/README.md +45 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/test/Makefile +5 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/test/Snakefile +37 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/test/reads/a.1.fastq +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/test/reads/a.2.fastq +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/test/reference/genome.fasta +2 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/align/v1/cmd.py +13 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/README.md +43 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/test/Makefile +5 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/test/Snakefile +20 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/test/reference/genome.fasta +2 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bowtie2/build/v1/cmd.py +3 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/README.md +40 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/test/Makefile +5 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/test/Snakefile +42 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/test/index/genome.fasta +2 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/test/reads/a.1.fastq +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/test/reads/a.2.fastq +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/align/v1/cmd.py +7 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/README.md +38 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/test/Makefile +6 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/test/Snakefile +21 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/test/genome.fasta +2 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/bwa/build/v1/cmd.py +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/feature_counts/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/feature_counts/run/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/feature_counts/run/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/feature_counts/run/v1/cmd.py +8 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/README.md +37 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/test/Makefile +5 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/test/Snakefile +20 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/test/genome.fasta +2 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/test/reads/a.1.fastq +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/test/reads/a.2.fastq +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/minimap2/align/v1/cmd.py +4 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/multiqc/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/multiqc/run/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/multiqc/run/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/multiqc/run/v1/cmd.py +13 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/sequana_coverage/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/sequana_coverage/run/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/sequana_coverage/run/v1/__init__.py +0 -0
- sequana_wrappers-26.3.19/sequana_wrappers/shells/sequana_coverage/run/v1/cmd.py +25 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021, sequana
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: sequana_wrappers
|
|
3
|
+
Version: 26.3.19
|
|
4
|
+
Summary: Shell command library and Snakemake wrappers for Sequana pipelines
|
|
5
|
+
License: BSD-3-Clause
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# The Sequana Wrapper Repository
|
|
18
|
+
|
|
19
|
+
[](https://github.com/sequana/sequana-wrappers/actions/workflows/main.yml)
|
|
20
|
+
[](https://github.com/sequana/sequana-wrappers/actions/workflows/shells.yml)
|
|
21
|
+
[](http://joss.theoj.org/papers/10.21105/joss.00352)
|
|
22
|
+
|
|
23
|
+
|||
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| Overview | Shell command library and Snakemake wrappers for Sequana pipelines |
|
|
26
|
+
| Status | Production (`wrappers/` — maintenance only) / Active (`shells/`) |
|
|
27
|
+
| Issues | Please fill a report on [github/sequana/sequana-wrappers](https://github.com/sequana/sequana/issues) |
|
|
28
|
+
| Python version | Python 3.8+ |
|
|
29
|
+
| Citation | Cokelaer et al, (2017), ‘Sequana’: a Set of Snakemake NGS pipelines, Journal of Open Source Software, 2(16), 352, [doi:10.21105/joss.00352](http://www.doi2bib.org/bib/10.21105%2Fjoss.00352) |
|
|
30
|
+
|
|
31
|
+
## Status and roadmap
|
|
32
|
+
|
|
33
|
+
This repository contains two independent mechanisms for providing bioinformatics
|
|
34
|
+
tool commands to Sequana pipelines:
|
|
35
|
+
|
|
36
|
+
- **`wrappers/`** — the original Snakemake wrapper system (Python scripts +
|
|
37
|
+
conda `environment.yaml`). **This tree is now in maintenance mode.**
|
|
38
|
+
No new wrappers will be added. Bug fixes will still be accepted, but all
|
|
39
|
+
new development happens in `shells/`. See [the rationale below](#the-shells-directory--rationale-and-design)
|
|
40
|
+
for the full explanation of why.
|
|
41
|
+
|
|
42
|
+
- **`sequana_wrappers/shells/`** — the new shell command library. Versioned
|
|
43
|
+
shell strings that work with `container:` + `shell:` rules, with no Python
|
|
44
|
+
inside the container. This is the active development track and the
|
|
45
|
+
recommended approach for all new Sequana pipelines.
|
|
46
|
+
|
|
47
|
+
## Quick start — shells (recommended)
|
|
48
|
+
|
|
49
|
+
Install the package:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install sequana_wrappers
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Use in a Snakemake pipeline via `sequana_pipetools`:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
# In your pipeline’s .rules file — manager is a PipelineManager instance
|
|
59
|
+
rule minimap2:
|
|
60
|
+
input: ...
|
|
61
|
+
output: "{sample}/{sample}.sorted.bam"
|
|
62
|
+
container: "https://zenodo.org/record/7987999/files/samtools_1.17_minimap2_2.24.0.img"
|
|
63
|
+
shell: manager.get_shell("minimap2/align", "v1")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Quick start — wrappers (legacy)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
snakemake --wrapper-prefix https://github.com/sequana/sequana-wrappers
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
or with a local copy:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone git@github.com:sequana/sequana-wrappers.git sequana_wrappers
|
|
76
|
+
snakemake --wrapper-prefix git+file:///home/user/sequana_wrappers
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If the environment variable `SEQUANA_WRAPPERS` is set to
|
|
80
|
+
`git+file:///home/user/sequana_wrappers`, all pipelines will automatically use
|
|
81
|
+
it as the `--wrapper-prefix`.
|
|
82
|
+
|
|
83
|
+
# The `shells/` directory — rationale and design
|
|
84
|
+
|
|
85
|
+
## Background
|
|
86
|
+
|
|
87
|
+
Sequana pipelines use two mechanisms to provide bioinformatics tools:
|
|
88
|
+
|
|
89
|
+
- **Wrappers** (`wrappers/`) — Python scripts (`wrapper.py`) plus a conda
|
|
90
|
+
`environment.yaml`. Snakemake fetches and executes them via the `wrapper:`
|
|
91
|
+
rule directive.
|
|
92
|
+
- **Containers** — Apptainer/Singularity images (hosted on Zenodo/Damona)
|
|
93
|
+
referenced by the `container:` rule directive.
|
|
94
|
+
|
|
95
|
+
## The problem: `wrapper:` + `container:` are incompatible
|
|
96
|
+
|
|
97
|
+
When a Snakemake rule combines both `wrapper:` and `container:`, and the
|
|
98
|
+
pipeline is run with `--use-singularity` / `--apptainer-prefix`, Snakemake v7
|
|
99
|
+
executes the wrapper Python script **inside the container** using the
|
|
100
|
+
container's own Python binary.
|
|
101
|
+
|
|
102
|
+
Snakemake does not require Snakemake to be installed inside the container — it
|
|
103
|
+
bind-mounts its own `site-packages` from the host at `/mnt/snakemake`.
|
|
104
|
+
However, the **container's Python binary** must be ABI-compatible with the
|
|
105
|
+
host Python. Old bioconda/Damona images (Python 3.8) fail when the host runs
|
|
106
|
+
Python 3.10 because C-extension `.so` files compiled for 3.10 cannot be loaded
|
|
107
|
+
by Python 3.8:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
ImportError: /mnt/snakemake/...so: cannot open shared object
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
A further sign of inverted concerns: **Damona had to ship Python inside
|
|
114
|
+
tool containers** (bwa, samtools, …) specifically to satisfy the wrapper
|
|
115
|
+
mechanism. A container for `bwa` should contain `bwa`, not a Python runtime
|
|
116
|
+
serving the pipeline framework.
|
|
117
|
+
|
|
118
|
+
## Options considered
|
|
119
|
+
|
|
120
|
+
### Option 1 — Update container images to Python 3.10
|
|
121
|
+
Rebuild all Damona images with a Python version matching the host. Wrappers
|
|
122
|
+
would then work with containers as originally intended.
|
|
123
|
+
|
|
124
|
+
*Rejected as the primary fix*: containers would still carry Python only to
|
|
125
|
+
serve the framework; images must be rebuilt every time the host Python is
|
|
126
|
+
upgraded; the inverted concern is not resolved.
|
|
127
|
+
|
|
128
|
+
### Option 2 — Remove `container:` from wrapper rules (short-term workaround)
|
|
129
|
+
Wrapper rules run on the host (or via `--use-conda`); only pure `shell:` rules
|
|
130
|
+
keep their `container:` directive.
|
|
131
|
+
|
|
132
|
+
*Used as a temporary workaround* in sequana_mapper while the shell library
|
|
133
|
+
was being designed. Downside: Apptainer only covers a subset of rules.
|
|
134
|
+
|
|
135
|
+
### Option 3 — Drop wrappers, inline `shell:` in each pipeline (simplest)
|
|
136
|
+
Replace every wrapper with a hand-written `shell:` block inside the pipeline
|
|
137
|
+
rule. No shared library.
|
|
138
|
+
|
|
139
|
+
*Rejected*: duplicates logic across all pipelines; maintenance burden; loses
|
|
140
|
+
the reusability benefit of this repository entirely.
|
|
141
|
+
|
|
142
|
+
### Option 4 — Shell command library in `shells/` ✓ (chosen)
|
|
143
|
+
Return to the spirit of the early sequana approach: define reusable, versioned
|
|
144
|
+
shell command strings here, alongside the existing `wrappers/`. Pipelines
|
|
145
|
+
import these strings and use them in `shell:` + `container:` rules.
|
|
146
|
+
|
|
147
|
+
**Why this wins:**
|
|
148
|
+
|
|
149
|
+
| Property | Wrappers | Shell library |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| Reusable logic | Yes (Python) | Yes (string) |
|
|
152
|
+
| Python in container | Required | **Not needed** |
|
|
153
|
+
| Git tag checkout at run time | Yes | **No** |
|
|
154
|
+
| Damona images lean | No | **Yes** |
|
|
155
|
+
| Works with `--use-conda` | Yes | No |
|
|
156
|
+
| Apptainer compatible | Only if Python ABI matches | **Always** |
|
|
157
|
+
| Backward compatible | — | Yes (`wrappers/` kept) |
|
|
158
|
+
|
|
159
|
+
The `wrappers/` tree is kept untouched for full backward compatibility.
|
|
160
|
+
|
|
161
|
+
## Design
|
|
162
|
+
|
|
163
|
+
### Repository layout
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
sequana-wrappers/
|
|
167
|
+
├── wrappers/ # existing — kept for backward compat
|
|
168
|
+
│ ├── bwa/align/wrapper.py
|
|
169
|
+
│ └── ...
|
|
170
|
+
└── sequana_wrappers/shells/ # Python package — container-first shell library
|
|
171
|
+
├── __init__.py
|
|
172
|
+
├── bwa/
|
|
173
|
+
│ ├── __init__.py
|
|
174
|
+
│ ├── align/
|
|
175
|
+
│ │ ├── __init__.py
|
|
176
|
+
│ │ └── v1/
|
|
177
|
+
│ │ ├── __init__.py
|
|
178
|
+
│ │ └── cmd.py # frozen at release v1
|
|
179
|
+
│ └── build/
|
|
180
|
+
│ ├── __init__.py
|
|
181
|
+
│ └── v1/cmd.py
|
|
182
|
+
├── bamtools/
|
|
183
|
+
│ └── stats/
|
|
184
|
+
│ ├── __init__.py
|
|
185
|
+
│ └── v1/cmd.py
|
|
186
|
+
└── ...
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Versioning convention
|
|
190
|
+
|
|
191
|
+
Every shell script is named `cmd.py` and lives inside a named version
|
|
192
|
+
subdirectory. The structure is:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
sequana_wrappers/shells/<tool>/<command>/<version>/cmd.py
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Valid version names are:
|
|
199
|
+
|
|
200
|
+
- **`vN`** (e.g. `v1`, `v2`) — frozen, reproducible snapshots. Once created,
|
|
201
|
+
these files are **never edited**.
|
|
202
|
+
- **`dev`** — work-in-progress version used during active development.
|
|
203
|
+
A `dev/` directory is created when new work begins on a command and removed
|
|
204
|
+
(or renamed to `vN`) at release time. **No `dev/` directories exist in
|
|
205
|
+
released versions of this package.**
|
|
206
|
+
|
|
207
|
+
Every shell script is named `cmd.py`; the tool and command are encoded
|
|
208
|
+
entirely in the directory path. This makes future deeper nesting
|
|
209
|
+
(e.g. `shells/bamtools/stats/paired/v1/cmd.py`) natural without any
|
|
210
|
+
changes to the `get_shell` API.
|
|
211
|
+
|
|
212
|
+
There is **no silent fallback** between versions: requesting a version that
|
|
213
|
+
does not exist raises an explicit error.
|
|
214
|
+
|
|
215
|
+
### Version axes
|
|
216
|
+
|
|
217
|
+
Two version axes are completely independent:
|
|
218
|
+
|
|
219
|
+
| Axis | What it pins | Where it lives |
|
|
220
|
+
|---|---|---|
|
|
221
|
+
| Tool binary | e.g. `bwa 0.7.17` | Container image (Damona / Zenodo) |
|
|
222
|
+
| Shell command | e.g. `v1` | hardcoded per rule in the pipeline |
|
|
223
|
+
|
|
224
|
+
Each pipeline rule hardcodes its own shell command version independently —
|
|
225
|
+
one rule can use `v1` while another uses `v2` if only that command changed.
|
|
226
|
+
|
|
227
|
+
### Shell file format
|
|
228
|
+
|
|
229
|
+
Each `cmd.py` exports a single `CMD` string using Snakemake's standard
|
|
230
|
+
`{input}`, `{output}`, `{params}`, `{threads}`, `{log}`, and `{wildcards}`
|
|
231
|
+
placeholders:
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
# sequana_wrappers/shells/bwa/align/v1/cmd.py
|
|
235
|
+
CMD = """\
|
|
236
|
+
mkdir -p {params.tmp_directory}
|
|
237
|
+
(bwa mem -t {threads} {params.options} {input.reference} {input.fastq} \
|
|
238
|
+
| sambamba view -t {threads} -S -f bam -o /dev/stdout /dev/stdin \
|
|
239
|
+
| sambamba sort /dev/stdin -o {output.sorted} -t {threads} \
|
|
240
|
+
--tmpdir={params.tmp_directory}) \
|
|
241
|
+
> {log} 2>&1
|
|
242
|
+
"""
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Usage in a pipeline rule
|
|
246
|
+
|
|
247
|
+
`get_shell` is available as a method on the `PipelineManager` instance
|
|
248
|
+
(already present in every pipeline rules file) — no extra import needed.
|
|
249
|
+
The version is hardcoded per rule:
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
rule bwa:
|
|
253
|
+
input: ...
|
|
254
|
+
output: sorted="{sample}/{sample}.sorted.bam"
|
|
255
|
+
log: "{sample}/bwa/{sample}.log"
|
|
256
|
+
params: options=config["bwa"]["options"],
|
|
257
|
+
tmp_directory=config["bwa"]["tmp_directory"]
|
|
258
|
+
threads: 2
|
|
259
|
+
container: config['apptainers']['bwa']
|
|
260
|
+
shell: manager.get_shell("bwa/align", "v1")
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Use `"dev"` during development before a versioned snapshot exists:
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
shell: manager.get_shell("bwa/align", "dev")
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The container contains **only the tool binaries** — no Python, no Snakemake.
|
|
270
|
+
|
|
271
|
+
### Adding or updating a shell command
|
|
272
|
+
|
|
273
|
+
**During development:**
|
|
274
|
+
|
|
275
|
+
1. Create `sequana_wrappers/shells/<tool>/<command>/dev/` with `__init__.py`
|
|
276
|
+
and `cmd.py`.
|
|
277
|
+
2. Use `manager.get_shell("<tool>/<command>", "dev")` in the pipeline rule.
|
|
278
|
+
3. Test against the relevant Damona container.
|
|
279
|
+
|
|
280
|
+
**At release time:**
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
VERSION=v2
|
|
284
|
+
mkdir -p sequana_wrappers/shells/<tool>/<command>/${VERSION}
|
|
285
|
+
touch sequana_wrappers/shells/<tool>/<command>/${VERSION}/__init__.py
|
|
286
|
+
cp sequana_wrappers/shells/<tool>/<command>/dev/cmd.py \
|
|
287
|
+
sequana_wrappers/shells/<tool>/<command>/${VERSION}/cmd.py
|
|
288
|
+
rm -rf sequana_wrappers/shells/<tool>/<command>/dev
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Then update the pipeline rule to `manager.get_shell("<tool>/<command>", "v2")`
|
|
292
|
+
and bump `version` in `pyproject.toml`. No git tag required — the directory
|
|
293
|
+
**is** the version.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
# Notes for developers
|
|
298
|
+
|
|
299
|
+
## Overview
|
|
300
|
+
|
|
301
|
+
> **`wrappers/` is in maintenance mode.** Bug fixes are welcome; new wrappers
|
|
302
|
+
> are not accepted. All new tool commands should be added to
|
|
303
|
+
> `sequana_wrappers/shells/` instead. See the
|
|
304
|
+
> [shells rationale](#the-shells-directory--rationale-and-design) for context.
|
|
305
|
+
|
|
306
|
+
The `wrappers/` directory contains the legacy wrappers. Each sub-directory is dedicated to
|
|
307
|
+
a wrapper that is related to a given software/application. A sub directory may have several wrappers (e.g., bwa has a sub directory related to the indexing, and a sub directory related to mapping).
|
|
308
|
+
|
|
309
|
+
Here is an example of a wrapper tree structure:
|
|
310
|
+
|
|
311
|
+
fastqc
|
|
312
|
+
├── environment.yaml
|
|
313
|
+
├── README.md
|
|
314
|
+
├── test
|
|
315
|
+
│ ├── README.md
|
|
316
|
+
│ ├── Snakefile
|
|
317
|
+
│ ├── test_R1_.fastq
|
|
318
|
+
│ └── test_R2_.fastq
|
|
319
|
+
└── wrapper.py
|
|
320
|
+
|
|
321
|
+
Note that some software may have several sub wrappers (see the bowtie1 wrapper for instance).
|
|
322
|
+
|
|
323
|
+
A wrapper directory must contain a file called **wrapper.py** where the
|
|
324
|
+
developers must provide the core of the wrapper. There is no specific
|
|
325
|
+
instructions here except to write good code as much as possible (with comments).
|
|
326
|
+
|
|
327
|
+
A wrapper directory should have a **test** directory for continuous integration
|
|
328
|
+
with a **Snakefile** to be tested and possibly data file **Do not add large files here**. A
|
|
329
|
+
**README.md** should be added to explain the origin of the test data files.
|
|
330
|
+
Finally, include your tests in the main [**test.py**](test.py) file
|
|
331
|
+
of the root of the repository (not the wrapper itself).
|
|
332
|
+
|
|
333
|
+
For testing purposes, you should also add a file called **environment.yaml**
|
|
334
|
+
to tell what are the required packages to be installed for the test (and wrapper)
|
|
335
|
+
to work.
|
|
336
|
+
|
|
337
|
+
Finally, for the documentation, we ask the developer to create a **README.md** file
|
|
338
|
+
described here below.
|
|
339
|
+
|
|
340
|
+
To test your new wrapper (called *example* here), type:
|
|
341
|
+
|
|
342
|
+
pytest test.py -k test_example
|
|
343
|
+
|
|
344
|
+
## The config file
|
|
345
|
+
|
|
346
|
+
If required in a wrapper, parameters must be defined in a **config.yaml** file.
|
|
347
|
+
Similarly for threading. Consider the following pointswhen writting a wrapper:
|
|
348
|
+
|
|
349
|
+
- The thread paramter should also be a parameter in config file.
|
|
350
|
+
- the **params** section should contain a key called **options** also define in the config file.
|
|
351
|
+
- keys or parameters related to directories and files should use the *_directory* or *_file* suffices. This is for
|
|
352
|
+
Sequanix application to automatically recognised those options with a dedicated widget.
|
|
353
|
+
|
|
354
|
+
Consider this example:
|
|
355
|
+
|
|
356
|
+
rule falco:
|
|
357
|
+
input: whatever
|
|
358
|
+
output: whatever
|
|
359
|
+
log:
|
|
360
|
+
"samples/{sample}/falco.log"
|
|
361
|
+
threads:
|
|
362
|
+
config['falco']['threads']
|
|
363
|
+
params:
|
|
364
|
+
options=config['falco']['options'],
|
|
365
|
+
wkdir=config['falco']['working_directory']
|
|
366
|
+
wrapper:
|
|
367
|
+
"falco/wrappers/falco"
|
|
368
|
+
|
|
369
|
+
You config file will look like:
|
|
370
|
+
|
|
371
|
+
falco:
|
|
372
|
+
threads: 4
|
|
373
|
+
options="--verbose"
|
|
374
|
+
working_directory: 'here'
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
## Naming arguments of the different sections
|
|
378
|
+
|
|
379
|
+
In all sections (e.g., input, params), if there is only one input, no need to name it, otherwise, please do.
|
|
380
|
+
|
|
381
|
+
rule example1:
|
|
382
|
+
input:
|
|
383
|
+
"test.bam"
|
|
384
|
+
output:
|
|
385
|
+
"test.sorted.bam"
|
|
386
|
+
...
|
|
387
|
+
|
|
388
|
+
but:
|
|
389
|
+
|
|
390
|
+
rule example1:
|
|
391
|
+
input:
|
|
392
|
+
"test.bam"
|
|
393
|
+
output:
|
|
394
|
+
bam="test.sorted.bam"
|
|
395
|
+
bai="test.sorted.bam.bai"
|
|
396
|
+
...
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
## Documentation
|
|
402
|
+
|
|
403
|
+
Each wrapper should have a dedicated documentation explaining the input/output with a usage example. It should also document the expected configuration file. The file must be formatted in markdown. It must contain a **Documentation** and **Example** sub sections. If a **Configuration** section is found, it is also added to the documentation. This **README.md** file will be rendered automatically via a Sequana sphinx plugin. Consider the [fastqc](wrappers/fastqc/README.md) directory for a workable example rendered [here](https://sequana.readthedocs.io/en/master/wrappers.html#fastqc).
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
## Faqs
|
|
408
|
+
|
|
409
|
+
### adding a new wrapper in practice
|
|
410
|
+
|
|
411
|
+
In ./wrappers, add a new wrapper. Copy the existing fastqc wrapper for instance.
|
|
412
|
+
Edit the wrapper.py and design a test/Snakefile example for testing. Since you are
|
|
413
|
+
a developer, you are problaby developping in a dedicated branch. Let us call it **dev**.
|
|
414
|
+
|
|
415
|
+
In the test/Snakefile, you should switch from the **main** to the **dev** in the wrapper path:
|
|
416
|
+
|
|
417
|
+
wrapper:
|
|
418
|
+
"dev/wrappers/my_new_wrapper"
|
|
419
|
+
|
|
420
|
+
In order to test your Snakefile, you first need to commit the wrapper.py. Then, execute the Snakefile:
|
|
421
|
+
|
|
422
|
+
snakemake -s Snakefile -j 1 --wrapper-prefix git+file:///YOURPATH/sequana-wrappers/ -f -p
|
|
423
|
+
|
|
424
|
+
If it fails, edit and commit your wrapper.py and execute again until your Snakefile and wrappers are functional.
|
|
425
|
+
|
|
426
|
+
Once done, switch back the wrapper path to the **main** branch:
|
|
427
|
+
|
|
428
|
+
wrapper:
|
|
429
|
+
"main/wrappers/my_new_wrapper"
|
|
430
|
+
|
|
431
|
+
Time to include the new wrapper in the continous integration. Go to the root of sequana-wrappers and add a functional test to the end of test.py. Then, test it:
|
|
432
|
+
|
|
433
|
+
pytest test.py -k my_new_wrapper -v
|
|
434
|
+
|
|
435
|
+
You are ready to push and create a pull-requests
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
## Tagging
|
|
440
|
+
|
|
441
|
+
You may consider to add a tag. Our convention is to use a tag with the YEAR.MONTH.DAY
|
|
442
|
+
where day and month do not include extra zeros. So you would have e.g.:
|
|
443
|
+
|
|
444
|
+
v23.11.11
|
|
445
|
+
v23.2.2
|
|
446
|
+
|
|
447
|
+
but not v23.02.02
|
|
448
|
+
|
|
449
|
+
We use annotated tags so the command is e.g.:
|
|
450
|
+
|
|
451
|
+
git tag -a v23.11.11
|
|
452
|
+
|
|
453
|
+
and then push it to github:
|
|
454
|
+
|
|
455
|
+
git push origin main v23.11.11
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|