strkit 0.25.0a2__tar.gz → 0.25.0a3__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.
- strkit-0.25.0a3/.gitignore +43 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/MANIFEST.in +0 -1
- {strkit-0.25.0a2/strkit.egg-info → strkit-0.25.0a3}/PKG-INFO +25 -35
- {strkit-0.25.0a2 → strkit-0.25.0a3}/README.md +6 -7
- strkit-0.25.0a3/pyproject.toml +50 -0
- strkit-0.25.0a3/strkit/__init__.py +7 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/allele.py +18 -31
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/call_locus.py +112 -148
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/call_sample.py +21 -14
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/loci.py +4 -1
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/output/__init__.py +0 -2
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/output/json_report.py +43 -12
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/output/vcf.py +44 -17
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/params.py +26 -4
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/realign.py +1 -1
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/repeat_count_params.py +5 -1
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/repeats.py +15 -12
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/snvs.py +1 -1
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/types.py +15 -9
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/entry.py +36 -9
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/utils.py +1 -8
- strkit-0.25.0a3/tests/data/test_loci.bed +4 -0
- strkit-0.25.0a3/tests/data/trf_convert_sort.dat +17 -0
- strkit-0.25.0a2/PKG-INFO +0 -576
- strkit-0.25.0a2/pyproject.toml +0 -3
- strkit-0.25.0a2/setup.cfg +0 -4
- strkit-0.25.0a2/setup.py +0 -55
- strkit-0.25.0a2/strkit/VERSION +0 -1
- strkit-0.25.0a2/strkit/__init__.py +0 -8
- strkit-0.25.0a2/strkit/call/output/tsv.py +0 -37
- strkit-0.25.0a2/strkit/viz/static/logo.png +0 -0
- strkit-0.25.0a2/strkit.egg-info/SOURCES.txt +0 -80
- strkit-0.25.0a2/strkit.egg-info/dependency_links.txt +0 -1
- strkit-0.25.0a2/strkit.egg-info/entry_points.txt +0 -2
- strkit-0.25.0a2/strkit.egg-info/requires.txt +0 -10
- strkit-0.25.0a2/strkit.egg-info/top_level.txt +0 -5
- strkit-0.25.0a2/tests/test_caller_loci_fns.py +0 -40
- strkit-0.25.0a2/tests/test_caller_utils.py +0 -10
- strkit-0.25.0a2/tests/test_convert.py +0 -22
- strkit-0.25.0a2/tests/test_iupac.py +0 -11
- strkit-0.25.0a2/tests/test_mi_intervals.py +0 -35
- strkit-0.25.0a2/tests/test_ploidy.py +0 -52
- strkit-0.25.0a2/tests/test_utils.py +0 -8
- {strkit-0.25.0a2 → strkit-0.25.0a3}/LICENSE +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/__init__.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/align_matrix.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/constants.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/gmm.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/non_daemonic_pool.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/call/utils.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/catalog/__init__.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/catalog/combine.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/constants.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/__init__.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/_bed_4.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/constants.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/converter.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/expansionhunter.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/gangstr.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/hipstr.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/trf.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/convert/trgt.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/data/ploidy_configs/diploid_autosomes.json +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/data/ploidy_configs/diploid_xx.json +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/data/ploidy_configs/diploid_xy.json +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/data/ploidy_configs/haploid.json +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/exceptions.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/iupac.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/json.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/logger.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/__init__.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/base.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/expansionhunter.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/gangstr.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/generic_vcf.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/intervals.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/repeathmm.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/result.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/straglr.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/strkit.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/tandem_genotypes.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/trgt.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/mi/vcf_utils.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/ploidy.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/viz/__init__.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/viz/server.py +0 -0
- {strkit-0.25.0a2 → strkit-0.25.0a3}/strkit/viz/templates/browser.html +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/env
|
|
2
|
+
/envp11
|
|
3
|
+
__pycache__
|
|
4
|
+
|
|
5
|
+
/build
|
|
6
|
+
/dist
|
|
7
|
+
/strkit.egg-info
|
|
8
|
+
# ignore WIP cohort code for now
|
|
9
|
+
/strkit/cohort
|
|
10
|
+
# ignore WIP strkit viz code
|
|
11
|
+
/strkit_viz
|
|
12
|
+
|
|
13
|
+
plot-*.bash
|
|
14
|
+
test-*.bash
|
|
15
|
+
*.bam
|
|
16
|
+
*.bai
|
|
17
|
+
*.bcf
|
|
18
|
+
*.dat
|
|
19
|
+
*.fasta
|
|
20
|
+
*.fa.gz
|
|
21
|
+
*.fa.gz.fai
|
|
22
|
+
*.fa.gz.gzi
|
|
23
|
+
*.fastq
|
|
24
|
+
*.fastq.gz
|
|
25
|
+
*.fq
|
|
26
|
+
*.fq.gz
|
|
27
|
+
*.gff*
|
|
28
|
+
*.gtf*
|
|
29
|
+
*.log
|
|
30
|
+
*.bed
|
|
31
|
+
!tests/data/*.bed
|
|
32
|
+
!tests/data/*.dat
|
|
33
|
+
/*.json
|
|
34
|
+
*.png
|
|
35
|
+
*.time
|
|
36
|
+
/*.tsv
|
|
37
|
+
*.vcf.gz*
|
|
38
|
+
*.vcf*
|
|
39
|
+
|
|
40
|
+
*.token
|
|
41
|
+
|
|
42
|
+
*.lprof
|
|
43
|
+
*.poasta
|
|
@@ -1,43 +1,34 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: strkit
|
|
3
|
-
Version: 0.25.
|
|
3
|
+
Version: 0.25.0a3
|
|
4
4
|
Summary: A toolkit for analyzing variation in short(ish) tandem repeats.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Author-email: david.lougheed@gmail.com
|
|
8
|
-
License:
|
|
5
|
+
Project-URL: Homepage, https://github.com/davidlougheed/strkit
|
|
6
|
+
Project-URL: Repository, https://github.com/davidlougheed/strkit.git
|
|
7
|
+
Author-email: David Lougheed <david.lougheed@gmail.com>
|
|
8
|
+
License-Expression: GPL-3.0-only
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: STRs,TRs,genomics,short tandem repeats,tandem repeats
|
|
11
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
12
|
+
Classifier: Operating System :: POSIX
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
-
Requires-Python: ~=3.10
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
License-File: LICENSE
|
|
20
|
-
Requires-Dist: Flask<3.2,>=2.2.5
|
|
21
|
-
Requires-Dist: orjson<4,>=3.11.1
|
|
22
|
-
Requires-Dist: pysam<0.24,>=0.19
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: flask<3.2,>=3.1
|
|
23
22
|
Requires-Dist: numpy<3,>=2.1.3
|
|
23
|
+
Requires-Dist: orjson<4,>=3.11.1
|
|
24
24
|
Requires-Dist: parasail<1.4,>=1.2.4
|
|
25
25
|
Requires-Dist: pydantic<3,>=2.11.7
|
|
26
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: pysam<0.25,>=0.19
|
|
27
|
+
Requires-Dist: scikit-learn<2,>=1.7.2
|
|
27
28
|
Requires-Dist: scipy<1.17,>=1.10
|
|
28
29
|
Requires-Dist: statsmodels<0.15,>=0.14.0
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
|
|
31
|
-
Dynamic: author-email
|
|
32
|
-
Dynamic: classifier
|
|
33
|
-
Dynamic: description
|
|
34
|
-
Dynamic: description-content-type
|
|
35
|
-
Dynamic: home-page
|
|
36
|
-
Dynamic: license
|
|
37
|
-
Dynamic: license-file
|
|
38
|
-
Dynamic: requires-dist
|
|
39
|
-
Dynamic: requires-python
|
|
40
|
-
Dynamic: summary
|
|
30
|
+
Requires-Dist: strkit-rust-ext==0.28.0
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
41
32
|
|
|
42
33
|
# STRkit - short tandem repeat genotyping with long reads
|
|
43
34
|
|
|
@@ -114,7 +105,7 @@ a long time (in the tens of minutes).
|
|
|
114
105
|
On Digital Research Alliance of Canada/Compute Canada clusters, this involves loading a few modules:
|
|
115
106
|
|
|
116
107
|
```bash
|
|
117
|
-
module load rust/1.
|
|
108
|
+
module load rust/1.95.0 clang/18.1.8 python/3.13 scipy-stack/2026a parasail/2.6.2
|
|
118
109
|
python -m pip install strkit
|
|
119
110
|
```
|
|
120
111
|
|
|
@@ -151,7 +142,7 @@ docker run \
|
|
|
151
142
|
-it ghcr.io/davidlougheed/strkit call \
|
|
152
143
|
/inputs/file.bam \
|
|
153
144
|
--loci /inputs/loci.bed --ref /inputs/ref.fa --incorporate-snvs /inputs/dbsnp.vcf.gz \
|
|
154
|
-
--vcf /out/calls.vcf
|
|
145
|
+
--vcf /out/calls.vcf
|
|
155
146
|
```
|
|
156
147
|
|
|
157
148
|
Inside the `inputs` directory, STRkit would (given these parameters) expect the following files to be present:
|
|
@@ -219,7 +210,6 @@ strkit call \
|
|
|
219
210
|
--vcf my-calls.vcf \ # Calculate consensus sequences for alleles and output a .vcf (or .vcf.gz) with call data
|
|
220
211
|
--seed 183 \ # Fixed random number generator seed for replicability
|
|
221
212
|
--processes 10 \ # Number of parallel processes to use; DEFAULT: 1
|
|
222
|
-
--no-tsv # If VCF output is enabled as above, we don't need TSV genotype output to stdout (which is the default)
|
|
223
213
|
```
|
|
224
214
|
|
|
225
215
|
##### REGARDING ALIGNMENTS
|
|
@@ -325,12 +315,12 @@ For more information, see also documentation on the [Output formats](./docs/outp
|
|
|
325
315
|
|
|
326
316
|
If you want to output a full call report, you can use the `--json output-file.json` argument to
|
|
327
317
|
specify a path to output a more detailed JSON document to. This document contains 99% CIs, peak
|
|
328
|
-
labels, and some other information that isn't included in the normal
|
|
318
|
+
labels, and some other information that isn't included in the normal VCF file. If you want this
|
|
329
319
|
file to be indented and human-readable, use the `--indent-json` flag in addition to `--json ...`.
|
|
330
320
|
|
|
331
|
-
|
|
332
|
-
`--vcf
|
|
333
|
-
|
|
321
|
+
VCF call information is printed to standard output by default (`--vcf stdout`). If you pass
|
|
322
|
+
`--vcf path/to/file.vcf`, the VCF will be written to a file instead. If you pass `--vcf none`, no
|
|
323
|
+
VCF will be written.
|
|
334
324
|
|
|
335
325
|
For more information, see also documentation on the [Output formats](./docs/output_formats.md).
|
|
336
326
|
|
|
@@ -73,7 +73,7 @@ a long time (in the tens of minutes).
|
|
|
73
73
|
On Digital Research Alliance of Canada/Compute Canada clusters, this involves loading a few modules:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
module load rust/1.
|
|
76
|
+
module load rust/1.95.0 clang/18.1.8 python/3.13 scipy-stack/2026a parasail/2.6.2
|
|
77
77
|
python -m pip install strkit
|
|
78
78
|
```
|
|
79
79
|
|
|
@@ -110,7 +110,7 @@ docker run \
|
|
|
110
110
|
-it ghcr.io/davidlougheed/strkit call \
|
|
111
111
|
/inputs/file.bam \
|
|
112
112
|
--loci /inputs/loci.bed --ref /inputs/ref.fa --incorporate-snvs /inputs/dbsnp.vcf.gz \
|
|
113
|
-
--vcf /out/calls.vcf
|
|
113
|
+
--vcf /out/calls.vcf
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
Inside the `inputs` directory, STRkit would (given these parameters) expect the following files to be present:
|
|
@@ -178,7 +178,6 @@ strkit call \
|
|
|
178
178
|
--vcf my-calls.vcf \ # Calculate consensus sequences for alleles and output a .vcf (or .vcf.gz) with call data
|
|
179
179
|
--seed 183 \ # Fixed random number generator seed for replicability
|
|
180
180
|
--processes 10 \ # Number of parallel processes to use; DEFAULT: 1
|
|
181
|
-
--no-tsv # If VCF output is enabled as above, we don't need TSV genotype output to stdout (which is the default)
|
|
182
181
|
```
|
|
183
182
|
|
|
184
183
|
##### REGARDING ALIGNMENTS
|
|
@@ -284,12 +283,12 @@ For more information, see also documentation on the [Output formats](./docs/outp
|
|
|
284
283
|
|
|
285
284
|
If you want to output a full call report, you can use the `--json output-file.json` argument to
|
|
286
285
|
specify a path to output a more detailed JSON document to. This document contains 99% CIs, peak
|
|
287
|
-
labels, and some other information that isn't included in the normal
|
|
286
|
+
labels, and some other information that isn't included in the normal VCF file. If you want this
|
|
288
287
|
file to be indented and human-readable, use the `--indent-json` flag in addition to `--json ...`.
|
|
289
288
|
|
|
290
|
-
|
|
291
|
-
`--vcf
|
|
292
|
-
|
|
289
|
+
VCF call information is printed to standard output by default (`--vcf stdout`). If you pass
|
|
290
|
+
`--vcf path/to/file.vcf`, the VCF will be written to a file instead. If you pass `--vcf none`, no
|
|
291
|
+
VCF will be written.
|
|
293
292
|
|
|
294
293
|
For more information, see also documentation on the [Output formats](./docs/output_formats.md).
|
|
295
294
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "strkit"
|
|
7
|
+
version = "0.25.0a3"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"Flask>=3.1,<3.2",
|
|
10
|
+
"orjson>=3.11.1,<4",
|
|
11
|
+
"pysam>=0.19,<0.25",
|
|
12
|
+
"numpy>=2.1.3,<3",
|
|
13
|
+
"parasail>=1.2.4,<1.4",
|
|
14
|
+
"pydantic>=2.11.7,<3",
|
|
15
|
+
"scikit-learn>=1.7.2,<2",
|
|
16
|
+
"scipy>=1.10,<1.17",
|
|
17
|
+
"statsmodels>=0.14.0,<0.15",
|
|
18
|
+
"strkit_rust_ext==0.28.0",
|
|
19
|
+
]
|
|
20
|
+
requires-python = ">=3.10"
|
|
21
|
+
|
|
22
|
+
keywords = ["tandem repeats", "TRs", "short tandem repeats", "STRs", "genomics"]
|
|
23
|
+
description = "A toolkit for analyzing variation in short(ish) tandem repeats."
|
|
24
|
+
readme = "README.md"
|
|
25
|
+
|
|
26
|
+
license = "GPL-3.0-only"
|
|
27
|
+
license-files = ["LICEN[CS]E", "LICEN[CS]E.*"]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Programming Language :: Python :: 3.14",
|
|
34
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
35
|
+
"Operating System :: POSIX",
|
|
36
|
+
"Operating System :: POSIX :: Linux",
|
|
37
|
+
"Operating System :: MacOS :: MacOS X",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
authors = [{name = "David Lougheed", email = "david.lougheed@gmail.com"}]
|
|
41
|
+
|
|
42
|
+
[project.urls]
|
|
43
|
+
Homepage = "https://github.com/davidlougheed/strkit"
|
|
44
|
+
Repository = "https://github.com/davidlougheed/strkit.git"
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
strkit = "strkit.entry:main"
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build]
|
|
50
|
+
exclude = [".github", ".idea", "catalogs", "docs", "tests", "requirements.txt", "Dockerfile"]
|
|
@@ -18,7 +18,9 @@ from statistics import mode
|
|
|
18
18
|
from warnings import simplefilter
|
|
19
19
|
|
|
20
20
|
from numpy.typing import NDArray
|
|
21
|
-
from typing import
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
22
|
+
|
|
23
|
+
from strkit_rust_ext import CallData
|
|
22
24
|
|
|
23
25
|
from .gmm import make_single_gaussian
|
|
24
26
|
|
|
@@ -31,7 +33,6 @@ if TYPE_CHECKING:
|
|
|
31
33
|
|
|
32
34
|
__all__ = [
|
|
33
35
|
"RepeatCounts",
|
|
34
|
-
"CallDict",
|
|
35
36
|
"call_alleles",
|
|
36
37
|
]
|
|
37
38
|
|
|
@@ -47,11 +48,11 @@ small_allele_min = 8
|
|
|
47
48
|
FLOAT_32_EPSILON = np.finfo(np.float32).eps
|
|
48
49
|
|
|
49
50
|
|
|
50
|
-
def _calculate_cis(samples: NDArray[np.
|
|
51
|
+
def _calculate_cis(samples: NDArray[np.float64], is_99: bool) -> NDArray[np.int32]:
|
|
51
52
|
percentiles = np.percentile(
|
|
52
53
|
samples, (0.5, 99.5) if is_99 else (2.5, 97.5), axis=1, method="interpolated_inverted_cdf"
|
|
53
54
|
).transpose()
|
|
54
|
-
return percentiles
|
|
55
|
+
return np.rint(percentiles).astype(np.int32)
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
def na_length_list(n_alleles: int):
|
|
@@ -126,20 +127,6 @@ def fit_gmm(
|
|
|
126
127
|
return g
|
|
127
128
|
|
|
128
129
|
|
|
129
|
-
class BaseCallDict(TypedDict):
|
|
130
|
-
call: NDArray[np.int32]
|
|
131
|
-
call_95_cis: NDArray[np.int32]
|
|
132
|
-
call_99_cis: NDArray[np.int32]
|
|
133
|
-
peaks: NDArray[np.float64]
|
|
134
|
-
peak_weights: NDArray[np.float64]
|
|
135
|
-
peak_stdevs: NDArray[np.float64]
|
|
136
|
-
modal_n_peaks: int
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
class CallDict(BaseCallDict, total=False):
|
|
140
|
-
ps: int
|
|
141
|
-
|
|
142
|
-
|
|
143
130
|
def get_resampled_bootstrapped_reads(
|
|
144
131
|
combined_reads: NDArray[np.int32],
|
|
145
132
|
combined_len: int,
|
|
@@ -204,7 +191,7 @@ def call_alleles(
|
|
|
204
191
|
seed: int | None,
|
|
205
192
|
logger_: Logger,
|
|
206
193
|
debug_str: str,
|
|
207
|
-
) ->
|
|
194
|
+
) -> CallData | None:
|
|
208
195
|
combined_reads = np.concatenate((repeats_fwd, repeats_rev), axis=None, dtype=np.int32)
|
|
209
196
|
combined_len = combined_reads.shape[-1]
|
|
210
197
|
|
|
@@ -217,19 +204,19 @@ def call_alleles(
|
|
|
217
204
|
|
|
218
205
|
cn = combined_reads[0]
|
|
219
206
|
|
|
220
|
-
call = np.full(n_alleles, cn)
|
|
221
|
-
call_cis = np.full((n_alleles, 2), cn)
|
|
207
|
+
call = np.full(n_alleles, cn, dtype=np.int32)
|
|
208
|
+
call_cis = np.full((n_alleles, 2), cn, dtype=np.int32)
|
|
222
209
|
|
|
223
210
|
peaks: NDArray[np.float64] = call.astype(np.float64)
|
|
224
211
|
|
|
225
|
-
return
|
|
212
|
+
return CallData(
|
|
226
213
|
call=call,
|
|
227
214
|
call_95_cis=call_cis,
|
|
228
215
|
call_99_cis=call_cis,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
216
|
+
means=peaks,
|
|
217
|
+
weights=np.full(n_alleles, 1.0 / n_alleles),
|
|
218
|
+
stdevs=np.full(n_alleles, 0.0),
|
|
219
|
+
modal_n=1,
|
|
233
220
|
)
|
|
234
221
|
|
|
235
222
|
# ------------------------------------------------------------------------------------------------------------------
|
|
@@ -339,17 +326,17 @@ def call_alleles(
|
|
|
339
326
|
|
|
340
327
|
peak_weights /= peak_weights.sum() # re-normalize weights
|
|
341
328
|
|
|
342
|
-
return
|
|
329
|
+
return CallData(
|
|
343
330
|
call=medians_of_means_final.flatten(),
|
|
344
331
|
call_95_cis=allele_cis_95,
|
|
345
332
|
call_99_cis=allele_cis_99,
|
|
346
333
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
334
|
+
means=medians_of_means.flatten(), # Don't round, so we can recover original Gaussian model
|
|
335
|
+
weights=peak_weights,
|
|
336
|
+
stdevs=peak_stdevs.flatten(),
|
|
350
337
|
# TODO: should be ok to use this, because resample gets put at end, vertically (3rd allele in a 3-ploid case)
|
|
351
338
|
# so taking the first 2 alleles still works in terms of stdev/mean estimates? I think?
|
|
352
339
|
# Not quite, cause it's sorted...
|
|
353
340
|
# --> Only do the peak assignment with 1/2 peaks, which is the majority of human situations
|
|
354
|
-
|
|
341
|
+
modal_n=modal_n_peaks,
|
|
355
342
|
)
|