hlaont 0.1.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 (77) hide show
  1. hlaont-0.1.0/LICENSE +21 -0
  2. hlaont-0.1.0/MANIFEST.in +7 -0
  3. hlaont-0.1.0/PKG-INFO +110 -0
  4. hlaont-0.1.0/README.md +73 -0
  5. hlaont-0.1.0/pyproject.toml +74 -0
  6. hlaont-0.1.0/setup.cfg +4 -0
  7. hlaont-0.1.0/src/hlaont/__init__.py +1 -0
  8. hlaont-0.1.0/src/hlaont/cli.py +449 -0
  9. hlaont-0.1.0/src/hlaont/input/__init__.py +0 -0
  10. hlaont-0.1.0/src/hlaont/input/bam.py +75 -0
  11. hlaont-0.1.0/src/hlaont/input/fastq.py +206 -0
  12. hlaont-0.1.0/src/hlaont/input/phasing.py +32 -0
  13. hlaont-0.1.0/src/hlaont/input/regions.py +160 -0
  14. hlaont-0.1.0/src/hlaont/resources/__init__.py +0 -0
  15. hlaont-0.1.0/src/hlaont/resources/anchors/__init__.py +0 -0
  16. hlaont-0.1.0/src/hlaont/resources/anchors/anchors.fa.gz +0 -0
  17. hlaont-0.1.0/src/hlaont/resources/anchors/anchors.meta.tsv.gz +0 -0
  18. hlaont-0.1.0/src/hlaont/resources/anchors/anchors_manifest.json +207 -0
  19. hlaont-0.1.0/src/hlaont/resources/anchors/build.py +233 -0
  20. hlaont-0.1.0/src/hlaont/resources/anchors/prepare_candidates.py +211 -0
  21. hlaont-0.1.0/src/hlaont/resources/anchors/vendor/136ref.fa.gz +0 -0
  22. hlaont-0.1.0/src/hlaont/resources/anchors/vendor/FUFIHLA_LICENSE +21 -0
  23. hlaont-0.1.0/src/hlaont/resources/anchors/vendor/NOTICE.md +17 -0
  24. hlaont-0.1.0/src/hlaont/resources/controls/__init__.py +0 -0
  25. hlaont-0.1.0/src/hlaont/resources/controls/build.py +100 -0
  26. hlaont-0.1.0/src/hlaont/resources/controls/c4_flanked_forms.chm13v2.fa.gz +0 -0
  27. hlaont-0.1.0/src/hlaont/resources/controls/chr17_control.chm13v2.fa.gz +0 -0
  28. hlaont-0.1.0/src/hlaont/resources/genes.yaml +495 -0
  29. hlaont-0.1.0/src/hlaont/resources/models/__init__.py +0 -0
  30. hlaont-0.1.0/src/hlaont/resources/models/build_c4_form_signature.py +240 -0
  31. hlaont-0.1.0/src/hlaont/resources/models/c4_form_signature.yaml +36 -0
  32. hlaont-0.1.0/src/hlaont/resources/models/c4_joint_call.yaml +26 -0
  33. hlaont-0.1.0/src/hlaont/resources/models/read_error_ont_r10.yaml +20 -0
  34. hlaont-0.1.0/src/hlaont/resources/models/stage0_fastq_sieve.yaml +33 -0
  35. hlaont-0.1.0/src/hlaont/resources/models/stage4_typing.yaml +6 -0
  36. hlaont-0.1.0/src/hlaont/resources/models/vendor/BADREAD_LICENSE +674 -0
  37. hlaont-0.1.0/src/hlaont/resources/models/vendor/NOTICE.md +26 -0
  38. hlaont-0.1.0/src/hlaont/resources/models/vendor/nanopore2023.gz +0 -0
  39. hlaont-0.1.0/src/hlaont/resources/regions/alt_contigs.chm13v2.yaml +17 -0
  40. hlaont-0.1.0/src/hlaont/resources/regions/alt_contigs.grch38.yaml +49 -0
  41. hlaont-0.1.0/src/hlaont/resources/regions/mhc_window.chm13v2.bed +26 -0
  42. hlaont-0.1.0/src/hlaont/resources/regions/mhc_window.grch38.bed +28 -0
  43. hlaont-0.1.0/src/hlaont/resources/templates/__init__.py +0 -0
  44. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/bundle.fa.gz +0 -0
  45. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/bundle.meta.tsv.gz +0 -0
  46. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/bundle.models.jsonl.gz +0 -0
  47. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/bundle_manifest.json +25 -0
  48. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/c4.fa.gz +0 -0
  49. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/c4.meta.tsv.gz +0 -0
  50. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/c4.models.jsonl.gz +0 -0
  51. hlaont-0.1.0/src/hlaont/resources/templates/assembly_bundle/c4_bundle_manifest.json +17 -0
  52. hlaont-0.1.0/src/hlaont/resources/templates/assembly_sources.py +288 -0
  53. hlaont-0.1.0/src/hlaont/resources/templates/build.py +271 -0
  54. hlaont-0.1.0/src/hlaont/resources/templates/build_assembly_bundle.py +80 -0
  55. hlaont-0.1.0/src/hlaont/resources/templates/build_c4_bundle.py +97 -0
  56. hlaont-0.1.0/src/hlaont/resources/templates/sources.py +330 -0
  57. hlaont-0.1.0/src/hlaont/stages/__init__.py +0 -0
  58. hlaont-0.1.0/src/hlaont/stages/align_depth.py +129 -0
  59. hlaont-0.1.0/src/hlaont/stages/assign.py +462 -0
  60. hlaont-0.1.0/src/hlaont/stages/c4_chr17_cn.py +323 -0
  61. hlaont-0.1.0/src/hlaont/stages/c4_cn.py +168 -0
  62. hlaont-0.1.0/src/hlaont/stages/c4_form.py +363 -0
  63. hlaont-0.1.0/src/hlaont/stages/chr17_control.py +87 -0
  64. hlaont-0.1.0/src/hlaont/stages/cn.py +186 -0
  65. hlaont-0.1.0/src/hlaont/stages/consensus.py +379 -0
  66. hlaont-0.1.0/src/hlaont/stages/error_model.py +185 -0
  67. hlaont-0.1.0/src/hlaont/stages/genotype.py +519 -0
  68. hlaont-0.1.0/src/hlaont/stages/hla_typing.py +490 -0
  69. hlaont-0.1.0/src/hlaont/stages/novelty.py +537 -0
  70. hlaont-0.1.0/src/hlaont/stages/output.py +351 -0
  71. hlaont-0.1.0/src/hlaont/stages/pipeline.py +1089 -0
  72. hlaont-0.1.0/src/hlaont.egg-info/PKG-INFO +110 -0
  73. hlaont-0.1.0/src/hlaont.egg-info/SOURCES.txt +75 -0
  74. hlaont-0.1.0/src/hlaont.egg-info/dependency_links.txt +1 -0
  75. hlaont-0.1.0/src/hlaont.egg-info/entry_points.txt +2 -0
  76. hlaont-0.1.0/src/hlaont.egg-info/requires.txt +11 -0
  77. hlaont-0.1.0/src/hlaont.egg-info/top_level.txt +1 -0
hlaont-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aleix Canalda
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,7 @@
1
+ prune tests
2
+ prune .debug
3
+ prune src/hlaont/resources/templates/raw
4
+ prune src/hlaont/resources/templates/pool
5
+ prune src/hlaont/resources/anchors/build_staging
6
+ exclude CLAUDE.md DESIGN.md ipd_audit.py ipd_audit_v3.65.0.txt
7
+ global-exclude test_*.py __pycache__ *.py[cod]
hlaont-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: hlaont
3
+ Version: 0.1.0
4
+ Summary: Confidence-aware full-field HLA typing from ONT R10 long reads
5
+ Author: Aleix Canalda
6
+ License-Expression: MIT AND GPL-3.0-only
7
+ Project-URL: Homepage, https://github.com/aleixcanalda/hlaont
8
+ Project-URL: Repository, https://github.com/aleixcanalda/hlaont
9
+ Project-URL: Issues, https://github.com/aleixcanalda/hlaont/issues
10
+ Keywords: HLA,HLA typing,nanopore,ONT,long reads,MHC,bioinformatics,genomics
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: src/hlaont/resources/anchors/vendor/FUFIHLA_LICENSE
25
+ License-File: src/hlaont/resources/models/vendor/BADREAD_LICENSE
26
+ Requires-Dist: pysam
27
+ Requires-Dist: numpy
28
+ Requires-Dist: pyyaml
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: ruff; extra == "dev"
32
+ Requires-Dist: mypy; extra == "dev"
33
+ Requires-Dist: types-PyYAML; extra == "dev"
34
+ Requires-Dist: build; extra == "dev"
35
+ Requires-Dist: twine; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # hlaont
39
+
40
+ Confidence-aware, full-field HLA typing from Oxford Nanopore (ONT) R10 long reads, designed for population-scale sequencing.
41
+
42
+ Hlaont does the following:
43
+
44
+ - Types **41 HLA/MIC/TAP genes**.
45
+ - Estimates **copy number per gene** rather than assuming diploidy at every locus.
46
+ - Reports **C4A/C4B total copy number and long/short-form composition** (the complement C4 segmental duplication).
47
+ - Flags **novel alleles** (`novel:intronic`, `novel:utr`, `novel:synonymous`, `novel:nonsynonymous`, `novel:null`, `extension`).
48
+ - Accepts **FASTQ or BAM/CRAM** input, and can use real read-backed phase (`HP`/`PS` tags) when available.
49
+
50
+ ## Requirements
51
+
52
+ - Python ≥ 3.11
53
+ - [`minimap2`](https://github.com/lh3/minimap2) and [`samtools`](https://github.com/samtools/samtools) on `PATH` (external CLI tools, not pip-installable — install via conda/bioconda: `conda install -c bioconda minimap2 samtools`)
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ # from source
59
+ git clone https://github.com/aleixcanalda/hlaont.git
60
+ cd hlaont
61
+ pip install -e .
62
+
63
+ # or, once published:
64
+ # pip install hlaont
65
+ # conda install -c bioconda hlaont
66
+ ```
67
+
68
+ ### First-time setup
69
+
70
+ The package ships the anchor set, models and a pre-extracted assembly bundle, but the template pool is built from IPD-IMGT/HLA once before `hlaont run` will work:
71
+
72
+ ```bash
73
+ hlaont update-db --db-dir hlaont_db/ # downloads IPD-IMGT/HLA and builds the pool into hlaont_db/
74
+ hlaont run SAMPLE_ID reads.fastq --db-dir hlaont_db/ --out-dir OUT/
75
+ ```
76
+
77
+ `--db-dir` can also be set once with `export HLAONT_DB=hlaont_db/`; without either, the pool lives inside the installed package.
78
+
79
+ `hlaont update-anchors --db-dir hlaont_db/` rebuilds the anchor set against a new pool (maintainers only; needs `cd-hit-est` on PATH).
80
+
81
+ ## Usage
82
+
83
+ ```bash
84
+ # FASTQ input
85
+ hlaont run SAMPLE_ID reads.fastq --out-dir OUT/
86
+
87
+ # BAM/CRAM input (region set auto-derived from the @SQ header — no build/reference flag needed)
88
+ hlaont run SAMPLE_ID --bam aligned.bam --out-dir OUT/
89
+ hlaont run SAMPLE_ID --bam aligned.cram --reference ref.fa --out-dir OUT/
90
+
91
+ # Use real read-backed phase (HP/PS tags), when the input BAM has them
92
+ hlaont run SAMPLE_ID --bam phased.bam --phased --out-dir OUT/
93
+ ```
94
+
95
+ Each run writes, into `--out-dir`:
96
+
97
+ | file | contents |
98
+ |---|---|
99
+ | `{sample}.calls.tsv` | one row per haplotype call: gene, copy number, nearest allele, novelty tag, per-field GQ, read support, consensus QV |
100
+ | `{sample}.consensus.fa` + `.consensus.qv.tsv` | the polished per-haplotype consensus sequence and its per-base quality |
101
+ | `{sample}.variants.vcf` | variants relative to the nearest catalogued allele |
102
+ | `{sample}.qc.json` | per-gene copy-number estimates, C4 form breakdown, phasing routing (if `--phased`), and failure reasons for any gene that couldn't be called |
103
+
104
+ Run `hlaont run --help`, `hlaont update-db --help`, or `hlaont update-anchors --help` for the full flag list.
105
+
106
+ ## License
107
+
108
+ hlaont's own code is MIT — see [LICENSE](LICENSE). The distributed package also contains Badread's error model (GPL-3.0-only), so the package as a whole is `MIT AND GPL-3.0-only`.
109
+
110
+ `resources/anchors/vendor/` ports a 136-allele anchor set from [FuFiHLA](https://github.com/jingqing-hu/FuFiHLA) (MIT); `resources/models/vendor/` ports an ONT R10.4.1 error model from [Badread](https://github.com/rrwick/Badread) (GPLv3). See each `NOTICE.md`/license file for full attribution. If you use hlaont, please also cite FuFiHLA (`10.1093/bioinformatics/btag231`).
hlaont-0.1.0/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # hlaont
2
+
3
+ Confidence-aware, full-field HLA typing from Oxford Nanopore (ONT) R10 long reads, designed for population-scale sequencing.
4
+
5
+ Hlaont does the following:
6
+
7
+ - Types **41 HLA/MIC/TAP genes**.
8
+ - Estimates **copy number per gene** rather than assuming diploidy at every locus.
9
+ - Reports **C4A/C4B total copy number and long/short-form composition** (the complement C4 segmental duplication).
10
+ - Flags **novel alleles** (`novel:intronic`, `novel:utr`, `novel:synonymous`, `novel:nonsynonymous`, `novel:null`, `extension`).
11
+ - Accepts **FASTQ or BAM/CRAM** input, and can use real read-backed phase (`HP`/`PS` tags) when available.
12
+
13
+ ## Requirements
14
+
15
+ - Python ≥ 3.11
16
+ - [`minimap2`](https://github.com/lh3/minimap2) and [`samtools`](https://github.com/samtools/samtools) on `PATH` (external CLI tools, not pip-installable — install via conda/bioconda: `conda install -c bioconda minimap2 samtools`)
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # from source
22
+ git clone https://github.com/aleixcanalda/hlaont.git
23
+ cd hlaont
24
+ pip install -e .
25
+
26
+ # or, once published:
27
+ # pip install hlaont
28
+ # conda install -c bioconda hlaont
29
+ ```
30
+
31
+ ### First-time setup
32
+
33
+ The package ships the anchor set, models and a pre-extracted assembly bundle, but the template pool is built from IPD-IMGT/HLA once before `hlaont run` will work:
34
+
35
+ ```bash
36
+ hlaont update-db --db-dir hlaont_db/ # downloads IPD-IMGT/HLA and builds the pool into hlaont_db/
37
+ hlaont run SAMPLE_ID reads.fastq --db-dir hlaont_db/ --out-dir OUT/
38
+ ```
39
+
40
+ `--db-dir` can also be set once with `export HLAONT_DB=hlaont_db/`; without either, the pool lives inside the installed package.
41
+
42
+ `hlaont update-anchors --db-dir hlaont_db/` rebuilds the anchor set against a new pool (maintainers only; needs `cd-hit-est` on PATH).
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ # FASTQ input
48
+ hlaont run SAMPLE_ID reads.fastq --out-dir OUT/
49
+
50
+ # BAM/CRAM input (region set auto-derived from the @SQ header — no build/reference flag needed)
51
+ hlaont run SAMPLE_ID --bam aligned.bam --out-dir OUT/
52
+ hlaont run SAMPLE_ID --bam aligned.cram --reference ref.fa --out-dir OUT/
53
+
54
+ # Use real read-backed phase (HP/PS tags), when the input BAM has them
55
+ hlaont run SAMPLE_ID --bam phased.bam --phased --out-dir OUT/
56
+ ```
57
+
58
+ Each run writes, into `--out-dir`:
59
+
60
+ | file | contents |
61
+ |---|---|
62
+ | `{sample}.calls.tsv` | one row per haplotype call: gene, copy number, nearest allele, novelty tag, per-field GQ, read support, consensus QV |
63
+ | `{sample}.consensus.fa` + `.consensus.qv.tsv` | the polished per-haplotype consensus sequence and its per-base quality |
64
+ | `{sample}.variants.vcf` | variants relative to the nearest catalogued allele |
65
+ | `{sample}.qc.json` | per-gene copy-number estimates, C4 form breakdown, phasing routing (if `--phased`), and failure reasons for any gene that couldn't be called |
66
+
67
+ Run `hlaont run --help`, `hlaont update-db --help`, or `hlaont update-anchors --help` for the full flag list.
68
+
69
+ ## License
70
+
71
+ hlaont's own code is MIT — see [LICENSE](LICENSE). The distributed package also contains Badread's error model (GPL-3.0-only), so the package as a whole is `MIT AND GPL-3.0-only`.
72
+
73
+ `resources/anchors/vendor/` ports a 136-allele anchor set from [FuFiHLA](https://github.com/jingqing-hu/FuFiHLA) (MIT); `resources/models/vendor/` ports an ONT R10.4.1 error model from [Badread](https://github.com/rrwick/Badread) (GPLv3). See each `NOTICE.md`/license file for full attribution. If you use hlaont, please also cite FuFiHLA (`10.1093/bioinformatics/btag231`).
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "hlaont"
7
+ version = "0.1.0"
8
+ description = "Confidence-aware full-field HLA typing from ONT R10 long reads"
9
+ readme = "README.md"
10
+ # hlaont's own code is MIT; resources/models/vendor/nanopore2023.gz is
11
+ # Badread's error model, GPL-3.0-only (see that directory's NOTICE.md).
12
+ license = "MIT AND GPL-3.0-only"
13
+ license-files = [
14
+ "LICENSE",
15
+ "src/hlaont/resources/anchors/vendor/FUFIHLA_LICENSE",
16
+ "src/hlaont/resources/models/vendor/BADREAD_LICENSE",
17
+ ]
18
+ authors = [{ name = "Aleix Canalda" }]
19
+ requires-python = ">=3.11"
20
+ dependencies = [
21
+ "pysam",
22
+ "numpy",
23
+ "pyyaml",
24
+ ]
25
+ keywords = ["HLA", "HLA typing", "nanopore", "ONT", "long reads", "MHC", "bioinformatics", "genomics"]
26
+ classifiers = [
27
+ "Development Status :: 3 - Alpha",
28
+ "Environment :: Console",
29
+ "Intended Audience :: Science/Research",
30
+ "Operating System :: POSIX :: Linux",
31
+ "Operating System :: MacOS",
32
+ "Programming Language :: Python :: 3",
33
+ "Programming Language :: Python :: 3 :: Only",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ dev = ["pytest", "ruff", "mypy", "types-PyYAML", "build", "twine"]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/aleixcanalda/hlaont"
44
+ Repository = "https://github.com/aleixcanalda/hlaont"
45
+ Issues = "https://github.com/aleixcanalda/hlaont/issues"
46
+
47
+ [project.scripts]
48
+ hlaont = "hlaont.cli:main"
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["src"]
52
+ include = ["hlaont*"]
53
+
54
+ # Checked-in resources only; templates/raw, templates/pool and
55
+ # anchors/build_staging are regenerated by update-db/update-anchors.
56
+ [tool.setuptools.package-data]
57
+ hlaont = [
58
+ "resources/genes.yaml",
59
+ "resources/models/*.yaml",
60
+ "resources/models/vendor/*",
61
+ "resources/regions/*.bed",
62
+ "resources/regions/*.yaml",
63
+ "resources/anchors/*.gz",
64
+ "resources/anchors/*.json",
65
+ "resources/anchors/vendor/*",
66
+ "resources/templates/assembly_bundle/*",
67
+ "resources/controls/*.gz",
68
+ ]
69
+
70
+ [tool.setuptools.exclude-package-data]
71
+ "*" = ["test_*.py", "*.pyc"]
72
+
73
+ [tool.pytest.ini_options]
74
+ testpaths = ["tests"]
hlaont-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"