OpenSpliceai 0.0.6__tar.gz → 0.0.7__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.
- {openspliceai-0.0.6/openspliceai.egg-info → openspliceai-0.0.7}/PKG-INFO +28 -6
- {openspliceai-0.0.6 → openspliceai-0.0.7}/README.md +13 -2
- openspliceai-0.0.7/openspliceai/__init__.py +1 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/header.py +2 -2
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/openspliceai.py +4 -1
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/predict/predict.py +53 -12
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/train_base/utils.py +2 -2
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/variant/utils.py +197 -3
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/variant/variant.py +29 -6
- {openspliceai-0.0.6 → openspliceai-0.0.7/openspliceai.egg-info}/PKG-INFO +28 -6
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai.egg-info/requires.txt +0 -3
- {openspliceai-0.0.6 → openspliceai-0.0.7}/setup.py +16 -5
- openspliceai-0.0.6/openspliceai/__init__.py +0 -1
- {openspliceai-0.0.6 → openspliceai-0.0.7}/LICENSE +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/MANIFEST.in +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/logo/jhu-logo-dark.png +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/logo/logo_black.png +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/logo/logo_white.png +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/calibrate.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/calibrate_utils.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/model_utils.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/temperature_scaling.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/temperature_scaling_site_only.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/visualization.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/constants.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/create_datafile.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/create_dataset.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/gff_to_tsv.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/paralogs.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/utils.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/create_data/verify_h5_file.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/merge_data/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/merge_data/merge_dataset.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/predict/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/predict/utils.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/test/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/test/test.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/train/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/train/train.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/train_base/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/train_base/openspliceai.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/transfer/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/transfer/transfer.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/variant/__init__.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/variant/annotations/grch37.txt +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/variant/annotations/grch38.txt +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/variant/get_anno.py +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai.egg-info/SOURCES.txt +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai.egg-info/dependency_links.txt +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai.egg-info/entry_points.txt +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai.egg-info/top_level.txt +0 -0
- {openspliceai-0.0.6 → openspliceai-0.0.7}/setup.cfg +0 -0
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openspliceai
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: Deep learning framework that decodes splicing across species
|
|
5
5
|
Home-page: https://github.com/Kuanhao-Chao/OpenSpliceAI
|
|
6
6
|
Author: Kuan-Hao Chao
|
|
7
7
|
Author-email: kh.chao@cs.jhu.edu
|
|
8
|
+
License: GPL-3.0-only
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
8
20
|
Requires-Python: >=3.9
|
|
9
21
|
Description-Content-Type: text/markdown
|
|
10
22
|
License-File: LICENSE
|
|
@@ -16,12 +28,9 @@ Requires-Dist: pandas>=1.5.3
|
|
|
16
28
|
Requires-Dist: pyfaidx>=0.8.1.1
|
|
17
29
|
Requires-Dist: tqdm>=4.65.2
|
|
18
30
|
Requires-Dist: torch>=2.2.1
|
|
19
|
-
Requires-Dist: torchaudio>=2.2.1
|
|
20
|
-
Requires-Dist: torchvision>=0.17.1
|
|
21
31
|
Requires-Dist: scikit-learn>=1.4.1.post1
|
|
22
32
|
Requires-Dist: biopython>=1.83
|
|
23
33
|
Requires-Dist: matplotlib>=3.8.3
|
|
24
|
-
Requires-Dist: matplotlib-inline>=0.1.7
|
|
25
34
|
Requires-Dist: psutil>=5.9.2
|
|
26
35
|
Requires-Dist: mappy>=2.28
|
|
27
36
|
Provides-Extra: test
|
|
@@ -34,9 +43,11 @@ Requires-Dist: ruff>=0.4; extra == "dev"
|
|
|
34
43
|
Requires-Dist: pre-commit>=3; extra == "dev"
|
|
35
44
|
Dynamic: author
|
|
36
45
|
Dynamic: author-email
|
|
46
|
+
Dynamic: classifier
|
|
37
47
|
Dynamic: description
|
|
38
48
|
Dynamic: description-content-type
|
|
39
49
|
Dynamic: home-page
|
|
50
|
+
Dynamic: license
|
|
40
51
|
Dynamic: license-file
|
|
41
52
|
Dynamic: provides-extra
|
|
42
53
|
Dynamic: requires-dist
|
|
@@ -52,7 +63,7 @@ Dynamic: summary
|
|
|
52
63
|
|
|
53
64
|
|
|
54
65
|
<a class="reference external image-reference" href="https://img.shields.io/badge/License-GPLv3-yellow.svg"><img alt="https://img.shields.io/badge/License-GPLv3-yellow.svg" src="https://img.shields.io/badge/License-GPLv3-yellow.svg"></a>
|
|
55
|
-
<a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.
|
|
66
|
+
<a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.7-blue"><img alt="https://img.shields.io/badge/version-v.0.0.7-blue" src="https://img.shields.io/badge/version-v.0.0.7-blue"></a>
|
|
56
67
|
<a class="reference external image-reference" href="https://pepy.tech/project/openspliceai"><img alt="https://static.pepy.tech/personalized-badge/openspliceai?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=PyPi%20downloads" src="https://static.pepy.tech/personalized-badge/openspliceai?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=PyPi%20downloads"></a>
|
|
57
68
|
<a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&logo=github&label=Download" src="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&logo=github&label=Download"></a>
|
|
58
69
|
<a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/badge/platform-macOS_/Linux-green.svg" src="https://img.shields.io/badge/platform-macOS_/Linux-green.svg"></a>
|
|
@@ -109,6 +120,17 @@ Annotates VCF files with delta scores and positions to evaluate the impact of ge
|
|
|
109
120
|
<div class="line"><br></div>
|
|
110
121
|
</div>
|
|
111
122
|
</section>
|
|
123
|
+
<section id="installation">
|
|
124
|
+
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">#</a></h1>
|
|
125
|
+
<p>Install the latest release from <strong>PyPI</strong>:</p>
|
|
126
|
+
<pre><code>pip install openspliceai</code></pre>
|
|
127
|
+
<p>or from <strong>Bioconda</strong> (make sure the <code>conda-forge</code> and <code>bioconda</code> channels are enabled):</p>
|
|
128
|
+
<pre><code>conda install -c conda-forge -c bioconda openspliceai</code></pre>
|
|
129
|
+
<p>See the <a class="reference external" href="https://ccb.jhu.edu/openspliceai/content/installation.html#installation">Installation Guide</a> for GPU/CUDA setup and other options.</p>
|
|
130
|
+
<div class="line-block">
|
|
131
|
+
<div class="line"><br></div>
|
|
132
|
+
</div>
|
|
133
|
+
</section>
|
|
112
134
|
<section id="cite-us">
|
|
113
135
|
<h1>Cite Us<a class="headerlink" href="#cite-us" title="Permalink to this heading">#</a></h1>
|
|
114
136
|
<p>If you use OpenSpliceAI in your research, please cite our work as well as the original SpliceAI paper:</p>
|
|
@@ -270,6 +292,6 @@ pre-commit install # run ruff + checks on every commit</code></pre>
|
|
|
270
292
|
<div class="line"><br></div>
|
|
271
293
|
</div>
|
|
272
294
|
<p align="center">
|
|
273
|
-
<img alt="Johns Hopkins University" src="logo/jhu-logo-dark.png" width="40%">
|
|
295
|
+
<img alt="Johns Hopkins University" src="https://raw.githubusercontent.com/Kuanhao-Chao/OpenSpliceAI/main/logo/jhu-logo-dark.png" width="40%">
|
|
274
296
|
</p>
|
|
275
297
|
</section>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
<a class="reference external image-reference" href="https://img.shields.io/badge/License-GPLv3-yellow.svg"><img alt="https://img.shields.io/badge/License-GPLv3-yellow.svg" src="https://img.shields.io/badge/License-GPLv3-yellow.svg"></a>
|
|
10
|
-
<a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.
|
|
10
|
+
<a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.7-blue"><img alt="https://img.shields.io/badge/version-v.0.0.7-blue" src="https://img.shields.io/badge/version-v.0.0.7-blue"></a>
|
|
11
11
|
<a class="reference external image-reference" href="https://pepy.tech/project/openspliceai"><img alt="https://static.pepy.tech/personalized-badge/openspliceai?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=PyPi%20downloads" src="https://static.pepy.tech/personalized-badge/openspliceai?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=PyPi%20downloads"></a>
|
|
12
12
|
<a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&logo=github&label=Download" src="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&logo=github&label=Download"></a>
|
|
13
13
|
<a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/badge/platform-macOS_/Linux-green.svg" src="https://img.shields.io/badge/platform-macOS_/Linux-green.svg"></a>
|
|
@@ -64,6 +64,17 @@ Annotates VCF files with delta scores and positions to evaluate the impact of ge
|
|
|
64
64
|
<div class="line"><br></div>
|
|
65
65
|
</div>
|
|
66
66
|
</section>
|
|
67
|
+
<section id="installation">
|
|
68
|
+
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">#</a></h1>
|
|
69
|
+
<p>Install the latest release from <strong>PyPI</strong>:</p>
|
|
70
|
+
<pre><code>pip install openspliceai</code></pre>
|
|
71
|
+
<p>or from <strong>Bioconda</strong> (make sure the <code>conda-forge</code> and <code>bioconda</code> channels are enabled):</p>
|
|
72
|
+
<pre><code>conda install -c conda-forge -c bioconda openspliceai</code></pre>
|
|
73
|
+
<p>See the <a class="reference external" href="https://ccb.jhu.edu/openspliceai/content/installation.html#installation">Installation Guide</a> for GPU/CUDA setup and other options.</p>
|
|
74
|
+
<div class="line-block">
|
|
75
|
+
<div class="line"><br></div>
|
|
76
|
+
</div>
|
|
77
|
+
</section>
|
|
67
78
|
<section id="cite-us">
|
|
68
79
|
<h1>Cite Us<a class="headerlink" href="#cite-us" title="Permalink to this heading">#</a></h1>
|
|
69
80
|
<p>If you use OpenSpliceAI in your research, please cite our work as well as the original SpliceAI paper:</p>
|
|
@@ -225,6 +236,6 @@ pre-commit install # run ruff + checks on every commit</code></pre>
|
|
|
225
236
|
<div class="line"><br></div>
|
|
226
237
|
</div>
|
|
227
238
|
<p align="center">
|
|
228
|
-
<img alt="Johns Hopkins University" src="logo/jhu-logo-dark.png" width="40%">
|
|
239
|
+
<img alt="Johns Hopkins University" src="https://raw.githubusercontent.com/Kuanhao-Chao/OpenSpliceAI/main/logo/jhu-logo-dark.png" width="40%">
|
|
229
240
|
</p>
|
|
230
241
|
</section>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = 'v0.0.7'
|
|
@@ -2,10 +2,10 @@ __author__ = "Kuan-Hao Chao"
|
|
|
2
2
|
__contact__ = "kuanhao.chao@gmail.com"
|
|
3
3
|
__copyright__ = "Copyright 2025, Kuan-Hao Chao, Alan Mao"
|
|
4
4
|
__credits__ = ["Kuan-Hao Chao", "Alan Mao"]
|
|
5
|
-
__date__ = "
|
|
5
|
+
__date__ = "2026/06/23"
|
|
6
6
|
__deprecated__ = False
|
|
7
7
|
__email__ = "kuanhao.chao@gmail.com"
|
|
8
8
|
__license__ = "GPL-3.0"
|
|
9
9
|
__maintainer__ = "developer"
|
|
10
10
|
__status__ = "Kuan-Hao Chao"
|
|
11
|
-
__version__ = "0.0.
|
|
11
|
+
__version__ = "0.0.7"
|
|
@@ -118,6 +118,7 @@ def parse_args_predict(subparsers):
|
|
|
118
118
|
parser_predict.add_argument('--flanking-size', '-f', type=int, required=True, choices=[80, 400, 2000, 10000], help='Sum of flanking sequence lengths on each side of input (i.e. 40+40)')
|
|
119
119
|
parser_predict.add_argument('--output-dir', '-o', type=str, default="./predict_out", help='Output directory to save the data')
|
|
120
120
|
parser_predict.add_argument('--annotation-file', '-a', type=str, required=False, help="Path to GFF file of coordinates for genes")
|
|
121
|
+
parser_predict.add_argument('--gene-flank', type=int, default=-1, help="With -a/--annotation: bp of REAL genomic flanking sequence to include on each side of every extracted gene so the model sees true context instead of 'N' padding at gene boundaries. Default (-1) uses flanking_size/2 (the model's required context); set 0 to extract the bare gene body (legacy behavior).")
|
|
121
122
|
parser_predict.add_argument('--threshold', '-t', type=float, default=1e-6, help="Threshold to determine acceptor and donor sites")
|
|
122
123
|
parser_predict.add_argument('--predict-all', '-p', action='store_true', required=False, help="Writes all collected predictions to an intermediate file (Warning: on full genomes, will consume much space.)")
|
|
123
124
|
parser_predict.add_argument('--debug', '-D', action='store_true', required=False, help="Run in debug mode (debug statements are printed to stderr)")
|
|
@@ -148,7 +149,9 @@ def parse_args_variant(subparsers):
|
|
|
148
149
|
parser_variant.add_argument('--flanking-size', '-f', type=int, default=80, choices=[80, 400, 2000, 10000], help='Sum of flanking sequence lengths on each side of input (i.e. 40+40)')
|
|
149
150
|
parser_variant.add_argument('--model-type', '-t', type=str, choices=['keras', 'pytorch'], default='pytorch', help='Type of model file (keras or pytorch)')
|
|
150
151
|
parser_variant.add_argument('--precision', '-p', type=int, default=2, help='Number of decimal places to round the output scores')
|
|
151
|
-
|
|
152
|
+
parser_variant.add_argument('--batch-size', '-b', type=int, default=1, help='Number of windows per GPU forward pass. >1 enables batched inference '
|
|
153
|
+
'(pytorch only) for large speedups on many-variant inputs; 1 (default) preserves the exact original per-variant path')
|
|
154
|
+
|
|
152
155
|
|
|
153
156
|
def parse_args(arglist):
|
|
154
157
|
"""Build the top-level argument parser with all subcommands and parse ``arglist`` (or ``sys.argv``)."""
|
|
@@ -17,7 +17,7 @@ import openspliceai.predict.utils as utils
|
|
|
17
17
|
## STEP 1 ##
|
|
18
18
|
################
|
|
19
19
|
|
|
20
|
-
def process_gff(fasta_file, gff_file, output_dir):
|
|
20
|
+
def process_gff(fasta_file, gff_file, output_dir, gene_flank=0):
|
|
21
21
|
"""
|
|
22
22
|
Processes a GFF file to extract gene regions and creates a new FASTA file
|
|
23
23
|
with the extracted gene sequences.
|
|
@@ -26,6 +26,12 @@ def process_gff(fasta_file, gff_file, output_dir):
|
|
|
26
26
|
- gff_file: Path to the GFF file.
|
|
27
27
|
- fasta_file: Path to the input FASTA file.
|
|
28
28
|
- output_fasta_file: Path to the output FASTA file.
|
|
29
|
+
- gene_flank: bp of REAL genomic sequence to include on each side of every
|
|
30
|
+
gene (clamped to the contig ends). The deep model needs flanking_size/2 of
|
|
31
|
+
true context on each side; without it the boundaries of every extracted
|
|
32
|
+
gene are padded with 'N' downstream, which suppresses splice-site scores
|
|
33
|
+
near the gene ends. Pass flanking_size//2 (default 0 keeps the legacy
|
|
34
|
+
bare-gene-body behavior).
|
|
29
35
|
"""
|
|
30
36
|
# define output FASTA file
|
|
31
37
|
output_fasta_file = f'{output_dir}{os.path.splitext(os.path.basename(fasta_file))[0]}_genes.fa'
|
|
@@ -67,15 +73,23 @@ def process_gff(fasta_file, gff_file, output_dir):
|
|
|
67
73
|
gene_id = attribute.split('=')[1]
|
|
68
74
|
break
|
|
69
75
|
|
|
70
|
-
#
|
|
71
|
-
|
|
76
|
+
# extend the gene region by gene_flank bp of REAL genomic context
|
|
77
|
+
# on each side (clamped to the contig bounds) so the model is not
|
|
78
|
+
# fed 'N' padding at the gene boundaries; report the extended
|
|
79
|
+
# coordinates in the header so the BED output still maps to genome
|
|
80
|
+
contig_len = len(fasta[seqid])
|
|
81
|
+
ext_start = max(1, start - gene_flank)
|
|
82
|
+
ext_end = min(contig_len, end + gene_flank)
|
|
83
|
+
|
|
84
|
+
# extract the gene sequence (+ flank) from the FASTA file
|
|
85
|
+
sequence = fasta[seqid][ext_start-1:ext_end] # adjust for 0-based indexing
|
|
72
86
|
|
|
73
87
|
# reverse complement the sequence if on the negative strand
|
|
74
88
|
if strand == '-':
|
|
75
89
|
sequence = sequence.reverse.complement
|
|
76
90
|
|
|
77
91
|
# write the gene sequence to the output FASTA file
|
|
78
|
-
output_fasta.write(f'>{gene_id} {seqid}:{
|
|
92
|
+
output_fasta.write(f'>{gene_id} {seqid}:{ext_start}-{ext_end}({strand})\n')
|
|
79
93
|
output_fasta.write(str(sequence) + '\n')
|
|
80
94
|
count += 1
|
|
81
95
|
|
|
@@ -209,21 +223,40 @@ def get_sequences(fasta_file, output_dir, CL_max, hdf_threshold_len=0, split_fas
|
|
|
209
223
|
|
|
210
224
|
NAME = [] # Gene Header
|
|
211
225
|
SEQ = [] # Sequences
|
|
226
|
+
short_records = [] # records shorter than the model's required context
|
|
212
227
|
|
|
213
228
|
# obtain the headers and sequences from FASTA file
|
|
214
229
|
for record in genes:
|
|
215
230
|
seq_id = record.long_name
|
|
216
|
-
sequence = genes[record.name][:].seq
|
|
217
|
-
|
|
231
|
+
sequence = genes[record.name][:].seq
|
|
232
|
+
|
|
218
233
|
# reverse strand if explicitly specified, name with strand info
|
|
219
|
-
if neg_strands is not None and record.name in neg_strands:
|
|
234
|
+
if neg_strands is not None and record.name in neg_strands:
|
|
220
235
|
seq_id = str(seq_id) + ':-'
|
|
221
|
-
sequence
|
|
236
|
+
# ``sequence`` was already materialised to a str (.seq) above, so reverse-
|
|
237
|
+
# complement via the pyfaidx Sequence object and take its .seq (a bare str
|
|
238
|
+
# has no .reverse/.complement -> this path previously crashed).
|
|
239
|
+
sequence = genes[record.name][:].reverse.complement.seq
|
|
222
240
|
else:
|
|
223
241
|
seq_id = str(seq_id) + ':+'
|
|
224
|
-
|
|
242
|
+
|
|
243
|
+
# flag sequences too short to supply the model's flanking context: they
|
|
244
|
+
# are padded with 'N' downstream, which strongly suppresses splice scores
|
|
245
|
+
if len(sequence) < CL_max:
|
|
246
|
+
short_records.append((record.name, len(sequence)))
|
|
247
|
+
|
|
225
248
|
NAME.append(seq_id)
|
|
226
249
|
SEQ.append(str(sequence))
|
|
250
|
+
|
|
251
|
+
if short_records:
|
|
252
|
+
preview = ', '.join(f'{n} ({l} bp)' for n, l in short_records[:5])
|
|
253
|
+
more = '' if len(short_records) <= 5 else f' (+{len(short_records) - 5} more)'
|
|
254
|
+
print(f"\t[WARN] {len(short_records)} input sequence(s) are shorter than the model's "
|
|
255
|
+
f"required context (CL_max={CL_max} bp): {preview}{more}.", file=sys.stderr)
|
|
256
|
+
print(f"\t[WARN] Short sequences are padded with 'N' on both ends, which suppresses "
|
|
257
|
+
f"donor/acceptor scores. Supply >= {CL_max // 2} bp of REAL flanking sequence on "
|
|
258
|
+
f"each side — extract the gene +/- {CL_max // 2} bp, or pass the whole chromosome "
|
|
259
|
+
f"with -a/--annotation so genes are scored in their genomic context.", file=sys.stderr)
|
|
227
260
|
|
|
228
261
|
# write the sequences to datafile
|
|
229
262
|
if use_hdf:
|
|
@@ -1097,6 +1130,7 @@ def predict_cli(args):
|
|
|
1097
1130
|
model_path = args.model
|
|
1098
1131
|
input_sequence = args.input_sequence
|
|
1099
1132
|
gff_file = args.annotation_file
|
|
1133
|
+
gene_flank = getattr(args, 'gene_flank', -1)
|
|
1100
1134
|
threshold = np.float32(args.threshold)
|
|
1101
1135
|
debug = args.debug
|
|
1102
1136
|
predict_all = args.predict_all
|
|
@@ -1128,12 +1162,19 @@ def predict_cli(args):
|
|
|
1128
1162
|
start_time = time.time()
|
|
1129
1163
|
|
|
1130
1164
|
# if gff file is provided, extract just the gene regions into a new FASTA file
|
|
1131
|
-
if gff_file:
|
|
1132
|
-
|
|
1133
|
-
|
|
1165
|
+
if gff_file:
|
|
1166
|
+
# default (-1) => include the model's required context (CL_max/2) of real
|
|
1167
|
+
# genomic flanking on each side of every gene; minus-strand genes are
|
|
1168
|
+
# reverse-complemented automatically inside process_gff
|
|
1169
|
+
resolved_gene_flank = (consts['CL_max'] // 2) if gene_flank is None or gene_flank < 0 else gene_flank
|
|
1170
|
+
print(f'\t[INFO] GFF file provided: extracting gene sequences (+/- {resolved_gene_flank} bp genomic flank, minus-strand genes auto reverse-complemented).')
|
|
1171
|
+
new_fasta = process_gff(input_sequence, gff_file, output_base, gene_flank=resolved_gene_flank)
|
|
1134
1172
|
datafile_path, NAME, SEQ = get_sequences(new_fasta, output_base, consts['CL_max'], hdf_threshold_len=consts['HDF_THRESHOLD_LEN'], split_fasta_threshold=consts['SPLIT_FASTA_THRESHOLD'], debug=debug)
|
|
1135
1173
|
else:
|
|
1136
1174
|
# otherwise, collect all sequences from FASTA into file
|
|
1175
|
+
print("\t[INFO] No -a/--annotation given: each FASTA entry is scored on the strand AS PROVIDED. "
|
|
1176
|
+
"Genes on the minus strand must be reverse-complemented first (or pass -a so OpenSpliceAI "
|
|
1177
|
+
"handles strand and genomic flanking for you).")
|
|
1137
1178
|
datafile_path, NAME, SEQ = get_sequences(input_sequence, output_base, consts['CL_max'], hdf_threshold_len=consts['HDF_THRESHOLD_LEN'], split_fasta_threshold=consts['SPLIT_FASTA_THRESHOLD'], debug=debug)
|
|
1138
1179
|
|
|
1139
1180
|
print("--- %s seconds ---" % (time.time() - start_time))
|
|
@@ -112,13 +112,13 @@ def calculate_batch_metrics(y_true, y_pred, metric_files, accumulator):
|
|
|
112
112
|
print(f"Batch Overall Accuracy: {batch_overall_accuracy}")
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
def process_batch(model, X, Y, params):
|
|
115
|
+
def process_batch(model, X, Y, params): # pragma: no cover - Keras-only (model.predict); reachable only via the disabled 'test' subcommand
|
|
116
116
|
Xc, Yc = clip_datapoints_spliceai27(X, Y, params['CL'], 2)
|
|
117
117
|
Yp = model.predict(Xc, batch_size=params['BATCH_SIZE'])
|
|
118
118
|
return Yc[0], Yp
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
def test_SpliceAI_Keras_model(model, test_h5f, test_idxs, args, params, test_metric_files):
|
|
121
|
+
def test_SpliceAI_Keras_model(model, test_h5f, test_idxs, args, params, test_metric_files): # pragma: no cover - Keras-only (model.predict); reachable only via the disabled 'test' subcommand
|
|
122
122
|
print(f"\n{'='*60}")
|
|
123
123
|
start_time = time.time()
|
|
124
124
|
print("--------------------------------------------------------------")
|
|
@@ -5,6 +5,7 @@ from pyfaidx import Fasta
|
|
|
5
5
|
import logging
|
|
6
6
|
import platform
|
|
7
7
|
import os
|
|
8
|
+
import re
|
|
8
9
|
import glob
|
|
9
10
|
from openspliceai.train_base.openspliceai import SpliceAI
|
|
10
11
|
from openspliceai.constants import *
|
|
@@ -230,8 +231,13 @@ def one_hot_encode(seq):
|
|
|
230
231
|
[0, 0, 1, 0], # G
|
|
231
232
|
[0, 0, 0, 1]]) # T
|
|
232
233
|
|
|
233
|
-
#
|
|
234
|
-
|
|
234
|
+
# Per the map above, index 0 is "N or any invalid character". Fold every non-ACGT
|
|
235
|
+
# base (N, IUPAC ambiguity codes like R/Y/S, gaps, etc.) to N *before* the latin-1
|
|
236
|
+
# ``% 5`` trick -- otherwise an unexpected byte would alias onto a concrete base
|
|
237
|
+
# instead of the intended all-zero row. ACGTN inputs are unaffected (bit-identical),
|
|
238
|
+
# so real-genome variant scores are unchanged.
|
|
239
|
+
seq = re.sub('[^ACGT]', 'N', seq.upper())
|
|
240
|
+
seq = seq.replace('A', '\x01').replace('C', '\x02')
|
|
235
241
|
seq = seq.replace('G', '\x03').replace('T', '\x04').replace('N', '\x00')
|
|
236
242
|
|
|
237
243
|
# Convert the sequence to one-hot encoded numpy array.
|
|
@@ -591,4 +597,192 @@ def get_delta_scores(record, ann, dist_var, mask, flanking_size=10000, precision
|
|
|
591
597
|
idx_nd - cov // 2
|
|
592
598
|
))
|
|
593
599
|
|
|
594
|
-
return delta_scores
|
|
600
|
+
return delta_scores
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
def _ensemble_forward(models, xb):
|
|
604
|
+
"""Run the ensemble mean forward pass on a batch ``xb`` (B, 4, wid) already on device.
|
|
605
|
+
|
|
606
|
+
Returns a CPU float tensor of shape (B, Lout, 3) — the per-position class
|
|
607
|
+
probabilities, permuted to match get_delta_scores' post-processing.
|
|
608
|
+
"""
|
|
609
|
+
y = torch.mean(torch.stack([models[m](xb) for m in range(len(models))]), axis=0)
|
|
610
|
+
return y.permute(0, 2, 1).detach().to('cpu')
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
def get_delta_scores_batched(records, ann, dist_var, mask, flanking_size=10000, precision=2, batch_size=64):
|
|
614
|
+
"""Batched re-implementation of :func:`get_delta_scores` over a LIST of records (PyTorch only).
|
|
615
|
+
|
|
616
|
+
The per-variant math is identical to :func:`get_delta_scores`; the ONLY
|
|
617
|
+
difference is that the model forward pass is batched across many variants
|
|
618
|
+
(and the ref+alt windows) instead of one window at a time. This buffers the
|
|
619
|
+
one-hot windows for every (variant, alt, gene) item, runs the model in
|
|
620
|
+
sub-batches of ``batch_size``, then applies the exact same crop / indel /
|
|
621
|
+
argmax / mask / format steps per item.
|
|
622
|
+
|
|
623
|
+
Returns a list (same length and order as ``records``) of delta-score string
|
|
624
|
+
lists — ready to assign to each record's ``OpenSpliceAI`` INFO field.
|
|
625
|
+
"""
|
|
626
|
+
cov = 2 * dist_var + 1
|
|
627
|
+
wid = flanking_size + cov
|
|
628
|
+
device = setup_device()
|
|
629
|
+
# Precision/speed knobs (env-overridable). cuDNN autotune helps because all
|
|
630
|
+
# windows share one length. TF32 is the A100 fast path (~2x); it adds ~1e-3
|
|
631
|
+
# batched-vs-single noise on strong signals, far below the score resolution
|
|
632
|
+
# used downstream. Default: TF32 ON for speed. Set OSAI_TF32=0 for full fp32
|
|
633
|
+
# (reproducible across hardware, batched==single) at lower throughput.
|
|
634
|
+
_bench = os.environ.get('OSAI_CUDNN_BENCH', '1') == '1'
|
|
635
|
+
_tf32 = os.environ.get('OSAI_TF32', '1') == '1'
|
|
636
|
+
torch.backends.cudnn.benchmark = _bench
|
|
637
|
+
torch.backends.cudnn.allow_tf32 = _tf32
|
|
638
|
+
torch.backends.cuda.matmul.allow_tf32 = _tf32
|
|
639
|
+
|
|
640
|
+
out_per_record = [[] for _ in records] # ordered entries per record (strings or None placeholders)
|
|
641
|
+
items = [] # model work items (one per variant,alt,gene)
|
|
642
|
+
ref_index = {} # (chrom,pos,gene_idx) -> index into ref_list (dedup)
|
|
643
|
+
ref_list = [] # UNIQUE reference windows (the 3 alts at a position share one)
|
|
644
|
+
alt_list = [] # alternate windows (one per item)
|
|
645
|
+
|
|
646
|
+
for r, record in enumerate(records):
|
|
647
|
+
entries = out_per_record[r]
|
|
648
|
+
# --- record-level validation (mirrors get_delta_scores) ---
|
|
649
|
+
try:
|
|
650
|
+
record.chrom, record.pos, record.ref, len(record.alts)
|
|
651
|
+
except TypeError:
|
|
652
|
+
logging.warning('Skipping record (bad input): {}'.format(record))
|
|
653
|
+
continue
|
|
654
|
+
(genes, strands, idxs) = ann.get_name_and_strand(record.chrom, record.pos)
|
|
655
|
+
if len(idxs) == 0:
|
|
656
|
+
continue
|
|
657
|
+
chrom = normalise_chrom(record.chrom, list(ann.ref_fasta.keys())[0])
|
|
658
|
+
try:
|
|
659
|
+
seq = ann.ref_fasta[chrom][record.pos - wid // 2 - 1 : record.pos + wid // 2].seq
|
|
660
|
+
except (IndexError, ValueError):
|
|
661
|
+
logging.warning('Skipping record (fasta issue): {}'.format(record))
|
|
662
|
+
continue
|
|
663
|
+
if seq[wid // 2 : wid // 2 + len(record.ref)].upper() != record.ref:
|
|
664
|
+
logging.warning('Skipping record (ref issue): {}'.format(record))
|
|
665
|
+
continue
|
|
666
|
+
if len(seq) != wid:
|
|
667
|
+
logging.warning('Skipping record (near chromosome end): {}'.format(record))
|
|
668
|
+
continue
|
|
669
|
+
if len(record.ref) > 2 * dist_var:
|
|
670
|
+
logging.warning('Skipping record (ref too long): {}'.format(record))
|
|
671
|
+
continue
|
|
672
|
+
|
|
673
|
+
for j in range(len(record.alts)):
|
|
674
|
+
for i in range(len(idxs)):
|
|
675
|
+
if '.' in record.alts[j] or '-' in record.alts[j] or '*' in record.alts[j]:
|
|
676
|
+
continue
|
|
677
|
+
if '<' in record.alts[j] or '>' in record.alts[j]:
|
|
678
|
+
continue
|
|
679
|
+
if len(record.ref) > 1 and len(record.alts[j]) > 1:
|
|
680
|
+
entries.append("{}|{}|.|.|.|.|.|.|.|.".format(record.alts[j], genes[i]))
|
|
681
|
+
continue
|
|
682
|
+
|
|
683
|
+
dist_ann = ann.get_pos_data(idxs[i], record.pos)
|
|
684
|
+
pad_size = [max(wid // 2 + dist_ann[0], 0), max(wid // 2 - dist_ann[1], 0)]
|
|
685
|
+
ref_len = len(record.ref)
|
|
686
|
+
alt_len = len(record.alts[j])
|
|
687
|
+
del_len = max(ref_len - alt_len, 0)
|
|
688
|
+
|
|
689
|
+
x_ref = 'N' * pad_size[0] + seq[pad_size[0]: wid - pad_size[1]] + 'N' * pad_size[1]
|
|
690
|
+
x_alt = x_ref[: wid // 2] + str(record.alts[j]) + x_ref[wid // 2 + ref_len:]
|
|
691
|
+
x_ref = one_hot_encode(x_ref)[None, :].transpose(0, 2, 1) # (1, 4, wid)
|
|
692
|
+
x_alt = one_hot_encode(x_alt)[None, :].transpose(0, 2, 1)
|
|
693
|
+
x_ref = torch.tensor(x_ref, dtype=torch.float32)
|
|
694
|
+
x_alt = torch.tensor(x_alt, dtype=torch.float32)
|
|
695
|
+
if strands[i] == '-': # reverse-complement input
|
|
696
|
+
x_ref = torch.flip(x_ref, dims=[1, 2])
|
|
697
|
+
x_alt = torch.flip(x_alt, dims=[1, 2])
|
|
698
|
+
|
|
699
|
+
# Reference-window reuse: x_ref depends only on (chrom, pos, gene),
|
|
700
|
+
# NOT on the alt allele -> the 3 alts at a position share one ref pass.
|
|
701
|
+
rk = (record.chrom, record.pos, int(idxs[i]))
|
|
702
|
+
if rk not in ref_index:
|
|
703
|
+
ref_index[rk] = len(ref_list)
|
|
704
|
+
ref_list.append(x_ref[0]) # (4, wid)
|
|
705
|
+
slot = len(entries)
|
|
706
|
+
entries.append(None) # placeholder, filled after inference
|
|
707
|
+
items.append({
|
|
708
|
+
'r': r, 'slot': slot, 'ref_idx': ref_index[rk], 'alt_idx': len(alt_list),
|
|
709
|
+
'strand': strands[i], 'gene': genes[i], 'alt': record.alts[j],
|
|
710
|
+
'ref_len': ref_len, 'alt_len': alt_len, 'del_len': del_len, 'dist_ann': dist_ann,
|
|
711
|
+
})
|
|
712
|
+
alt_list.append(x_alt[0]) # (4, wid)
|
|
713
|
+
|
|
714
|
+
# --- batched inference over all collected windows ---
|
|
715
|
+
if items:
|
|
716
|
+
# Unique reference windows all share one width (wid); the 3 alts at a
|
|
717
|
+
# position reuse one ref pass (deduped above). Alt windows, however, can
|
|
718
|
+
# be SHORTER (deletions) or LONGER (insertions) than wid, so they cannot
|
|
719
|
+
# all be stacked into a single fixed-width batch tensor -- bucket them by
|
|
720
|
+
# width and batch within each width group (SNVs, the common case, all
|
|
721
|
+
# share wid and so still batch together).
|
|
722
|
+
def _run_batched(tensors):
|
|
723
|
+
outs = []
|
|
724
|
+
with torch.inference_mode():
|
|
725
|
+
for s in range(0, len(tensors), batch_size):
|
|
726
|
+
xb = torch.stack(tensors[s:s + batch_size]).to(device)
|
|
727
|
+
outs.append(_ensemble_forward(ann.models, xb).numpy())
|
|
728
|
+
return np.concatenate(outs, axis=0) if outs else None
|
|
729
|
+
|
|
730
|
+
Yref = _run_batched(ref_list) # (nref, Lout_ref, 3), all width wid
|
|
731
|
+
|
|
732
|
+
Yalt = [None] * len(alt_list) # per-alt output (variable length for indels)
|
|
733
|
+
width_buckets = {}
|
|
734
|
+
for a, x in enumerate(alt_list):
|
|
735
|
+
width_buckets.setdefault(x.shape[-1], []).append(a)
|
|
736
|
+
for group in width_buckets.values():
|
|
737
|
+
yb = _run_batched([alt_list[a] for a in group]) # (len(group), Lout_w, 3)
|
|
738
|
+
for k, a in enumerate(group):
|
|
739
|
+
Yalt[a] = yb[k]
|
|
740
|
+
|
|
741
|
+
format_str = "{{}}|{{}}|{{:.{}f}}|{{:.{}f}}|{{:.{}f}}|{{:.{}f}}|{{}}|{{}}|{{}}|{{}}".format(
|
|
742
|
+
precision, precision, precision, precision)
|
|
743
|
+
|
|
744
|
+
for it in items:
|
|
745
|
+
ref_len = it['ref_len']
|
|
746
|
+
alt_len = it['alt_len']
|
|
747
|
+
del_len = it['del_len']
|
|
748
|
+
dist_ann = it['dist_ann']
|
|
749
|
+
y_ref = Yref[it['ref_idx']] # (Lout, 3); ref shared across the position's alts
|
|
750
|
+
y_alt = Yalt[it['alt_idx']]
|
|
751
|
+
if it['strand'] == '-': # reverse predictions back to genomic order
|
|
752
|
+
y_ref = y_ref[::-1]
|
|
753
|
+
y_alt = y_alt[::-1]
|
|
754
|
+
y_ref = y_ref[None, :] # (1, Lout, 3)
|
|
755
|
+
y_alt = y_alt[None, :]
|
|
756
|
+
|
|
757
|
+
if y_ref.shape[1] > cov:
|
|
758
|
+
start_idx = wid // 2 - cov // 2
|
|
759
|
+
y_ref = y_ref[:, start_idx: start_idx + cov, :]
|
|
760
|
+
y_alt = y_alt[:, start_idx: start_idx + cov + alt_len - ref_len, :]
|
|
761
|
+
|
|
762
|
+
if ref_len > 1 and alt_len == 1:
|
|
763
|
+
y_alt = np.concatenate([
|
|
764
|
+
y_alt[:, : cov // 2 + alt_len], np.zeros((1, del_len, 3)), y_alt[:, cov // 2 + alt_len:]], axis=1)
|
|
765
|
+
elif ref_len == 1 and alt_len > 1:
|
|
766
|
+
y_alt = np.concatenate([
|
|
767
|
+
y_alt[:, : cov // 2], np.max(y_alt[:, cov // 2: cov // 2 + alt_len], axis=1)[:, None, :],
|
|
768
|
+
y_alt[:, cov // 2 + alt_len:]], axis=1)
|
|
769
|
+
|
|
770
|
+
y = np.concatenate([y_ref, y_alt])
|
|
771
|
+
idx_pa = (y[1, :, 1] - y[0, :, 1]).argmax()
|
|
772
|
+
idx_na = (y[0, :, 1] - y[1, :, 1]).argmax()
|
|
773
|
+
idx_pd = (y[1, :, 2] - y[0, :, 2]).argmax()
|
|
774
|
+
idx_nd = (y[0, :, 2] - y[1, :, 2]).argmax()
|
|
775
|
+
mask_pa = np.logical_and((idx_pa - cov // 2 == dist_ann[2]), mask)
|
|
776
|
+
mask_na = np.logical_and((idx_na - cov // 2 != dist_ann[2]), mask)
|
|
777
|
+
mask_pd = np.logical_and((idx_pd - cov // 2 == dist_ann[2]), mask)
|
|
778
|
+
mask_nd = np.logical_and((idx_nd - cov // 2 != dist_ann[2]), mask)
|
|
779
|
+
out_per_record[it['r']][it['slot']] = format_str.format(
|
|
780
|
+
it['alt'], it['gene'],
|
|
781
|
+
(y[1, idx_pa, 1] - y[0, idx_pa, 1]) * (1 - mask_pa),
|
|
782
|
+
(y[0, idx_na, 1] - y[1, idx_na, 1]) * (1 - mask_na),
|
|
783
|
+
(y[1, idx_pd, 2] - y[0, idx_pd, 2]) * (1 - mask_pd),
|
|
784
|
+
(y[0, idx_nd, 2] - y[1, idx_nd, 2]) * (1 - mask_nd),
|
|
785
|
+
idx_pa - cov // 2, idx_na - cov // 2, idx_pd - cov // 2, idx_nd - cov // 2)
|
|
786
|
+
|
|
787
|
+
# drop any unfilled placeholders (defensive; should not occur)
|
|
788
|
+
return [[e for e in entries if e is not None] for entries in out_per_record]
|
|
@@ -49,7 +49,8 @@ def variant(args):
|
|
|
49
49
|
flanking_size = args.flanking_size
|
|
50
50
|
model_type = args.model_type
|
|
51
51
|
precision = args.precision
|
|
52
|
-
|
|
52
|
+
batch_size = getattr(args, 'batch_size', 1)
|
|
53
|
+
|
|
53
54
|
print(f'''Running with genome: {ref_genome}, annotation: {annotation},
|
|
54
55
|
model(s): {model}, model_type: {model_type},
|
|
55
56
|
input: {input_vcf}, output: {output_vcf},
|
|
@@ -86,11 +87,33 @@ def variant(args):
|
|
|
86
87
|
ann = Annotator(ref_genome, annotation, model, model_type, flanking_size)
|
|
87
88
|
|
|
88
89
|
# Obtain delta score for each variant in VCF
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
if batch_size > 1 and model_type == 'pytorch':
|
|
91
|
+
# Batched inference: buffer records, score their windows in one batched
|
|
92
|
+
# forward pass, then write in input order. Much faster on many-variant VCFs.
|
|
93
|
+
FLUSH = max(batch_size, 1024) # records buffered per flush
|
|
94
|
+
buf = []
|
|
95
|
+
|
|
96
|
+
def _flush(records_buf):
|
|
97
|
+
results = get_delta_scores_batched(records_buf, ann, distance, mask,
|
|
98
|
+
flanking_size, precision, batch_size)
|
|
99
|
+
for rec, scores in zip(records_buf, results):
|
|
100
|
+
if scores:
|
|
101
|
+
rec.info['OpenSpliceAI'] = scores
|
|
102
|
+
output.write(rec)
|
|
103
|
+
|
|
104
|
+
for record in tqdm(vcf):
|
|
105
|
+
buf.append(record)
|
|
106
|
+
if len(buf) >= FLUSH:
|
|
107
|
+
_flush(buf)
|
|
108
|
+
buf = []
|
|
109
|
+
if buf:
|
|
110
|
+
_flush(buf)
|
|
111
|
+
else:
|
|
112
|
+
for record in tqdm(vcf):
|
|
113
|
+
scores = get_delta_scores(record, ann, distance, mask, flanking_size, precision)
|
|
114
|
+
if scores:
|
|
115
|
+
record.info['OpenSpliceAI'] = scores
|
|
116
|
+
output.write(record)
|
|
94
117
|
|
|
95
118
|
# Close input and output VCF files
|
|
96
119
|
vcf.close()
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openspliceai
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: Deep learning framework that decodes splicing across species
|
|
5
5
|
Home-page: https://github.com/Kuanhao-Chao/OpenSpliceAI
|
|
6
6
|
Author: Kuan-Hao Chao
|
|
7
7
|
Author-email: kh.chao@cs.jhu.edu
|
|
8
|
+
License: GPL-3.0-only
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
8
20
|
Requires-Python: >=3.9
|
|
9
21
|
Description-Content-Type: text/markdown
|
|
10
22
|
License-File: LICENSE
|
|
@@ -16,12 +28,9 @@ Requires-Dist: pandas>=1.5.3
|
|
|
16
28
|
Requires-Dist: pyfaidx>=0.8.1.1
|
|
17
29
|
Requires-Dist: tqdm>=4.65.2
|
|
18
30
|
Requires-Dist: torch>=2.2.1
|
|
19
|
-
Requires-Dist: torchaudio>=2.2.1
|
|
20
|
-
Requires-Dist: torchvision>=0.17.1
|
|
21
31
|
Requires-Dist: scikit-learn>=1.4.1.post1
|
|
22
32
|
Requires-Dist: biopython>=1.83
|
|
23
33
|
Requires-Dist: matplotlib>=3.8.3
|
|
24
|
-
Requires-Dist: matplotlib-inline>=0.1.7
|
|
25
34
|
Requires-Dist: psutil>=5.9.2
|
|
26
35
|
Requires-Dist: mappy>=2.28
|
|
27
36
|
Provides-Extra: test
|
|
@@ -34,9 +43,11 @@ Requires-Dist: ruff>=0.4; extra == "dev"
|
|
|
34
43
|
Requires-Dist: pre-commit>=3; extra == "dev"
|
|
35
44
|
Dynamic: author
|
|
36
45
|
Dynamic: author-email
|
|
46
|
+
Dynamic: classifier
|
|
37
47
|
Dynamic: description
|
|
38
48
|
Dynamic: description-content-type
|
|
39
49
|
Dynamic: home-page
|
|
50
|
+
Dynamic: license
|
|
40
51
|
Dynamic: license-file
|
|
41
52
|
Dynamic: provides-extra
|
|
42
53
|
Dynamic: requires-dist
|
|
@@ -52,7 +63,7 @@ Dynamic: summary
|
|
|
52
63
|
|
|
53
64
|
|
|
54
65
|
<a class="reference external image-reference" href="https://img.shields.io/badge/License-GPLv3-yellow.svg"><img alt="https://img.shields.io/badge/License-GPLv3-yellow.svg" src="https://img.shields.io/badge/License-GPLv3-yellow.svg"></a>
|
|
55
|
-
<a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.
|
|
66
|
+
<a class="reference external image-reference" href="https://img.shields.io/badge/version-v.0.0.7-blue"><img alt="https://img.shields.io/badge/version-v.0.0.7-blue" src="https://img.shields.io/badge/version-v.0.0.7-blue"></a>
|
|
56
67
|
<a class="reference external image-reference" href="https://pepy.tech/project/openspliceai"><img alt="https://static.pepy.tech/personalized-badge/openspliceai?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=PyPi%20downloads" src="https://static.pepy.tech/personalized-badge/openspliceai?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=PyPi%20downloads"></a>
|
|
57
68
|
<a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&logo=github&label=Download" src="https://img.shields.io/github/downloads/Kuanhao-Chao/OpenSpliceAI/total.svg?style=social&logo=github&label=Download"></a>
|
|
58
69
|
<a class="reference external image-reference" href="https://github.com/Kuanhao-Chao/OpenSpliceAI/releases"><img alt="https://img.shields.io/badge/platform-macOS_/Linux-green.svg" src="https://img.shields.io/badge/platform-macOS_/Linux-green.svg"></a>
|
|
@@ -109,6 +120,17 @@ Annotates VCF files with delta scores and positions to evaluate the impact of ge
|
|
|
109
120
|
<div class="line"><br></div>
|
|
110
121
|
</div>
|
|
111
122
|
</section>
|
|
123
|
+
<section id="installation">
|
|
124
|
+
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">#</a></h1>
|
|
125
|
+
<p>Install the latest release from <strong>PyPI</strong>:</p>
|
|
126
|
+
<pre><code>pip install openspliceai</code></pre>
|
|
127
|
+
<p>or from <strong>Bioconda</strong> (make sure the <code>conda-forge</code> and <code>bioconda</code> channels are enabled):</p>
|
|
128
|
+
<pre><code>conda install -c conda-forge -c bioconda openspliceai</code></pre>
|
|
129
|
+
<p>See the <a class="reference external" href="https://ccb.jhu.edu/openspliceai/content/installation.html#installation">Installation Guide</a> for GPU/CUDA setup and other options.</p>
|
|
130
|
+
<div class="line-block">
|
|
131
|
+
<div class="line"><br></div>
|
|
132
|
+
</div>
|
|
133
|
+
</section>
|
|
112
134
|
<section id="cite-us">
|
|
113
135
|
<h1>Cite Us<a class="headerlink" href="#cite-us" title="Permalink to this heading">#</a></h1>
|
|
114
136
|
<p>If you use OpenSpliceAI in your research, please cite our work as well as the original SpliceAI paper:</p>
|
|
@@ -270,6 +292,6 @@ pre-commit install # run ruff + checks on every commit</code></pre>
|
|
|
270
292
|
<div class="line"><br></div>
|
|
271
293
|
</div>
|
|
272
294
|
<p align="center">
|
|
273
|
-
<img alt="Johns Hopkins University" src="logo/jhu-logo-dark.png" width="40%">
|
|
295
|
+
<img alt="Johns Hopkins University" src="https://raw.githubusercontent.com/Kuanhao-Chao/OpenSpliceAI/main/logo/jhu-logo-dark.png" width="40%">
|
|
274
296
|
</p>
|
|
275
297
|
</section>
|
|
@@ -5,12 +5,26 @@ this_directory = Path(__file__).resolve().parent
|
|
|
5
5
|
long_description = (this_directory / "./README.md").read_text()
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="openspliceai",
|
|
8
|
-
version="0.0.
|
|
8
|
+
version="0.0.7",
|
|
9
9
|
author="Kuan-Hao Chao",
|
|
10
10
|
author_email="kh.chao@cs.jhu.edu",
|
|
11
11
|
description="Deep learning framework that decodes splicing across species",
|
|
12
12
|
url="https://github.com/Kuanhao-Chao/OpenSpliceAI",
|
|
13
|
-
|
|
13
|
+
license="GPL-3.0-only",
|
|
14
|
+
classifiers=[
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
18
|
+
"Operating System :: POSIX :: Linux",
|
|
19
|
+
"Operating System :: MacOS",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
26
|
+
],
|
|
27
|
+
# install_requires=
|
|
14
28
|
install_requires=[
|
|
15
29
|
'h5py>=3.9.0',
|
|
16
30
|
'numpy>=1.24.4',
|
|
@@ -20,12 +34,9 @@ setuptools.setup(
|
|
|
20
34
|
'pyfaidx>=0.8.1.1',
|
|
21
35
|
'tqdm>=4.65.2',
|
|
22
36
|
'torch>=2.2.1',
|
|
23
|
-
'torchaudio>=2.2.1',
|
|
24
|
-
'torchvision>=0.17.1',
|
|
25
37
|
'scikit-learn>=1.4.1.post1',
|
|
26
38
|
'biopython>=1.83',
|
|
27
39
|
'matplotlib>=3.8.3',
|
|
28
|
-
'matplotlib-inline>=0.1.7',
|
|
29
40
|
'psutil>=5.9.2',
|
|
30
41
|
'mappy>=2.28'
|
|
31
42
|
],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = 'v0.0.6'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openspliceai-0.0.6 → openspliceai-0.0.7}/openspliceai/calibrate/temperature_scaling_site_only.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|