OctopuSV 0.2.0__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.
Files changed (80) hide show
  1. octopusv-0.2.0/LICENSE +21 -0
  2. octopusv-0.2.0/PKG-INFO +214 -0
  3. octopusv-0.2.0/README.md +190 -0
  4. octopusv-0.2.0/pyproject.toml +185 -0
  5. octopusv-0.2.0/src/octopusv/__init__.py +4 -0
  6. octopusv-0.2.0/src/octopusv/__main__.py +3 -0
  7. octopusv-0.2.0/src/octopusv/bencher/__init__.py +0 -0
  8. octopusv-0.2.0/src/octopusv/bencher/bench_utils.py +39 -0
  9. octopusv-0.2.0/src/octopusv/bencher/sv_bencher.py +274 -0
  10. octopusv-0.2.0/src/octopusv/cli/__init__.py +0 -0
  11. octopusv-0.2.0/src/octopusv/cli/bench.py +91 -0
  12. octopusv-0.2.0/src/octopusv/cli/cli.py +53 -0
  13. octopusv-0.2.0/src/octopusv/cli/convert.py +336 -0
  14. octopusv-0.2.0/src/octopusv/cli/merge.py +269 -0
  15. octopusv-0.2.0/src/octopusv/cli/plot.py +27 -0
  16. octopusv-0.2.0/src/octopusv/cli/stat.py +54 -0
  17. octopusv-0.2.0/src/octopusv/cli/svcf2bed.py +49 -0
  18. octopusv-0.2.0/src/octopusv/cli/svcf2bedpe.py +49 -0
  19. octopusv-0.2.0/src/octopusv/cli/svcf2vcf.py +36 -0
  20. octopusv-0.2.0/src/octopusv/converter/__init__.py +0 -0
  21. octopusv-0.2.0/src/octopusv/converter/base.py +122 -0
  22. octopusv-0.2.0/src/octopusv/converter/bnd2del.py +130 -0
  23. octopusv-0.2.0/src/octopusv/converter/bnd2dup_pair.py +130 -0
  24. octopusv-0.2.0/src/octopusv/converter/bnd2inv_pair.py +118 -0
  25. octopusv-0.2.0/src/octopusv/converter/bnd_keeping.py +38 -0
  26. octopusv-0.2.0/src/octopusv/converter/mpi2tra.py +33 -0
  27. octopusv-0.2.0/src/octopusv/converter/mpm2tra.py +31 -0
  28. octopusv-0.2.0/src/octopusv/converter/mprtra2tra.py +53 -0
  29. octopusv-0.2.0/src/octopusv/converter/nobnd.py +69 -0
  30. octopusv-0.2.0/src/octopusv/converter/snmd_dndpi2tra.py +32 -0
  31. octopusv-0.2.0/src/octopusv/converter/snmd_dndpr_tra2tra.py +37 -0
  32. octopusv-0.2.0/src/octopusv/converter/stra2tra.py +13 -0
  33. octopusv-0.2.0/src/octopusv/filter/__init__.py +10 -0
  34. octopusv-0.2.0/src/octopusv/filter/quality_filter.py +337 -0
  35. octopusv-0.2.0/src/octopusv/formatter/svcf_to_bed_converter.py +61 -0
  36. octopusv-0.2.0/src/octopusv/formatter/svcf_to_bedpe_converter.py +68 -0
  37. octopusv-0.2.0/src/octopusv/formatter/svcf_to_vcf_converter.py +98 -0
  38. octopusv-0.2.0/src/octopusv/merger/TRA_merge_logic.py +95 -0
  39. octopusv-0.2.0/src/octopusv/merger/__init__.py +0 -0
  40. octopusv-0.2.0/src/octopusv/merger/bnd_merge_logic.py +112 -0
  41. octopusv-0.2.0/src/octopusv/merger/bnd_merger.py +113 -0
  42. octopusv-0.2.0/src/octopusv/merger/multi_sample_writer.py +177 -0
  43. octopusv-0.2.0/src/octopusv/merger/name_mapper.py +50 -0
  44. octopusv-0.2.0/src/octopusv/merger/sv_merge_logic.py +81 -0
  45. octopusv-0.2.0/src/octopusv/merger/sv_merger.py +399 -0
  46. octopusv-0.2.0/src/octopusv/merger/sv_selector.py +125 -0
  47. octopusv-0.2.0/src/octopusv/merger/tra_merger.py +139 -0
  48. octopusv-0.2.0/src/octopusv/merger/upset_plotter.py +175 -0
  49. octopusv-0.2.0/src/octopusv/ploter/__init__.py +0 -0
  50. octopusv-0.2.0/src/octopusv/ploter/chromosome_plotter.py +146 -0
  51. octopusv-0.2.0/src/octopusv/ploter/size_plotter.py +90 -0
  52. octopusv-0.2.0/src/octopusv/ploter/type_plotter.py +121 -0
  53. octopusv-0.2.0/src/octopusv/py.typed +0 -0
  54. octopusv-0.2.0/src/octopusv/report/generator.py +88 -0
  55. octopusv-0.2.0/src/octopusv/report/image2base.py +0 -0
  56. octopusv-0.2.0/src/octopusv/report/logo.png +0 -0
  57. octopusv-0.2.0/src/octopusv/report/template.html +677 -0
  58. octopusv-0.2.0/src/octopusv/stater/__init__.py +0 -0
  59. octopusv-0.2.0/src/octopusv/stater/chromosome_analyzer.py +28 -0
  60. octopusv-0.2.0/src/octopusv/stater/genotype_analyzer.py +289 -0
  61. octopusv-0.2.0/src/octopusv/stater/qc_analyzer.py +128 -0
  62. octopusv-0.2.0/src/octopusv/stater/size_analyzer.py +57 -0
  63. octopusv-0.2.0/src/octopusv/stater/sv_stater.py +255 -0
  64. octopusv-0.2.0/src/octopusv/stater/type_analyzer.py +24 -0
  65. octopusv-0.2.0/src/octopusv/sv.py +117 -0
  66. octopusv-0.2.0/src/octopusv/transformer/__init__.py +0 -0
  67. octopusv-0.2.0/src/octopusv/transformer/base.py +13 -0
  68. octopusv-0.2.0/src/octopusv/transformer/mp_bnd.py +14 -0
  69. octopusv-0.2.0/src/octopusv/transformer/no_bnd.py +16 -0
  70. octopusv-0.2.0/src/octopusv/transformer/same_chr_sv.py +44 -0
  71. octopusv-0.2.0/src/octopusv/transformer/snmd_bndp.py +14 -0
  72. octopusv-0.2.0/src/octopusv/transformer/stra.py +11 -0
  73. octopusv-0.2.0/src/octopusv/utils/SV_classifier_by_chromosome.py +95 -0
  74. octopusv-0.2.0/src/octopusv/utils/SV_classifier_by_type.py +34 -0
  75. octopusv-0.2.0/src/octopusv/utils/__init__.py +0 -0
  76. octopusv-0.2.0/src/octopusv/utils/construct_sample_string.py +42 -0
  77. octopusv-0.2.0/src/octopusv/utils/normal_vcf_parser.py +126 -0
  78. octopusv-0.2.0/src/octopusv/utils/svcf_parser.py +210 -0
  79. octopusv-0.2.0/src/octopusv/utils/svcf_utils.py +51 -0
  80. octopusv-0.2.0/src/octopusv/vis/__init__.py +1 -0
octopusv-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Yangyang Li and Qingxiang Guo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.1
2
+ Name: OctopuSV
3
+ Version: 0.2.0
4
+ Summary: OctopuSV: Advanced Structural Variant Analysis Toolkit
5
+ License: MIT
6
+ Author: Qingxiang Guo
7
+ Author-email: qingxiang.guo@northwestern.edu
8
+ Requires-Python: >=3.10,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: jinja2 (>=3.1.5,<4.0.0)
15
+ Requires-Dist: loguru (>=0.7.2,<0.8.0)
16
+ Requires-Dist: matplotlib (>=3.9.2,<4.0.0)
17
+ Requires-Dist: natsort (>=8.4.0,<9.0.0)
18
+ Requires-Dist: pytest-cov (>=4.1.0,<5.0.0)
19
+ Requires-Dist: rich (>=13.7.1,<14.0.0)
20
+ Requires-Dist: seaborn (>=0.13.2,<0.14.0)
21
+ Requires-Dist: typer (>=0.12.3,<0.13.0)
22
+ Description-Content-Type: text/markdown
23
+
24
+ # OctopuSV: Advanced structural variant analysis toolkit 🐙
25
+
26
+ <p align="center">
27
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/logo.png" width="40%" height="40%">
28
+ </p>
29
+
30
+ [![PyPI version](https://badge.fury.io/py/octopusv.svg)](https://badge.fury.io/py/octopusv)
31
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
32
+
33
+ **OctopuSV** is a high-performance structural variant (SV) analysis toolkit designed to standardize ambiguous SV annotations (e.g., BNDs), flexibly integrate multiple callers across samples or platforms, and benchmark results against trusted truth sets. With support for both **single-sample** and **multi-sample** workflows, OctopuSV enables robust and scalable SV comparison, correction, and visualization in real or simulated genomic datasets.
34
+
35
+ ## Key Features
36
+
37
+ * **BND Correction**: Converts ambiguous breakend (BND) records into canonical SV types (DEL, INV, DUP, TRA), with translocation subtype classification
38
+ * **Flexible Multi-sample Merging**: Boolean logic-based merge of SVs across multiple samples or callers
39
+ * **Multi-caller & Multi-platform Integration**: Works seamlessly across Illumina, PacBio, ONT callers like Manta, LUMPY, SvABA, DELLY, PBSV, Sniffles, etc.
40
+ * **Benchmarking**: Compare SVs to truth sets with precision/recall/F1 metrics using GIAB-style evaluation
41
+ * **Statistical Summaries**: Profile SV distribution, quality, and size
42
+ * **Publication-ready Visualizations**: Output interactive HTML reports and static plots
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install octopusv
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ ### 1. Correct Ambiguous BND Annotations
55
+
56
+ ```bash
57
+ # Basic correction
58
+ octopusv correct input.vcf output.vcf
59
+
60
+ # With position tolerance control
61
+ octopusv correct -i input.vcf -o output.vcf --pos-tolerance 5
62
+
63
+ # Apply quality filters
64
+ octopusv correct -i input.vcf -o output.vcf --min-svlen 50 --max-svlen 100000 --filter-pass
65
+ ```
66
+
67
+ ### 2. Merge SV Calls (Multi-caller or Multi-sample)
68
+
69
+ ```bash
70
+ # Merge across callers from same sample
71
+ octopusv merge -i manta.svcf lumpy.svcf -o merged.svcf --mode caller --caller-names Manta,LUMPY --intersect
72
+
73
+ # Merge across samples
74
+ octopusv merge -i sample1.svcf sample2.svcf sample3.svcf \
75
+ --mode sample --sample-names HG001,HG002,HG003 \
76
+ --min-support 2 -o shared.svcf
77
+
78
+ # Complex logic: A AND B but not C
79
+ octopusv merge -i A.svcf B.svcf C.svcf \
80
+ --expression "(A AND B) AND NOT C" -o result.svcf
81
+
82
+ # Generate UpSet plot
83
+ octopusv merge -i a.svcf b.svcf c.svcf -o merged.svcf --intersect --upsetr --upsetr-output intersection.png
84
+ ```
85
+
86
+ <p align="center">
87
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/up_upset.png" width="70%" height="70%">
88
+ </p>
89
+
90
+ ### 3. Benchmark Against Truth Sets
91
+
92
+ ```bash
93
+ octopusv benchmark truth.vcf calls.svcf \
94
+ -o benchmark_results \
95
+ --reference-distance 500 \
96
+ --size-similarity 0.7 \
97
+ --reciprocal-overlap 0.0 \
98
+ --size-min 50 --size-max 50000
99
+ ```
100
+
101
+ ### 4. Generate Statistics and Visualizations
102
+
103
+ ```bash
104
+ # Basic stat collection
105
+ octopusv stat -i input.svcf -o stats.txt
106
+
107
+ # Add HTML report
108
+ octopusv stat -i input.svcf -o stats.txt --report
109
+
110
+ # Plot figures from stats
111
+ octopusv plot stats.txt -o figure_prefix
112
+ ```
113
+
114
+ The `--report` flag outputs an interactive HTML report:
115
+
116
+ * SV type and size distributions
117
+ * Chromosome breakdowns
118
+ * Quality score summaries
119
+ * Genotype and depth features
120
+
121
+ <p align="center">
122
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/html_example.png" width="70%" height="70%">
123
+ </p>
124
+
125
+ ### 5. Format Conversion
126
+
127
+ ```bash
128
+ # To BED
129
+ octopusv svcf2bed -i input.svcf -o output.bed
130
+
131
+ # To BEDPE
132
+ octopusv svcf2bedpe -i input.svcf -o output.bedpe
133
+
134
+ # To standard VCF
135
+ octopusv svcf2vcf -i input.svcf -o output.vcf
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Example Visualizations
141
+
142
+ OctopusV generates publication-ready visualizations:
143
+
144
+ ### Chromosome Distribution
145
+
146
+ <p align="center">
147
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/chromosome_distribution.png" width="50%" height="50%">
148
+ </p>
149
+
150
+ ### SV Type Distribution
151
+
152
+ <p align="center">
153
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/sv_types.png" width="50%" height="50%">
154
+ </p>
155
+
156
+ ### SV Size Distribution
157
+
158
+ <p align="center">
159
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/sv_sizes.png" width="50%" height="50%">
160
+ </p>
161
+
162
+ ---
163
+
164
+ ## Application Scenarios
165
+
166
+ OctopuSV was developed to address several practical needs in SV research:
167
+
168
+ * Standardizing SVs with ambiguous BND notations
169
+ * Enabling precise cohort-level comparisons (multi-sample mode)
170
+ * Supporting accurate benchmarking with real/simulated truth sets
171
+ * Integrating and comparing SVs across platforms (e.g., Illumina + ONT)
172
+ * Automating large-scale SV analysis workflows (via TentacleSV)
173
+
174
+ See the companion pipeline: [TentacleSV](https://github.com/ylab-hi/TentacleSV)
175
+
176
+ ---
177
+
178
+ ## 🧪 Citation
179
+
180
+ If you use **OctopuSV**, please cite:
181
+
182
+ > Guo Q, Li Y, Wang T, Ramakrishnan A, Yang R. *OctopuSV and TentacleSV: a one-stop toolkit for multi-sample, cross-platform structural variant comparison and analysis*. bioRxiv. 2025. doi: [10.1101/2025.03.24.645012](https://doi.org/10.1101/2025.03.24.645012)
183
+
184
+ ```bibtex
185
+ @article{guo2025octopusv,
186
+ title={OctopuSV and TentacleSV: a one-stop toolkit for multi-sample, cross-platform structural variant comparison and analysis},
187
+ author={Guo, Qingxiang and Li, Yangyang and Wang, Tingyou and Ramakrishnan, Abhi and Yang, Rendong},
188
+ journal={bioRxiv},
189
+ year={2025},
190
+ publisher={Cold Spring Harbor Laboratory},
191
+ doi={10.1101/2025.03.24.645012},
192
+ url={https://www.biorxiv.org/content/10.1101/2025.03.24.645012v1}
193
+ }
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Contributing
199
+
200
+ We welcome issues, suggestions, and pull requests!
201
+
202
+ ```bash
203
+ git clone https://github.com/ylab-hi/OctopuSV.git
204
+ cd OctopuSV
205
+ poetry install
206
+ pre-commit run -a
207
+ ```
208
+
209
+ ## Contact
210
+
211
+ * GitHub Issues: [https://github.com/ylab-hi/octopusV/issues](https://github.com/ylab-hi/octopusV/issues)
212
+ * Email: [qingxiang.guo@northwestern.edu](mailto:qingxiang.guo@northwestern.edu)
213
+ * Email: [yangyang.li@northwestern.edu](mailto:yangyang.li@northwestern.edu)
214
+
@@ -0,0 +1,190 @@
1
+ # OctopuSV: Advanced structural variant analysis toolkit 🐙
2
+
3
+ <p align="center">
4
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/logo.png" width="40%" height="40%">
5
+ </p>
6
+
7
+ [![PyPI version](https://badge.fury.io/py/octopusv.svg)](https://badge.fury.io/py/octopusv)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ **OctopuSV** is a high-performance structural variant (SV) analysis toolkit designed to standardize ambiguous SV annotations (e.g., BNDs), flexibly integrate multiple callers across samples or platforms, and benchmark results against trusted truth sets. With support for both **single-sample** and **multi-sample** workflows, OctopuSV enables robust and scalable SV comparison, correction, and visualization in real or simulated genomic datasets.
11
+
12
+ ## Key Features
13
+
14
+ * **BND Correction**: Converts ambiguous breakend (BND) records into canonical SV types (DEL, INV, DUP, TRA), with translocation subtype classification
15
+ * **Flexible Multi-sample Merging**: Boolean logic-based merge of SVs across multiple samples or callers
16
+ * **Multi-caller & Multi-platform Integration**: Works seamlessly across Illumina, PacBio, ONT callers like Manta, LUMPY, SvABA, DELLY, PBSV, Sniffles, etc.
17
+ * **Benchmarking**: Compare SVs to truth sets with precision/recall/F1 metrics using GIAB-style evaluation
18
+ * **Statistical Summaries**: Profile SV distribution, quality, and size
19
+ * **Publication-ready Visualizations**: Output interactive HTML reports and static plots
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install octopusv
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Quick Start
30
+
31
+ ### 1. Correct Ambiguous BND Annotations
32
+
33
+ ```bash
34
+ # Basic correction
35
+ octopusv correct input.vcf output.vcf
36
+
37
+ # With position tolerance control
38
+ octopusv correct -i input.vcf -o output.vcf --pos-tolerance 5
39
+
40
+ # Apply quality filters
41
+ octopusv correct -i input.vcf -o output.vcf --min-svlen 50 --max-svlen 100000 --filter-pass
42
+ ```
43
+
44
+ ### 2. Merge SV Calls (Multi-caller or Multi-sample)
45
+
46
+ ```bash
47
+ # Merge across callers from same sample
48
+ octopusv merge -i manta.svcf lumpy.svcf -o merged.svcf --mode caller --caller-names Manta,LUMPY --intersect
49
+
50
+ # Merge across samples
51
+ octopusv merge -i sample1.svcf sample2.svcf sample3.svcf \
52
+ --mode sample --sample-names HG001,HG002,HG003 \
53
+ --min-support 2 -o shared.svcf
54
+
55
+ # Complex logic: A AND B but not C
56
+ octopusv merge -i A.svcf B.svcf C.svcf \
57
+ --expression "(A AND B) AND NOT C" -o result.svcf
58
+
59
+ # Generate UpSet plot
60
+ octopusv merge -i a.svcf b.svcf c.svcf -o merged.svcf --intersect --upsetr --upsetr-output intersection.png
61
+ ```
62
+
63
+ <p align="center">
64
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/up_upset.png" width="70%" height="70%">
65
+ </p>
66
+
67
+ ### 3. Benchmark Against Truth Sets
68
+
69
+ ```bash
70
+ octopusv benchmark truth.vcf calls.svcf \
71
+ -o benchmark_results \
72
+ --reference-distance 500 \
73
+ --size-similarity 0.7 \
74
+ --reciprocal-overlap 0.0 \
75
+ --size-min 50 --size-max 50000
76
+ ```
77
+
78
+ ### 4. Generate Statistics and Visualizations
79
+
80
+ ```bash
81
+ # Basic stat collection
82
+ octopusv stat -i input.svcf -o stats.txt
83
+
84
+ # Add HTML report
85
+ octopusv stat -i input.svcf -o stats.txt --report
86
+
87
+ # Plot figures from stats
88
+ octopusv plot stats.txt -o figure_prefix
89
+ ```
90
+
91
+ The `--report` flag outputs an interactive HTML report:
92
+
93
+ * SV type and size distributions
94
+ * Chromosome breakdowns
95
+ * Quality score summaries
96
+ * Genotype and depth features
97
+
98
+ <p align="center">
99
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/html_example.png" width="70%" height="70%">
100
+ </p>
101
+
102
+ ### 5. Format Conversion
103
+
104
+ ```bash
105
+ # To BED
106
+ octopusv svcf2bed -i input.svcf -o output.bed
107
+
108
+ # To BEDPE
109
+ octopusv svcf2bedpe -i input.svcf -o output.bedpe
110
+
111
+ # To standard VCF
112
+ octopusv svcf2vcf -i input.svcf -o output.vcf
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Example Visualizations
118
+
119
+ OctopusV generates publication-ready visualizations:
120
+
121
+ ### Chromosome Distribution
122
+
123
+ <p align="center">
124
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/chromosome_distribution.png" width="50%" height="50%">
125
+ </p>
126
+
127
+ ### SV Type Distribution
128
+
129
+ <p align="center">
130
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/sv_types.png" width="50%" height="50%">
131
+ </p>
132
+
133
+ ### SV Size Distribution
134
+
135
+ <p align="center">
136
+ <img src="https://github.com/ylab-hi/octopusV/blob/main/imgs/sv_sizes.png" width="50%" height="50%">
137
+ </p>
138
+
139
+ ---
140
+
141
+ ## Application Scenarios
142
+
143
+ OctopuSV was developed to address several practical needs in SV research:
144
+
145
+ * Standardizing SVs with ambiguous BND notations
146
+ * Enabling precise cohort-level comparisons (multi-sample mode)
147
+ * Supporting accurate benchmarking with real/simulated truth sets
148
+ * Integrating and comparing SVs across platforms (e.g., Illumina + ONT)
149
+ * Automating large-scale SV analysis workflows (via TentacleSV)
150
+
151
+ See the companion pipeline: [TentacleSV](https://github.com/ylab-hi/TentacleSV)
152
+
153
+ ---
154
+
155
+ ## 🧪 Citation
156
+
157
+ If you use **OctopuSV**, please cite:
158
+
159
+ > Guo Q, Li Y, Wang T, Ramakrishnan A, Yang R. *OctopuSV and TentacleSV: a one-stop toolkit for multi-sample, cross-platform structural variant comparison and analysis*. bioRxiv. 2025. doi: [10.1101/2025.03.24.645012](https://doi.org/10.1101/2025.03.24.645012)
160
+
161
+ ```bibtex
162
+ @article{guo2025octopusv,
163
+ title={OctopuSV and TentacleSV: a one-stop toolkit for multi-sample, cross-platform structural variant comparison and analysis},
164
+ author={Guo, Qingxiang and Li, Yangyang and Wang, Tingyou and Ramakrishnan, Abhi and Yang, Rendong},
165
+ journal={bioRxiv},
166
+ year={2025},
167
+ publisher={Cold Spring Harbor Laboratory},
168
+ doi={10.1101/2025.03.24.645012},
169
+ url={https://www.biorxiv.org/content/10.1101/2025.03.24.645012v1}
170
+ }
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Contributing
176
+
177
+ We welcome issues, suggestions, and pull requests!
178
+
179
+ ```bash
180
+ git clone https://github.com/ylab-hi/OctopuSV.git
181
+ cd OctopuSV
182
+ poetry install
183
+ pre-commit run -a
184
+ ```
185
+
186
+ ## Contact
187
+
188
+ * GitHub Issues: [https://github.com/ylab-hi/octopusV/issues](https://github.com/ylab-hi/octopusV/issues)
189
+ * Email: [qingxiang.guo@northwestern.edu](mailto:qingxiang.guo@northwestern.edu)
190
+ * Email: [yangyang.li@northwestern.edu](mailto:yangyang.li@northwestern.edu)
@@ -0,0 +1,185 @@
1
+ [tool.poetry]
2
+ name = "OctopuSV"
3
+ version = "0.2.0"
4
+ description = "OctopuSV: Advanced Structural Variant Analysis Toolkit"
5
+ authors = [
6
+ "Qingxiang Guo <qingxiang.guo@northwestern.edu>",
7
+ "Yangyang Li <yangyang.li@northwestern.edu>",
8
+ ]
9
+ license = "MIT"
10
+ readme = "README.md"
11
+
12
+ [tool.poetry.dependencies]
13
+ python = "^3.10"
14
+ typer = "^0.12.3"
15
+ loguru = "^0.7.2"
16
+ rich = "^13.7.1"
17
+ natsort = "^8.4.0"
18
+ pytest-cov = "^4.1.0"
19
+ matplotlib = "^3.9.2"
20
+ seaborn = "^0.13.2"
21
+ jinja2 = "^3.1.5"
22
+
23
+
24
+ [tool.poetry.scripts]
25
+ octopusv = "octopusv.cli.cli:app"
26
+
27
+ [tool.poetry.group.dev.dependencies]
28
+ pytest-sugar = "^1.0.0"
29
+ pytest = "^8.0.2"
30
+ ruff = "^0.7.0"
31
+ ipdb = "^0.13.13"
32
+ mypy = "^1.10.0"
33
+
34
+
35
+ [tool.ruff]
36
+ target-version = "py310"
37
+ line-length = 120
38
+ fix = true
39
+ exclude = [
40
+ "tasks.py",
41
+ "tests/*",
42
+ "build.py",
43
+ "scripts/*",
44
+ "noxfile.py",
45
+ "docs/conf.py",
46
+
47
+
48
+ ".bzr",
49
+ ".direnv",
50
+ ".eggs",
51
+ ".git",
52
+ ".git-rewrite",
53
+ ".hg",
54
+ ".mypy_cache",
55
+ ".nox",
56
+ ".pants.d",
57
+ ".pytype",
58
+ ".ruff_cache",
59
+ ".svn",
60
+ ".tox",
61
+ ".venv",
62
+ "__pypackages__",
63
+ "_build",
64
+ "buck-out",
65
+ "build",
66
+ "dist",
67
+ "node_modules",
68
+ "venv",
69
+ ]
70
+
71
+ [tool.ruff.lint]
72
+ select = [
73
+ "ANN",
74
+ "D",
75
+ "A",
76
+ "F",
77
+ "E",
78
+ "W",
79
+ "C90",
80
+ "I",
81
+ "UP",
82
+ "N",
83
+ "YTT",
84
+ "TID",
85
+ "S",
86
+ "BLE",
87
+ "FBT",
88
+ "PLR",
89
+ "B",
90
+ "B9",
91
+ "A",
92
+ "C4",
93
+ "T10",
94
+ "EM",
95
+ "ICN",
96
+ "T20",
97
+ "Q",
98
+ "RET",
99
+ "SIM",
100
+ "ARG",
101
+ "DTZ",
102
+ "ERA",
103
+ "PD",
104
+ "PGH",
105
+ "PLC",
106
+ "PLE",
107
+ "PLW",
108
+ "RUF",
109
+ "PL",
110
+ "TD",
111
+ "FIX",
112
+ "PTH",
113
+ "TCH",
114
+ "SLOT",
115
+ "PT",
116
+ "PYI",
117
+ "PIE",
118
+ "ISC",
119
+ "FA",
120
+ "EXE",
121
+ # "CPY",
122
+ "COM",
123
+ "SIM",
124
+ ]
125
+ ignore = [
126
+ "E501",
127
+ "D203",
128
+ "D100",
129
+ "D401",
130
+ "ANN101",
131
+ "ANN102",
132
+ "ANN001",
133
+ "ANN002",
134
+ "ANN003",
135
+ "ANN201",
136
+ "ANN202",
137
+ "ANN204",
138
+ "ANN205",
139
+ "ANN206",
140
+ "PGH003",
141
+ "N802",
142
+ "N803",
143
+ "N806",
144
+ "N815",
145
+ "EM101",
146
+ # formater conflict
147
+ 'COM812',
148
+ 'COM819',
149
+ 'D206',
150
+ 'ISC001',
151
+ 'Q000',
152
+ 'Q001',
153
+ 'Q002',
154
+ 'Q003',
155
+ 'W191',
156
+ ]
157
+
158
+ [tool.ruff.format]
159
+ # Like Black, use double quotes for strings.
160
+ quote-style = "double"
161
+
162
+ # Like Black, indent with spaces, rather than tabs.
163
+ indent-style = "space"
164
+
165
+ # Like Black, respect magic trailing commas.
166
+ # magic-trailing-comma = "respect"
167
+
168
+ # Like Black, automatically detect the appropriate line ending.
169
+ line-ending = "auto"
170
+
171
+ [tool.ruff.lint.flake8-bugbear]
172
+ extend-immutable-calls = ["chr", "typer.Argument", "typer.Option"]
173
+
174
+ [tool.ruff.lint.flake8-annotations]
175
+ allow-star-arg-any = true
176
+
177
+ [tool.ruff.lint.per-file-ignores]
178
+
179
+ [tool.ruff.lint.pydocstyle]
180
+ convention = 'google'
181
+
182
+
183
+ [build-system]
184
+ requires = ["poetry-core"]
185
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,4 @@
1
+ """Top-level package for OctopusV."""
2
+
3
+ __version__ = "0.1.0"
4
+ __PACKAGE_NAME__ = "octopusv"
@@ -0,0 +1,3 @@
1
+ from .cli.cli import app
2
+
3
+ app()
File without changes
@@ -0,0 +1,39 @@
1
+ import json
2
+ from pathlib import Path
3
+
4
+
5
+ def calculate_metrics(results: dict[str, list]):
6
+ """Calculate benchmark metrics including precision, recall, and F1 score."""
7
+ tp = len(results["tp_call"])
8
+ fp = len(results["fp"])
9
+ fn = len(results["fn"])
10
+
11
+ precision = tp / (tp + fp) if tp + fp > 0 else 0
12
+ recall = tp / (tp + fn) if tp + fn > 0 else 0
13
+ f1 = 2 * (precision * recall) / (precision + recall) if precision + recall > 0 else 0
14
+
15
+ return {"TP": tp, "FP": fp, "FN": fn, "Precision": precision, "Recall": recall, "F1": f1}
16
+
17
+
18
+ def write_vcf(file_path: Path, events: list[tuple | object]):
19
+ """Write events to VCF format file."""
20
+ with file_path.open("w") as f:
21
+ f.write("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n")
22
+ for event in events:
23
+ if isinstance(event, tuple): # TRA event
24
+ chrom, start_chrom, end_chrom, start_pos, end_pos, source_file, bnd_pattern = event
25
+ f.write(
26
+ f"{start_chrom}\t{start_pos}\t.\tN\t{bnd_pattern}\t.\tPASS\t"
27
+ f"SVTYPE=TRA;END={end_pos};CHR2={end_chrom};SOURCES={source_file}\n"
28
+ )
29
+ else: # Other SV events
30
+ f.write(
31
+ f"{event.chrom}\t{event.pos}\t{event.sv_id}\t{event.ref}\t{event.alt}\t"
32
+ f"{event.quality}\t{event.filter}\t{';'.join(f'{k}={v}' for k, v in event.info.items())}\n"
33
+ )
34
+
35
+
36
+ def write_summary(file_path: Path, metrics: dict):
37
+ """Write benchmark summary metrics to JSON file."""
38
+ with file_path.open("w") as f:
39
+ json.dump(metrics, f, indent=2)