breakpoint2bedsv 1.1.1__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.
- breakpoint2bedsv-1.1.1/PKG-INFO +308 -0
- breakpoint2bedsv-1.1.1/README.md +288 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/__init__.py +23 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/arguments.py +205 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/cli.py +92 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/core.py +138 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/file_utils.py +158 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/logging_utils.py +73 -0
- breakpoint2bedsv-1.1.1/breakpoint2bedsv/workflow.py +347 -0
- breakpoint2bedsv-1.1.1/pyproject.toml +31 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: breakpoint2bedsv
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: Convert SV breakpoints from VCF/BCF to BED
|
|
5
|
+
License: GPL-3.0-or-later
|
|
6
|
+
Author: Geoffroy Véronique
|
|
7
|
+
Author-email: veronique.geoffroy@inserm.fr
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Dist: pysam (==0.22.1)
|
|
18
|
+
Requires-Dist: variant-extractor (==5.1.0)
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<div align="center">
|
|
23
|
+
<h1 style="font-weight: bold; margin-bottom: 0.2em;">breakpoint2BedSV</h1>
|
|
24
|
+
<h3 style="margin-top: 0;">Convert SV breakpoints from VCF/BCF to BED</h3>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
- [Why extracting start/end SV breakpoints from a VCF is not trivial](#why-extracting-startend-sv-breakpoints-from-a-vcf-is-not-trivial)
|
|
28
|
+
- [Requirements](#requirements)
|
|
29
|
+
- [Quick Installation](#quick-installation)
|
|
30
|
+
- [Install from PyPI](#install-from-pypi)
|
|
31
|
+
- [Upgrade](#upgrade)
|
|
32
|
+
- [Install from GitHub](#install-from-github)
|
|
33
|
+
- [Run the test suite](#run-the-test-suite)
|
|
34
|
+
- [Command line usage / Options](#command-line-usage--options)
|
|
35
|
+
- [Outputs](#outputs)
|
|
36
|
+
- [Variant filtering rules](#variant-filtering-rules)
|
|
37
|
+
- [Behavior](#behavior)
|
|
38
|
+
- [How to cite?](#how-to-cite)
|
|
39
|
+
- [Example application: Cohort assessment of SV presence/absence using gnomAD v4 SVs as reference](#example-application-cohort-assessment-of-sv-presenceabsence-using-gnomad-v4-svs-as-reference)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
|
|
42
|
+
## Why extracting start/end SV breakpoints from a VCF is not trivial
|
|
43
|
+
|
|
44
|
+
In an SV VCF, the first breakpoint is usually straightforward to retrieve from the `CHROM` and `POS` columns.
|
|
45
|
+
However, the second breakpoint is not encoded in a single standardized way and may appear in different fields depending on the SV type or the caller.
|
|
46
|
+
|
|
47
|
+
| SV representation | First breakpoint | Second breakpoint |
|
|
48
|
+
| --------------------------------------------------------------- | ---------------- | ---------------------------------------- |
|
|
49
|
+
| Symbolic allele (`<DEL>`, `<DUP>`, `<INV>`, `<CNV>`) | `CHROM:POS` | usually `INFO/END` |
|
|
50
|
+
| Breakend notation (e.g. `]chr13:53040041]ATATATATACACACA`) | `CHROM:POS` | embedded in the `ALT` field |
|
|
51
|
+
| Sequence notation (e.g. INS: `REF=A` and `ALT=ATGATTCGTTCTG...`)| `CHROM:POS` | embedded in the `REF` field |
|
|
52
|
+
| Sequence notation (e.g. DEL: `REF=TGGAATTAGCCTG...` and `ALT=T`)| `CHROM:POS` | embedded in the `REF` field |
|
|
53
|
+
| Caller-specific representations | `CHROM:POS` | may use alternative tags such as `SVEND` |
|
|
54
|
+
|
|
55
|
+
As a consequence, extracting both breakpoints from an SV VCF requires handling multiple representations.
|
|
56
|
+
`breakpoint2BedSV` addresses this issue by converting heterogeneous SV representations into a unified BED-like breakpoint format.
|
|
57
|
+
|
|
58
|
+
## Requirements
|
|
59
|
+
<i>cf</i> [`pyproject.toml`](pyproject.toml)
|
|
60
|
+
|
|
61
|
+
## Quick Installation
|
|
62
|
+
|
|
63
|
+
### Install from PyPI
|
|
64
|
+
|
|
65
|
+
The recommended way to install `breakpoint2BedSV` is with `pip`:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install breakpoint2bedsv
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then verify the installation:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
breakpoint2bedsv --help
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Upgrade
|
|
78
|
+
|
|
79
|
+
To upgrade to the latest version:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install --upgrade breakpoint2bedsv
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Install from GitHub
|
|
86
|
+
|
|
87
|
+
To install the latest development version directly from GitHub:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/lgmgeo/breakpoint2BedSV.git
|
|
91
|
+
cd breakpoint2BedSV
|
|
92
|
+
poetry install
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then run:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
poetry run breakpoint2bedsv --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Run the test suite
|
|
102
|
+
|
|
103
|
+
To run all tests locally:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
poetry run pytest -v
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To list the collected tests without executing them:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
poetry run pytest --collect-only
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The test data and test scripts are located in the `tests/` directory.
|
|
116
|
+
|
|
117
|
+
All tests are also executed automatically through GitHub Actions on each push and pull request.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## Command line usage / Options
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
usage: breakpoint2bedsv [-h] [-V] [--log-file <File>] -i <File> [-d <Dir>] -o <File> [-T <Dir>] [-v]
|
|
124
|
+
|
|
125
|
+
Convert SV breakpoints from VCF/BCF to BED
|
|
126
|
+
|
|
127
|
+
optional arguments:
|
|
128
|
+
-h, --help show this help message and exit
|
|
129
|
+
-V, --version show program's version number and exit
|
|
130
|
+
--log-file <File> write log messages to the specified file
|
|
131
|
+
|
|
132
|
+
Input files:
|
|
133
|
+
-i <File>, --input-file <File>
|
|
134
|
+
the SV VCF/BCF input file
|
|
135
|
+
VCF/VCF.gz/BCF files are supported
|
|
136
|
+
multi-allelic lines are not allowed
|
|
137
|
+
required
|
|
138
|
+
|
|
139
|
+
Output options:
|
|
140
|
+
-d <Dir>, --output-dir <Dir>
|
|
141
|
+
the output directory
|
|
142
|
+
default: current directory
|
|
143
|
+
-o <File>, --output-file <File>
|
|
144
|
+
output BED file containing non redundant SV breakpoints
|
|
145
|
+
(VCF/BCF IDs are merged as a comma-separated list when
|
|
146
|
+
multiple variants share the same coordinates)
|
|
147
|
+
required
|
|
148
|
+
|
|
149
|
+
Behavior:
|
|
150
|
+
-T <Dir>, --tmp-dir <Dir>
|
|
151
|
+
directory where temporary files will be created
|
|
152
|
+
if not provided, the system default temporary directory is used
|
|
153
|
+
-v, --verbose enable verbose output
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Outputs
|
|
157
|
+
|
|
158
|
+
Running the tool will generate a BED output file with SV start/end coordinates and the associated VCF ID.
|
|
159
|
+
Redundant genomic coordinates are merged into a single BED entry, with multiple VCF IDs reported as a comma-separated list.
|
|
160
|
+
|
|
161
|
+
## Variant filtering rules
|
|
162
|
+
|
|
163
|
+
`breakpoint2BedSV` only processes structural variants compatible with breakpoint-based BED representation.
|
|
164
|
+
|
|
165
|
+
During parsing, the following records are automatically ignored:
|
|
166
|
+
- FILTER = `MULTIALLELIC` (including MCNV-like multi-allelic CNV representations)
|
|
167
|
+
- ALT = `<BND>` (breakend complex rearrangements)
|
|
168
|
+
- ALT = `<CPX>` (complex structural variants)
|
|
169
|
+
- ALT = `<CTX>` (complex translocations)
|
|
170
|
+
|
|
171
|
+
### Behavior
|
|
172
|
+
- These variants are **skipped during parsing**
|
|
173
|
+
- They are **not written to the output BED file**
|
|
174
|
+
- The number of skipped records is reported as a warning in the standard output
|
|
175
|
+
|
|
176
|
+
## How to cite?
|
|
177
|
+
|
|
178
|
+
Please cite the following doi if you are using this tool in your research:<br>
|
|
179
|
+
[](https://doi.org/10.5281/zenodo.21134592)
|
|
180
|
+
|
|
181
|
+
## Example application: Cohort assessment of SV presence/absence using gnomAD v4 SVs as reference
|
|
182
|
+
|
|
183
|
+
**Aim**
|
|
184
|
+
|
|
185
|
+
=> Annotate PE/SR-based SVs in a VCF with a `gnomAD_excl` flag when at least one breakpoint overlaps a gnomAD v4 SV exclusion region.
|
|
186
|
+
(<i>cf</i> <a href="https://discuss.gnomad.broadinstitute.org/t/centromeric-del-detected-by-manta-and-visible-in-coverage-but-missing-from-gnomad-sv/833" target="_blank">discussion</a> in the gnomAD forum)
|
|
187
|
+
|
|
188
|
+
<img src="./doc/breakpoint2BedSV_overlap.png" alt="SV schema"/>
|
|
189
|
+
|
|
190
|
+
**Workflow**
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
SV VCF
|
|
194
|
+
│
|
|
195
|
+
├── breakpoint2BedSV
|
|
196
|
+
│ → convert all SVs into breakpoint-level BED intervals
|
|
197
|
+
│
|
|
198
|
+
├── bedtools intersect
|
|
199
|
+
│ → overlap SV breakpoints with gnomAD v4 SV exclusion regions
|
|
200
|
+
│
|
|
201
|
+
├── collect overlapping SV IDs
|
|
202
|
+
│
|
|
203
|
+
└── annotate VCF
|
|
204
|
+
→ add INFO flag: gnomAD_excl
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**GRCh38 gnomAD exclusion resources**
|
|
208
|
+
|
|
209
|
+
SV calling is less reliable in some genomic regions due to:
|
|
210
|
+
|
|
211
|
+
- low mappability / depth bias
|
|
212
|
+
- peri-centromeric or peri-telomeric repeats
|
|
213
|
+
- known problematic regions in population datasets such as gnomAD
|
|
214
|
+
|
|
215
|
+
Two GRCh38 gnomAD exclusion regions:
|
|
216
|
+
|
|
217
|
+
- `depth_blacklist.sorted.bed.gz`
|
|
218
|
+
- `PESR.encode.peri_all.repeats.delly.hg38.blacklist.sorted.bed.gz`
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
curl -O https://storage.googleapis.com/gatk-sv-resources-public/hg38/v0/sv-resources/resources/v1/depth_blacklist.sorted.bed.gz
|
|
222
|
+
curl -O https://storage.googleapis.com/gatk-sv-resources-public/hg38/v0/sv-resources/resources/v1/PESR.encode.peri_all.repeats.delly.hg38.blacklist.sorted.bed.gz
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Output**
|
|
226
|
+
|
|
227
|
+
SVs with at least one breakpoint overlapping one of these exclusion regions are flagged in the VCF with:
|
|
228
|
+
|
|
229
|
+
```vcf
|
|
230
|
+
##INFO=<ID=gnomAD_excl,Number=0,Type=Flag,Description="At least one SV breakpoint overlaps a gnomAD exclusion region">
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Implementation**
|
|
234
|
+
|
|
235
|
+
1. Convert SV VCF to breakpoint BED format
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
breakpoint2BedSV \
|
|
239
|
+
--vcf input.vcf \
|
|
240
|
+
--output sv.breakpoints.bed
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This step standardizes all SV representations (DEL/DUP/INV/BND/SVEND) into a unified breakpoint BED format.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
2. Identify SVs overlapping gnomAD v4 exclusion regions
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
bedtools intersect \
|
|
251
|
+
-a sv.breakpoints.bed \
|
|
252
|
+
-b depth_blacklist.sorted.bed.gz \
|
|
253
|
+
-wa | cut -f4 | sort -u > excluded_ids.txt
|
|
254
|
+
|
|
255
|
+
bedtools intersect \
|
|
256
|
+
-a sv.breakpoints.bed \
|
|
257
|
+
-b PESR.encode.peri_all.repeats.delly.hg38.blacklist.sorted.bed.gz \
|
|
258
|
+
-wa | cut -f4 | sort -u >> excluded_ids.txt
|
|
259
|
+
|
|
260
|
+
tr "," "\n" < excluded_ids.txt | sort -u > excluded_ids.final.txt
|
|
261
|
+
rm excluded_ids.txt
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
3. Annotate original VCF with `gnomAD_excl` flag
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
awk -F'\t' '
|
|
270
|
+
BEGIN {
|
|
271
|
+
OFS="\t"
|
|
272
|
+
while ((getline line < "excluded_ids.final.txt") > 0)
|
|
273
|
+
excl[line] = 1
|
|
274
|
+
}
|
|
275
|
+
{
|
|
276
|
+
if ($0 ~ /^#/) {
|
|
277
|
+
print
|
|
278
|
+
next
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
id = $3
|
|
282
|
+
|
|
283
|
+
if (id in excl) {
|
|
284
|
+
if ($8 == "." || $8 == "") {
|
|
285
|
+
$8 = "gnomAD_excl"
|
|
286
|
+
} else {
|
|
287
|
+
$8 = $8 ";gnomAD_excl"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
print
|
|
292
|
+
}
|
|
293
|
+
' input.vcf > input.gnomAD_excl.vcf
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
breakpoint2bedsv is free software: you can redistribute it and/or modify
|
|
299
|
+
it under the terms of the GNU General Public License as published by
|
|
300
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
301
|
+
(at your option) any later version.
|
|
302
|
+
|
|
303
|
+
breakpoint2bedsv is distributed in the hope that it will be useful,
|
|
304
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
305
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
306
|
+
GNU General Public License for more details.
|
|
307
|
+
|
|
308
|
+
See the `LICENSE` file for the full license text.
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
|
|
2
|
+
<div align="center">
|
|
3
|
+
<h1 style="font-weight: bold; margin-bottom: 0.2em;">breakpoint2BedSV</h1>
|
|
4
|
+
<h3 style="margin-top: 0;">Convert SV breakpoints from VCF/BCF to BED</h3>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
- [Why extracting start/end SV breakpoints from a VCF is not trivial](#why-extracting-startend-sv-breakpoints-from-a-vcf-is-not-trivial)
|
|
8
|
+
- [Requirements](#requirements)
|
|
9
|
+
- [Quick Installation](#quick-installation)
|
|
10
|
+
- [Install from PyPI](#install-from-pypi)
|
|
11
|
+
- [Upgrade](#upgrade)
|
|
12
|
+
- [Install from GitHub](#install-from-github)
|
|
13
|
+
- [Run the test suite](#run-the-test-suite)
|
|
14
|
+
- [Command line usage / Options](#command-line-usage--options)
|
|
15
|
+
- [Outputs](#outputs)
|
|
16
|
+
- [Variant filtering rules](#variant-filtering-rules)
|
|
17
|
+
- [Behavior](#behavior)
|
|
18
|
+
- [How to cite?](#how-to-cite)
|
|
19
|
+
- [Example application: Cohort assessment of SV presence/absence using gnomAD v4 SVs as reference](#example-application-cohort-assessment-of-sv-presenceabsence-using-gnomad-v4-svs-as-reference)
|
|
20
|
+
- [License](#license)
|
|
21
|
+
|
|
22
|
+
## Why extracting start/end SV breakpoints from a VCF is not trivial
|
|
23
|
+
|
|
24
|
+
In an SV VCF, the first breakpoint is usually straightforward to retrieve from the `CHROM` and `POS` columns.
|
|
25
|
+
However, the second breakpoint is not encoded in a single standardized way and may appear in different fields depending on the SV type or the caller.
|
|
26
|
+
|
|
27
|
+
| SV representation | First breakpoint | Second breakpoint |
|
|
28
|
+
| --------------------------------------------------------------- | ---------------- | ---------------------------------------- |
|
|
29
|
+
| Symbolic allele (`<DEL>`, `<DUP>`, `<INV>`, `<CNV>`) | `CHROM:POS` | usually `INFO/END` |
|
|
30
|
+
| Breakend notation (e.g. `]chr13:53040041]ATATATATACACACA`) | `CHROM:POS` | embedded in the `ALT` field |
|
|
31
|
+
| Sequence notation (e.g. INS: `REF=A` and `ALT=ATGATTCGTTCTG...`)| `CHROM:POS` | embedded in the `REF` field |
|
|
32
|
+
| Sequence notation (e.g. DEL: `REF=TGGAATTAGCCTG...` and `ALT=T`)| `CHROM:POS` | embedded in the `REF` field |
|
|
33
|
+
| Caller-specific representations | `CHROM:POS` | may use alternative tags such as `SVEND` |
|
|
34
|
+
|
|
35
|
+
As a consequence, extracting both breakpoints from an SV VCF requires handling multiple representations.
|
|
36
|
+
`breakpoint2BedSV` addresses this issue by converting heterogeneous SV representations into a unified BED-like breakpoint format.
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
<i>cf</i> [`pyproject.toml`](pyproject.toml)
|
|
40
|
+
|
|
41
|
+
## Quick Installation
|
|
42
|
+
|
|
43
|
+
### Install from PyPI
|
|
44
|
+
|
|
45
|
+
The recommended way to install `breakpoint2BedSV` is with `pip`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install breakpoint2bedsv
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Then verify the installation:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
breakpoint2bedsv --help
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Upgrade
|
|
58
|
+
|
|
59
|
+
To upgrade to the latest version:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install --upgrade breakpoint2bedsv
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Install from GitHub
|
|
66
|
+
|
|
67
|
+
To install the latest development version directly from GitHub:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
git clone https://github.com/lgmgeo/breakpoint2BedSV.git
|
|
71
|
+
cd breakpoint2BedSV
|
|
72
|
+
poetry install
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then run:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
poetry run breakpoint2bedsv --help
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Run the test suite
|
|
82
|
+
|
|
83
|
+
To run all tests locally:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
poetry run pytest -v
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
To list the collected tests without executing them:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
poetry run pytest --collect-only
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The test data and test scripts are located in the `tests/` directory.
|
|
96
|
+
|
|
97
|
+
All tests are also executed automatically through GitHub Actions on each push and pull request.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
## Command line usage / Options
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
usage: breakpoint2bedsv [-h] [-V] [--log-file <File>] -i <File> [-d <Dir>] -o <File> [-T <Dir>] [-v]
|
|
104
|
+
|
|
105
|
+
Convert SV breakpoints from VCF/BCF to BED
|
|
106
|
+
|
|
107
|
+
optional arguments:
|
|
108
|
+
-h, --help show this help message and exit
|
|
109
|
+
-V, --version show program's version number and exit
|
|
110
|
+
--log-file <File> write log messages to the specified file
|
|
111
|
+
|
|
112
|
+
Input files:
|
|
113
|
+
-i <File>, --input-file <File>
|
|
114
|
+
the SV VCF/BCF input file
|
|
115
|
+
VCF/VCF.gz/BCF files are supported
|
|
116
|
+
multi-allelic lines are not allowed
|
|
117
|
+
required
|
|
118
|
+
|
|
119
|
+
Output options:
|
|
120
|
+
-d <Dir>, --output-dir <Dir>
|
|
121
|
+
the output directory
|
|
122
|
+
default: current directory
|
|
123
|
+
-o <File>, --output-file <File>
|
|
124
|
+
output BED file containing non redundant SV breakpoints
|
|
125
|
+
(VCF/BCF IDs are merged as a comma-separated list when
|
|
126
|
+
multiple variants share the same coordinates)
|
|
127
|
+
required
|
|
128
|
+
|
|
129
|
+
Behavior:
|
|
130
|
+
-T <Dir>, --tmp-dir <Dir>
|
|
131
|
+
directory where temporary files will be created
|
|
132
|
+
if not provided, the system default temporary directory is used
|
|
133
|
+
-v, --verbose enable verbose output
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Outputs
|
|
137
|
+
|
|
138
|
+
Running the tool will generate a BED output file with SV start/end coordinates and the associated VCF ID.
|
|
139
|
+
Redundant genomic coordinates are merged into a single BED entry, with multiple VCF IDs reported as a comma-separated list.
|
|
140
|
+
|
|
141
|
+
## Variant filtering rules
|
|
142
|
+
|
|
143
|
+
`breakpoint2BedSV` only processes structural variants compatible with breakpoint-based BED representation.
|
|
144
|
+
|
|
145
|
+
During parsing, the following records are automatically ignored:
|
|
146
|
+
- FILTER = `MULTIALLELIC` (including MCNV-like multi-allelic CNV representations)
|
|
147
|
+
- ALT = `<BND>` (breakend complex rearrangements)
|
|
148
|
+
- ALT = `<CPX>` (complex structural variants)
|
|
149
|
+
- ALT = `<CTX>` (complex translocations)
|
|
150
|
+
|
|
151
|
+
### Behavior
|
|
152
|
+
- These variants are **skipped during parsing**
|
|
153
|
+
- They are **not written to the output BED file**
|
|
154
|
+
- The number of skipped records is reported as a warning in the standard output
|
|
155
|
+
|
|
156
|
+
## How to cite?
|
|
157
|
+
|
|
158
|
+
Please cite the following doi if you are using this tool in your research:<br>
|
|
159
|
+
[](https://doi.org/10.5281/zenodo.21134592)
|
|
160
|
+
|
|
161
|
+
## Example application: Cohort assessment of SV presence/absence using gnomAD v4 SVs as reference
|
|
162
|
+
|
|
163
|
+
**Aim**
|
|
164
|
+
|
|
165
|
+
=> Annotate PE/SR-based SVs in a VCF with a `gnomAD_excl` flag when at least one breakpoint overlaps a gnomAD v4 SV exclusion region.
|
|
166
|
+
(<i>cf</i> <a href="https://discuss.gnomad.broadinstitute.org/t/centromeric-del-detected-by-manta-and-visible-in-coverage-but-missing-from-gnomad-sv/833" target="_blank">discussion</a> in the gnomAD forum)
|
|
167
|
+
|
|
168
|
+
<img src="./doc/breakpoint2BedSV_overlap.png" alt="SV schema"/>
|
|
169
|
+
|
|
170
|
+
**Workflow**
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
SV VCF
|
|
174
|
+
│
|
|
175
|
+
├── breakpoint2BedSV
|
|
176
|
+
│ → convert all SVs into breakpoint-level BED intervals
|
|
177
|
+
│
|
|
178
|
+
├── bedtools intersect
|
|
179
|
+
│ → overlap SV breakpoints with gnomAD v4 SV exclusion regions
|
|
180
|
+
│
|
|
181
|
+
├── collect overlapping SV IDs
|
|
182
|
+
│
|
|
183
|
+
└── annotate VCF
|
|
184
|
+
→ add INFO flag: gnomAD_excl
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**GRCh38 gnomAD exclusion resources**
|
|
188
|
+
|
|
189
|
+
SV calling is less reliable in some genomic regions due to:
|
|
190
|
+
|
|
191
|
+
- low mappability / depth bias
|
|
192
|
+
- peri-centromeric or peri-telomeric repeats
|
|
193
|
+
- known problematic regions in population datasets such as gnomAD
|
|
194
|
+
|
|
195
|
+
Two GRCh38 gnomAD exclusion regions:
|
|
196
|
+
|
|
197
|
+
- `depth_blacklist.sorted.bed.gz`
|
|
198
|
+
- `PESR.encode.peri_all.repeats.delly.hg38.blacklist.sorted.bed.gz`
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
curl -O https://storage.googleapis.com/gatk-sv-resources-public/hg38/v0/sv-resources/resources/v1/depth_blacklist.sorted.bed.gz
|
|
202
|
+
curl -O https://storage.googleapis.com/gatk-sv-resources-public/hg38/v0/sv-resources/resources/v1/PESR.encode.peri_all.repeats.delly.hg38.blacklist.sorted.bed.gz
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Output**
|
|
206
|
+
|
|
207
|
+
SVs with at least one breakpoint overlapping one of these exclusion regions are flagged in the VCF with:
|
|
208
|
+
|
|
209
|
+
```vcf
|
|
210
|
+
##INFO=<ID=gnomAD_excl,Number=0,Type=Flag,Description="At least one SV breakpoint overlaps a gnomAD exclusion region">
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Implementation**
|
|
214
|
+
|
|
215
|
+
1. Convert SV VCF to breakpoint BED format
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
breakpoint2BedSV \
|
|
219
|
+
--vcf input.vcf \
|
|
220
|
+
--output sv.breakpoints.bed
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
This step standardizes all SV representations (DEL/DUP/INV/BND/SVEND) into a unified breakpoint BED format.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
2. Identify SVs overlapping gnomAD v4 exclusion regions
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
bedtools intersect \
|
|
231
|
+
-a sv.breakpoints.bed \
|
|
232
|
+
-b depth_blacklist.sorted.bed.gz \
|
|
233
|
+
-wa | cut -f4 | sort -u > excluded_ids.txt
|
|
234
|
+
|
|
235
|
+
bedtools intersect \
|
|
236
|
+
-a sv.breakpoints.bed \
|
|
237
|
+
-b PESR.encode.peri_all.repeats.delly.hg38.blacklist.sorted.bed.gz \
|
|
238
|
+
-wa | cut -f4 | sort -u >> excluded_ids.txt
|
|
239
|
+
|
|
240
|
+
tr "," "\n" < excluded_ids.txt | sort -u > excluded_ids.final.txt
|
|
241
|
+
rm excluded_ids.txt
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
3. Annotate original VCF with `gnomAD_excl` flag
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
awk -F'\t' '
|
|
250
|
+
BEGIN {
|
|
251
|
+
OFS="\t"
|
|
252
|
+
while ((getline line < "excluded_ids.final.txt") > 0)
|
|
253
|
+
excl[line] = 1
|
|
254
|
+
}
|
|
255
|
+
{
|
|
256
|
+
if ($0 ~ /^#/) {
|
|
257
|
+
print
|
|
258
|
+
next
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
id = $3
|
|
262
|
+
|
|
263
|
+
if (id in excl) {
|
|
264
|
+
if ($8 == "." || $8 == "") {
|
|
265
|
+
$8 = "gnomAD_excl"
|
|
266
|
+
} else {
|
|
267
|
+
$8 = $8 ";gnomAD_excl"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
print
|
|
272
|
+
}
|
|
273
|
+
' input.vcf > input.gnomAD_excl.vcf
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
breakpoint2bedsv is free software: you can redistribute it and/or modify
|
|
279
|
+
it under the terms of the GNU General Public License as published by
|
|
280
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
281
|
+
(at your option) any later version.
|
|
282
|
+
|
|
283
|
+
breakpoint2bedsv is distributed in the hope that it will be useful,
|
|
284
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
285
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
286
|
+
GNU General Public License for more details.
|
|
287
|
+
|
|
288
|
+
See the `LICENSE` file for the full license text.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
breakpoint2bedsv
|
|
3
|
+
Copyright (C) 2026-current Veronique Geoffroy (veronique.geoffroy@inserm.fr)
|
|
4
|
+
|
|
5
|
+
This program is free software; you can redistribute it and/or
|
|
6
|
+
modify it under the terms of the GNU General Public License
|
|
7
|
+
as published by the Free Software Foundation; either version 3
|
|
8
|
+
of the License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program; If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from importlib.metadata import version
|
|
20
|
+
|
|
21
|
+
__version__ = version("breakpoint2bedsv")
|
|
22
|
+
|
|
23
|
+
|