gapms 1.3.2__py3-none-any.whl

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 (69) hide show
  1. gapms-1.3.2.dist-info/METADATA +92 -0
  2. gapms-1.3.2.dist-info/RECORD +69 -0
  3. gapms-1.3.2.dist-info/WHEEL +5 -0
  4. gapms-1.3.2.dist-info/entry_points.txt +3 -0
  5. gapms-1.3.2.dist-info/licenses/LICENSE +21 -0
  6. gapms-1.3.2.dist-info/licenses/THIRD_PARTY.md +21 -0
  7. gapms-1.3.2.dist-info/top_level.txt +1 -0
  8. gapms_v1/__init__.py +2 -0
  9. gapms_v1/__main__.py +2 -0
  10. gapms_v1/_genesensus/LICENSE +27 -0
  11. gapms_v1/_genesensus/VENDORED.json +53 -0
  12. gapms_v1/_genesensus/__init__.py +10 -0
  13. gapms_v1/_genesensus/__main__.py +4 -0
  14. gapms_v1/_genesensus/adaptive.py +157 -0
  15. gapms_v1/_genesensus/annotation.py +126 -0
  16. gapms_v1/_genesensus/available.py +64 -0
  17. gapms_v1/_genesensus/cli.py +149 -0
  18. gapms_v1/_genesensus/config.py +274 -0
  19. gapms_v1/_genesensus/corroborated.py +60 -0
  20. gapms_v1/_genesensus/diagnostics.py +19 -0
  21. gapms_v1/_genesensus/direct_molecular.py +29 -0
  22. gapms_v1/_genesensus/exchange.py +115 -0
  23. gapms_v1/_genesensus/exon_support.py +36 -0
  24. gapms_v1/_genesensus/genome.py +122 -0
  25. gapms_v1/_genesensus/graph.py +279 -0
  26. gapms_v1/_genesensus/graph_cache.py +175 -0
  27. gapms_v1/_genesensus/intervals.py +104 -0
  28. gapms_v1/_genesensus/isoform_guards.py +54 -0
  29. gapms_v1/_genesensus/isoforms.py +117 -0
  30. gapms_v1/_genesensus/joint.py +60 -0
  31. gapms_v1/_genesensus/loading.py +166 -0
  32. gapms_v1/_genesensus/local_molecular.py +112 -0
  33. gapms_v1/_genesensus/locus_select.py +137 -0
  34. gapms_v1/_genesensus/models.py +93 -0
  35. gapms_v1/_genesensus/molecular.py +222 -0
  36. gapms_v1/_genesensus/molecular_exchange.py +60 -0
  37. gapms_v1/_genesensus/molecular_state_utility.py +104 -0
  38. gapms_v1/_genesensus/molecular_strategy.py +83 -0
  39. gapms_v1/_genesensus/normalization.py +71 -0
  40. gapms_v1/_genesensus/orf_diagnostics.py +55 -0
  41. gapms_v1/_genesensus/peptide_context.py +167 -0
  42. gapms_v1/_genesensus/peptides.py +150 -0
  43. gapms_v1/_genesensus/pipeline.py +596 -0
  44. gapms_v1/_genesensus/provenance.py +54 -0
  45. gapms_v1/_genesensus/rna.py +175 -0
  46. gapms_v1/_genesensus/rna_geometry.py +114 -0
  47. gapms_v1/_genesensus/scoped.py +17 -0
  48. gapms_v1/_genesensus/scoring.py +46 -0
  49. gapms_v1/_genesensus/selection.py +336 -0
  50. gapms_v1/_genesensus/source_splice.py +19 -0
  51. gapms_v1/_genesensus/splice_prior.py +100 -0
  52. gapms_v1/_genesensus/state_utility.py +96 -0
  53. gapms_v1/_genesensus/support.py +189 -0
  54. gapms_v1/assessment.py +274 -0
  55. gapms_v1/classification.py +117 -0
  56. gapms_v1/cli.py +74 -0
  57. gapms_v1/common.py +67 -0
  58. gapms_v1/confidence_features.py +129 -0
  59. gapms_v1/consensus_engine.py +201 -0
  60. gapms_v1/mapping.py +144 -0
  61. gapms_v1/models.py +169 -0
  62. gapms_v1/orf_projection.py +249 -0
  63. gapms_v1/outputs.py +287 -0
  64. gapms_v1/peptides.py +54 -0
  65. gapms_v1/protein_mapper.py +125 -0
  66. gapms_v1/refinement.py +245 -0
  67. gapms_v1/report_figure.py +62 -0
  68. gapms_v1/rnaseq.py +91 -0
  69. gapms_v1/workflow.py +256 -0
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: gapms
3
+ Version: 1.3.2
4
+ Summary: Gene model assessment and peptide-guided annotation refinement
5
+ Author-email: Qussai Abbas <qussai.abbas@tum.de>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/qussai96/GAP-MS
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ License-File: THIRD_PARTY.md
12
+ Requires-Dist: peplocus==0.5.6
13
+ Requires-Dist: pandas>=1.5
14
+ Requires-Dist: scipy>=1.10
15
+ Requires-Dist: scikit-learn>=1.2
16
+ Requires-Dist: matplotlib>=3.6
17
+ Requires-Dist: xgboost-cpu<4,>=2.1.4; platform_system == "Linux"
18
+ Requires-Dist: xgboost<4,>=2.1.4; platform_system != "Linux"
19
+ Dynamic: license-file
20
+
21
+ # GAP-MS
22
+
23
+ GAP-MS uses mass-spectrometry peptides to assess gene predictions, combine
24
+ annotations and identify peptide-supported changes for review.
25
+
26
+ ## Install
27
+
28
+ Python 3.10 or newer:
29
+
30
+ ```bash
31
+ pip install gapms==1.3.2
32
+ ```
33
+
34
+ For runs with a BAM file, also install the RNA reconstruction tools:
35
+
36
+ ```bash
37
+ conda install -c conda-forge -c bioconda stringtie transdecoder=5.5.0
38
+ ```
39
+
40
+ Alternatively, build an Apptainer image from this checkout. It includes these tools:
41
+
42
+ ```bash
43
+ apptainer build --fakeroot gapms-1.3.2.sif gapms.def
44
+ apptainer run gapms-1.3.2.sif -a assembly.fa -p peptides.tsv -g genes.gtf
45
+ ```
46
+
47
+ Version 1.3.2 must be uploaded to PyPI before the pip command above is available.
48
+ See [container instructions](packaging/CONTAINERS.md) for Docker Hub.
49
+
50
+ ## Run
51
+
52
+ - **Assembly + peptides:** map peptides to the six-frame genome translation.
53
+ `gapms -a assembly.fa -p peptides.tsv`
54
+ - **Add BAM:** include RNA-supported splice paths and reconstruct peptide-supported ORF candidates.
55
+ `gapms -a assembly.fa -p peptides.tsv -b sorted.bam`
56
+ - **Add annotation:** map across annotated exons, score gene models and propose supported changes.
57
+ `gapms -a assembly.fa -p peptides.tsv -g genes.gtf`
58
+ - **Annotation + BAM:** combine gene-model assessment with RNA-supported reconstruction.
59
+ `gapms -a assembly.fa -p peptides.tsv -g genes.gtf -b sorted.bam`
60
+ - **Multiple annotations:** automatically build a peptide-guided consensus. BAM is optional here too.
61
+ `gapms -a assembly.fa -p peptides.tsv -g helixer.gtf -g another.gff3`
62
+
63
+ GTF and GFF3 are accepted. BAM files must be coordinate-sorted and use the
64
+ assembly's sequence names. FragPipe, Casanovo and plain peptide lists are supported.
65
+ Use `-o results` to choose an output directory (default: `./GAPMS_output`) and
66
+ `-t 16` to change the default of **8 threads**.
67
+
68
+ Analysis uses **trypsin-compatible exact matches** by default; add `--non-tryptic`
69
+ for other enzymes. Isoleucine and leucine are treated as equivalent. All-match and
70
+ tryptic-match BED tracks are always retained. Optional one-edit rescue is separate
71
+ from the exact evidence used to support gene models. See `gapms --help-all`.
72
+
73
+ ## Results
74
+
75
+ Start with **report.html**; **report.log** records the run. Main outputs include
76
+ `peptides.bed`, `peptides.tryptic.bed`, `peptides.igv.bed`,
77
+ `unmapped_peptides.tsv`, and, when gene models are available,
78
+ `all_proteins_scores.tsv` and `supported_genes.gtf`. Multiple annotations also
79
+ produce `consensus.gff3` and `consensus_proteins.faa`.
80
+
81
+ `review/` contains supported novel/alternative proposals when available.
82
+ They require review and are not automatically applied. Existing annotated isoforms
83
+ are considered before proposing changes. Without an input annotation, RNA-derived
84
+ ORFs are candidates whose novelty cannot be assessed. Peptide support does not
85
+ validate every boundary of a gene model.
86
+
87
+ [Technical guide](docs/v1/README.md) ·
88
+ [Five-mode validation of 1.3.2](docs/v1/evaluation/five_modes_hop_20261113/REPORT.md)
89
+
90
+ ## Cite
91
+
92
+ [GAP-MS manuscript on bioRxiv](https://www.biorxiv.org/content/10.64898/2026.03.17.712294v3)
@@ -0,0 +1,69 @@
1
+ gapms-1.3.2.dist-info/licenses/LICENSE,sha256=Iqp40bO7OPb8SYOsXc3GRyGTmApXF7AaHuVpZUNG1_U,1069
2
+ gapms-1.3.2.dist-info/licenses/THIRD_PARTY.md,sha256=pBFpUdAgmVJWgIfB9zkaMtk7cQR01fyBpKmrQxa8H7M,929
3
+ gapms_v1/__init__.py,sha256=otNTmNz5U3X_8VxG2Qm9BrMwMHQe_AyM40AmoaZGjMQ,81
4
+ gapms_v1/__main__.py,sha256=ee5vE0xcUZM3fPmxicvcw-IJXkm6nOwxARREHBWpF8Q,47
5
+ gapms_v1/assessment.py,sha256=IOph6Sn02ZFsF24t8tJv8Qc49CwXpgNkhfw5LfvPFVE,25145
6
+ gapms_v1/classification.py,sha256=LaOnVS8H-2kJGflSx5g22jOj0E7lJDMsjQlOi_5_4ts,7549
7
+ gapms_v1/cli.py,sha256=D3oRYPZdpX5Uc4zg_bRDP1G00Hko_eKrmKtNfc9_6Go,5016
8
+ gapms_v1/common.py,sha256=H8rVGBAoDTkYKz-cKuvo9Qxa4Zgxa7AyQaC_bKNIRJQ,2573
9
+ gapms_v1/confidence_features.py,sha256=Naw8KE7Agr6psaahPQx98mqaJVZltaeM_7yI4ELF9_c,4593
10
+ gapms_v1/consensus_engine.py,sha256=Vlw3C1B6AeA8M8ip-2Ew4usSOqx9cYsnCNPLHi2CH5Q,12677
11
+ gapms_v1/mapping.py,sha256=pmCxv6bwEcQPFGNYxaDSdft-Frc4GcNaex7uZqPCvvU,10952
12
+ gapms_v1/models.py,sha256=kx1p2QdWdWCuiCK0XOahOQzXKiRW909nuidw-wdYzrc,7770
13
+ gapms_v1/orf_projection.py,sha256=t2l7VvJo-QYeym-TGvp57V8zy_caBLgkGq8MC5t9gxE,10031
14
+ gapms_v1/outputs.py,sha256=k52_L_mxjKpsAp8FyRe8D-H0XkLv4Qy6hqurIRv9cc0,21225
15
+ gapms_v1/peptides.py,sha256=8wphTw9LPTGVSo8R4pf9alteOvI8lnVJCJr-v1lg2Ik,3836
16
+ gapms_v1/protein_mapper.py,sha256=oLCfurtF-fDzH8iOhgUhI1j4Elqp0H9CxZBrmUfc9b8,5643
17
+ gapms_v1/refinement.py,sha256=Cdqs30GtqefNziwf8Kc9jovpfiS4WWtKEOl_gAU0ag0,18973
18
+ gapms_v1/report_figure.py,sha256=8yyquSCAJYuDObWU-5NnkKXgbtjPfTFi-fBkRKkbk9w,4953
19
+ gapms_v1/rnaseq.py,sha256=yCmq2tPT6VQ_AcT6D9O2p-MwigeKL_e9yz_NHuTOJq4,5387
20
+ gapms_v1/workflow.py,sha256=WGbFOzGDLXqiMypQh_r7sxV2J0XAcWnjiPvsfCBaHiA,17608
21
+ gapms_v1/_genesensus/LICENSE,sha256=4mXgnEq1uZeZh2rYpQpaX11MzNhdJCiv4iWBCg2dnQU,1529
22
+ gapms_v1/_genesensus/VENDORED.json,sha256=jAptYlnPDYt1sqCTXTS8sgWJ43joLmePmtEt17wDflA,4058
23
+ gapms_v1/_genesensus/__init__.py,sha256=VAoRWVVNvRgrjDHm_SVOkfsf-9LaCAfWDkJD7SIFjM4,373
24
+ gapms_v1/_genesensus/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
25
+ gapms_v1/_genesensus/adaptive.py,sha256=Py83NlGCkHUqZJ5-hxCFe-NIT-ChPVUB4hG_jA6mvRs,9330
26
+ gapms_v1/_genesensus/annotation.py,sha256=lOaPtU3-0LX_YPfNtKjlP3lbAbWNSzT8BVpsvDpqdsw,5047
27
+ gapms_v1/_genesensus/available.py,sha256=BQ_wVnMFf-uwy9Hc7vDFhLtdDi_2fmEN1ScyaP_7GB8,4037
28
+ gapms_v1/_genesensus/cli.py,sha256=iItQw9CkOUvOc5vJ10DhuGNx0utgtqEHoBHsRQAKns0,5832
29
+ gapms_v1/_genesensus/config.py,sha256=F-gRHL_r-dHkz1PPHdatcM74ru65Q1L9L8nVagGXwf8,11680
30
+ gapms_v1/_genesensus/corroborated.py,sha256=A0EgNZQa7Vidpk_o80fTZAQL1k6UTAr3vRpVe3Xs-aw,3512
31
+ gapms_v1/_genesensus/diagnostics.py,sha256=bgDgh4JiiagsfH7aJefQqIyJMBiVdnOiGqnunM3i8ak,784
32
+ gapms_v1/_genesensus/direct_molecular.py,sha256=9MFu6uwGEti3jm0oXwQWLdlemF_b7QMjVsuXME2ZS1s,1242
33
+ gapms_v1/_genesensus/exchange.py,sha256=rZ8kcc9wfppbjSWr-ehQ3NNyOQXKIxIcSr8gmBbFvho,6706
34
+ gapms_v1/_genesensus/exon_support.py,sha256=kXm-zgRHHJ-fvOT3Iy_Y_JEf0jKYU7-wdpl_xcWROzQ,1611
35
+ gapms_v1/_genesensus/genome.py,sha256=MTGGt7HeqNrkgOSlkgJo9idw7DdBQ-wKHLI7vuPreIU,4664
36
+ gapms_v1/_genesensus/graph.py,sha256=zg-Beet6sIv-hDy-OY7JbtcJgzxtJa4JAAXrnPP9VYk,11393
37
+ gapms_v1/_genesensus/graph_cache.py,sha256=mFzIIMTK0Qdd4Ul-Roy5j4v6EAb-R8jkjeuY0sje--4,6866
38
+ gapms_v1/_genesensus/intervals.py,sha256=CvCwWoSroaonJEZtwsL7rft6HoSFJFCYJmpkXB9PqYs,2632
39
+ gapms_v1/_genesensus/isoform_guards.py,sha256=cWe_kA4gAYeMk-NrPCc8z-jfvnK37s4PiaPf7TVP2is,3448
40
+ gapms_v1/_genesensus/isoforms.py,sha256=hib08QjsWajcfe25Fkzb3j_vgRrBVbMq-76QWaWTA-M,6051
41
+ gapms_v1/_genesensus/joint.py,sha256=NudLOpssuPBxWYaJdOF-195PcIAdiqZeKDq579mpHa0,3451
42
+ gapms_v1/_genesensus/loading.py,sha256=3RAuz_jeXxuUH0F-UF9wo-8t3e1g2hPVC-BSfFBKOBA,5763
43
+ gapms_v1/_genesensus/local_molecular.py,sha256=1JIfa_EWD_f_bVM2DiB7WGOdleuiwAL7vcmF2yaL7GM,5025
44
+ gapms_v1/_genesensus/locus_select.py,sha256=68cm4uuAd2g0m6yfPFZNnWJtRcTrvOXErqBXBfn_EAo,10011
45
+ gapms_v1/_genesensus/models.py,sha256=oy-USiDzc-9_vehKuERzDK7qUhheu4Krcyn9WtiIXGI,3010
46
+ gapms_v1/_genesensus/molecular.py,sha256=j4geCpL-B_L_Mh2uuE0lDyv8F1Gx_TytjHC6lJoQ8v8,9113
47
+ gapms_v1/_genesensus/molecular_exchange.py,sha256=xVTeT_Y3Q1NQN0vXO1aWVIO05YzwpHvux2d-ffd34_s,3500
48
+ gapms_v1/_genesensus/molecular_state_utility.py,sha256=EaI76997pt3YxkAg_rBe1DEqJVL44FkKqgzktxdhC9M,9198
49
+ gapms_v1/_genesensus/molecular_strategy.py,sha256=YZVG9C4uZJXnYh9b6cNC7kFbgIUs39pzyOeK72bLgMU,6112
50
+ gapms_v1/_genesensus/normalization.py,sha256=pMzzvcydRPEkVaQqJPFTk7L4zDCMSSBl-YeGWbPSY94,2786
51
+ gapms_v1/_genesensus/orf_diagnostics.py,sha256=UGCoc2LA-V_PengGGf_Rmg-ayjOYlw1lfKz0dRIeSPI,3925
52
+ gapms_v1/_genesensus/peptide_context.py,sha256=S1xuL-jsc8zR_94uWwDigCYK5PqEbSbQwjA5Ut_jce0,8804
53
+ gapms_v1/_genesensus/peptides.py,sha256=avHwhvGYoRkKUwsV-nziBZLXxySzmhWmhbjDBDYW-us,5628
54
+ gapms_v1/_genesensus/pipeline.py,sha256=08b3-9YLIdVrQtJbkR6JtGNwLH9OAt5waUkkK-u7XxU,27732
55
+ gapms_v1/_genesensus/provenance.py,sha256=AwMuhfyCfQWhV3m8ENbMwPgBQ_M75JFbN2HVbvxRpIU,1690
56
+ gapms_v1/_genesensus/rna.py,sha256=scQOP_m_K9Ujz5fgGV9eCysl542fugqCo1jjuAQFEWY,6308
57
+ gapms_v1/_genesensus/rna_geometry.py,sha256=fWTUkgZW5V9YMsmccHX0XcOCXujXbiedHKXUMi_b9aI,6880
58
+ gapms_v1/_genesensus/scoped.py,sha256=JMW9g2SL5MLOrzJ9w0hcd06kaLBjkC7gYrQReta_aDE,844
59
+ gapms_v1/_genesensus/scoring.py,sha256=A8AtFy2toZ2sFKm41XStZviugSv_6j7TspIES3S4jNI,1827
60
+ gapms_v1/_genesensus/selection.py,sha256=Myh9cPDdRCQJoU7ZgAwVJfQZJ9TSwoGqAebyinJvVNs,12780
61
+ gapms_v1/_genesensus/source_splice.py,sha256=XbDOlZ6lvWb7zPF3N6sfTnyin0Ep2B4ecwYQGRTnBas,1161
62
+ gapms_v1/_genesensus/splice_prior.py,sha256=CyHrs8abY2NMDUPGvcmM-qa-5rULUJOIt_JCfY-fBgU,6315
63
+ gapms_v1/_genesensus/state_utility.py,sha256=wBs4P5xalbYb8HuWRHZq4WeA9otC1zXSgkKsz4Yp2NY,8114
64
+ gapms_v1/_genesensus/support.py,sha256=I3TdiwTysfR0YKkJT9JhN0E45lCz7W4FUleE637YGt4,8351
65
+ gapms-1.3.2.dist-info/METADATA,sha256=7tdIV-F5kUMHY2holFk-G08FhkENgjUInGIb8EIE3vs,3738
66
+ gapms-1.3.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
67
+ gapms-1.3.2.dist-info/entry_points.txt,sha256=wYl6UPdSyDlcz17rAHlJXtEffiVZXO1vZzzGK6GP6L8,73
68
+ gapms-1.3.2.dist-info/top_level.txt,sha256=XGtU_3AZ7w-9rWxs2SpfqCoZMAwcVoW9D_bBOL4nvbc,9
69
+ gapms-1.3.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ gapms = gapms_v1.cli:main
3
+ gapms-v1 = gapms_v1.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Qussai Abbas
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,21 @@
1
+ # Third-party software
2
+
3
+ ## PepLocus 0.5.6
4
+
5
+ PepLocus is an external MIT-licensed Python dependency, installed by pip.
6
+ The GAPMS 1.3 wheel does not vendor the older `gapms._peplocus` implementation.
7
+ Source and license: https://github.com/qussai96/PepLocus.
8
+
9
+ ## GeneSensus 0.6.0a3
10
+
11
+ The consensus engine in `gapms_v1/_genesensus` is vendored from the author's
12
+ GeneSensus 0.6.0a3 release under BSD-3-Clause. Its license and per-file original
13
+ SHA-256 hashes are included there. Absolute imports in rna_geometry.py were
14
+ changed to relative imports for the private package namespace. The original
15
+ inference algorithms and default biological coefficients are retained.
16
+
17
+ ## Retained GAPMS algorithms
18
+
19
+ The protein matcher, confidence feature/seed rules and TransDecoder coordinate
20
+ projection are retained from GAPMS under this project's MIT license. They are
21
+ included directly in the v1 package, without a dependency on the legacy release.
@@ -0,0 +1 @@
1
+ gapms_v1
gapms_v1/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ """Peptide-centric, evidence-traceable GAPMS workflows."""
2
+ __version__ = '1.3.2'
gapms_v1/__main__.py ADDED
@@ -0,0 +1,2 @@
1
+ from .cli import main
2
+ raise SystemExit(main())
@@ -0,0 +1,27 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, GeneSensus contributors
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+ 3. Neither the name of the copyright holder nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software without
16
+ specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "GeneSensus",
3
+ "version": "0.6.0a3",
4
+ "license": "BSD-3-Clause",
5
+ "source": "Genesensus/releases/0.6.0a3/package/src/genesensus",
6
+ "original_sha256": {
7
+ "__init__.py": "540a1159554dbd182b8c31e6fd254e91fb1ffbd2da0807d60e4243ed22058cce",
8
+ "__main__.py": "307299fda7b77d22c64cb51430ec75e5f59d78e9c948786afb3b2544fe45e4b7",
9
+ "adaptive.py": "3f2f3736518290752a649e7e8710857be3484fe0a13d5501e211bf8c0ea6bd1b",
10
+ "annotation.py": "94e68fb54dfed0b5ff60f7cdb4a8e53f795b01b58d4b34fc055a6cbc3a6a76cc",
11
+ "available.py": "050ff05673057febb0cbd1dceef0c584bb5d0e2ff67e610dd5273268fffb181f",
12
+ "cli.py": "888b50c3d0a4394bce739bc9d740e1b86371d2eb60b6a107a011ec45000a9ecd",
13
+ "config.py": "17e8111cbfebf9d1e4cf53cf1dd6ad70cef8aeeeb94352fd2fc9d56a0197c1ff",
14
+ "corroborated.py": "03412035941aed589da64fe8f347d364040bd64e944c0af7bd1a557b75ecf9ac",
15
+ "diagnostics.py": "6e00e087826289a82c7c7eda25e7d0a88c893018957673a21aa9ee9ccde2f1a9",
16
+ "direct_molecular.py": "f4c16eeaec0612d8b78e6d285f04162dd95e985fdbed032356cb97304d994b5b",
17
+ "exchange.py": "ad9f2471cf707e9a5b8d25abf9e850dcd3723905ca23121c4abf209816c5be1a",
18
+ "exon_support.py": "9179bece04471c9f9fbce4f7232fd8fc911fd2329853bfb076997fc5c5913b34",
19
+ "genome.py": "313186b7b1dea8dae480e4a5920268f62770ec374143ec0a1cb23bbee3eb7885",
20
+ "graph.py": "ce0f8179eb7ab08bfe843cbe398ec96ed709833c6d25ae090005eb9cf3fd5589",
21
+ "graph_cache.py": "985cc820c4cad1075de1497e468cb98f8bfa1006fe47c8e48deb98d2c8defbee",
22
+ "intervals.py": "0af0b05a84aba1aa2724466dc2c2fbadfb7a1e8485245098266a645c1f4fa98b",
23
+ "isoform_guards.py": "7167bf900e2001878c93e36b3c273ccfe8dfbe72b7eece0f89a3dfed354fda2b",
24
+ "isoforms.py": "8626f4f108ec59a8dc7dedb9164cdbde3fef811ac155b32afbbe9059a59303e3",
25
+ "joint.py": "36e74b3a9b2cb8f07159868974e17ed7de4f70801d8aa65e283ab9efd9a91dad",
26
+ "loading.py": "dd102ecff8de5f1b941f417e505f70a3ef2ddded60da13d50be0527c504a3810",
27
+ "local_molecular.py": "d4921f6bf1160ff7ff6d53360e207b58639d95eba2c002fbbdc985db268bec63",
28
+ "locus_select.py": "ebc726e2eb807768349bac9f3c564d9d626d45c4ebbce5c4aea05705f9ff100a",
29
+ "models.py": "a32f944a20f373ef7fbde84ab844730caeea52185ebb82ab7329fd5ad8885c62",
30
+ "molecular.py": "8f881e0a92fe07f2ff321daeb84d250f2bfc1751b1fd3cad8c70ba949a10f2ff",
31
+ "molecular_exchange.py": "c554de4ff637435350374bd73b56965483b4e58cf0a47beec7677e7df777e3fb",
32
+ "molecular_state_utility.py": "11a23bebdf7ba6ddd8c64020feb05ed4312a2552f8e0590aaa0ce4b717610bd3",
33
+ "molecular_strategy.py": "619546f42e2e6495e7621f5be9c342ee415b80852cdfda73c8e78aef66cb80c5",
34
+ "normalization.py": "a4ccf3bdcc9d44f12455a42a24f15393b2f8cc308c492065f9878659b3d263de",
35
+ "orf_diagnostics.py": "5060a87362c0f95fcf7a780619ffd19a0f9aca3398970d657cacf475121e48f2",
36
+ "peptide_context.py": "4b5c6e2fe8ec73ccd1ffde2e5b00e280260ae4fa846d26d0c2303952dfe371ed",
37
+ "peptides.py": "6af1f086f198a1190a530b15fa7ce20592d7c724b39a15a685b8c3043616faeb",
38
+ "pipeline.py": "d3c6f7fbd60b21d56b42d25b911e89b463702c7f4e02de706949242bebbb5f15",
39
+ "provenance.py": "03032e85fc827d05a15779bc10d6ccc0f80143f33be4915b3761d56efc51a485",
40
+ "rna.py": "b1c40e3ff9bf2bd523cf97e0195f5e0b2b25e78d9fba0a82a358e3b804051166",
41
+ "rna_geometry.py": "ca77e0f5ba1c41929cc419d1efec5aba74d131bbec41850f142cca9278b45877",
42
+ "scoped.py": "24c5bd83648be4c2ceaf327dc3485c774ea468b063902ee062b4117ad6bf6831",
43
+ "scoring.py": "03c02d172dada19dac14a9b8d574ad66f8ae812bffea3ed3b292044b74b88cd2",
44
+ "selection.py": "33287d70f0dd442409a14ed9800c1525f41927d4d2c281aa01e6f28a726f54db",
45
+ "source_splice.py": "5db0ce959ea5bd66fbccf17737ab1f4e7ca29f4129d81e1e7306101914e705ab",
46
+ "splice_prior.py": "0b21ebb3c69b63634c0d43c6bdc98cfaa6bee6b50b509388b7f2427d8f9f0605",
47
+ "state_utility.py": "c01b383f9c5a95b61bf07b9644766ae16780f68b42d735d28242accf8629d8d6",
48
+ "support.py": "2374dd8b04f2b1f47460a9094fd261374138e650b3ed6e05525784eb7ed81ade"
49
+ },
50
+ "changes": {
51
+ "rna_geometry.py": "Two absolute imports changed to relative imports for private namespace; no algorithm changes."
52
+ }
53
+ }
@@ -0,0 +1,10 @@
1
+ """GeneSensus: reference-independent gene reconstruction and refinement."""
2
+
3
+ __version__ = "0.6.0a3"
4
+
5
+
6
+ def run(config_path, output, threads=None, cache=None, resume=False):
7
+ """Run deterministic evidence integration; return a pipeline.RunResult."""
8
+ from .pipeline import run as _run
9
+
10
+ return _run(config_path, output, threads=threads, cache=cache, resume=resume)
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())
@@ -0,0 +1,157 @@
1
+ """Experimental reference-free local evidence policy; not calibrated probabilities.
2
+
3
+ Missing peptide/RNA observations never independently delete an original model.
4
+ Peptides must distinguish the actual coding dispute; graph paths have no invented q.
5
+ """
6
+ from .intervals import CodingIndex, disputed, intersection_length, merge
7
+ from .molecular import local_risk
8
+ from .selection import predictor_support, choose_backbone, chain_key, _structure
9
+
10
+
11
+ def peptide_dispute(c, old, peptides, regions):
12
+ """Sequence-deduplicated, unique-placement peptides already frame-validated."""
13
+ def side(a, b):
14
+ seqs = sorted(s for s in a.peptides - b.peptides
15
+ if intersection_length(peptides[s].blocks, regions))
16
+ blocks = merge(iv for s in seqs for iv in peptides[s].blocks)
17
+ coding = merge((max(x, a0), min(y, b0)) for x,y in a.model.cds
18
+ for a0,b0 in regions if max(x,a0) < min(y,b0))
19
+ size = sum(y-x for x,y in coding)
20
+ coverage = intersection_length(blocks, coding)/size if size else 0.
21
+ junctions = set(a.model.introns)-set(b.model.introns)
22
+ bridged = sorted(iv for iv in junctions if any(
23
+ iv in tuple((x[1], y[0]) for x,y in zip(peptides[s].blocks, peptides[s].blocks[1:]))
24
+ for s in seqs))
25
+ independent = len(blocks)
26
+ strong = bool(bridged) or (len(seqs)>=2 and independent>=2 and coverage>=0.5)
27
+ # A local short peptide can supply a small score, but cannot alone pass
28
+ # the change gate unless it spans the differing junction.
29
+ value = max(coverage*len(seqs)/(len(seqs)+2.),
30
+ len(bridged)/len(junctions) if junctions else 0.)
31
+ return dict(sequences=seqs, coverage=coverage, bridged_junctions=bridged,
32
+ independent_blocks=independent, strong=strong, value=value)
33
+ return side(c, old), side(old, c)
34
+
35
+
36
+ def compare_adaptive(c, old, peptides, support, chains, votes, n_sources, p):
37
+ m,o=c.model,old.model
38
+ regions=disputed(m,o,p['boundary_window_nt'])
39
+ pn,po=peptide_dispute(c,old,peptides,regions)
40
+ nr,nk=local_risk(c,regions,p['localizer_gate'])
41
+ rr,rk=local_risk(old,regions,p['localizer_gate'])
42
+ channels={}
43
+ if c.q is not None and old.q is not None:
44
+ channels['gene_quality']=(c.q,old.q,p['molecular_weight']*.5)
45
+ if nk and rk:
46
+ channels['residue_quality']=(1-nr,1-rr,p['molecular_weight']*.5)
47
+ if pn['sequences'] or po['sequences']:
48
+ channels['peptide']=(pn['value'],po['value'],p['peptide_weight'])
49
+ ni=set(m.introns)-set(o.introns);oi=set(o.introns)-set(m.introns)
50
+ rn,ro=support.rna_score(m,ni),support.rna_score(o,oi)
51
+ if rn or ro:
52
+ channels['rna']=(rn,ro,p['rna_weight'])
53
+ an,ao=support.protein_score(m,regions),support.protein_score(o,regions)
54
+ if an or ao:
55
+ channels['protein']=(an,ao,p['protein_weight'])
56
+ sn,so=_structure(c,n_sources,chains),_structure(old,n_sources,chains)
57
+ if sn!=so: channels['structure']=(sn,so,p['structure_weight'])
58
+ # Half-weights give q and residue profiles one joint molecular budget.
59
+ # If only one is measured, it receives the full molecular budget.
60
+ measured=[k for k in ('gene_quality','residue_quality') if k in channels]
61
+ if len(measured)==1:
62
+ k=measured[0];a,b,w=channels[k];channels[k]=(a,b,2*w)
63
+ den=sum(w for a,b,w in channels.values())
64
+ delta=sum(w*(a-b) for a,b,w in channels.values())/den if den else 0.
65
+ molecular=(c.q is not None and old.q is not None and c.q-old.q>=p['q_advantage'])
66
+ residue=nk and rk and rr-nr>=p['risk_advantage']
67
+ rna=bool(ni) and rn>ro and all(support.rna_count(m,iv)>=support.min_rna_templates for iv in ni)
68
+ protein=an>=ao+.1
69
+ structural=(c.complete and not old.complete and
70
+ len(chains.get(chain_key(m),()))>=2)
71
+ distinguishing=any((molecular,residue,rna,protein,pn['strong'],structural))
72
+ reasons=[]
73
+ if not(c.complete and c.canonical): reasons.append('incomplete_or_noncanonical')
74
+ if m.length<p['minimum_retained_fraction']*o.length: reasons.append('truncation')
75
+ if not distinguishing: reasons.append('insufficient_distinguishing_evidence')
76
+ # Never erase a unique peptide on the incumbent to satisfy another channel.
77
+ if po['sequences']: reasons.append('incumbent_unique_peptide_conflict')
78
+ if nk and rk and nr>rr+p['risk_advantage']: reasons.append('local_risk_regression')
79
+ unsupported=[iv for iv in ni if not(support.supported_junction(m,iv,votes)
80
+ or iv in pn['bridged_junctions'])]
81
+ if c.graph_path and unsupported: reasons.append('unsupported_new_junction')
82
+ if delta<=p['replacement_margin']: reasons.append('absolute_evidence_margin')
83
+ return dict(event='replacement',candidate=c.uid,incumbents=[old.uid],
84
+ accepted=not reasons,reasons=reasons,policy=p['selection_policy'],
85
+ channels={k:dict(new=a,old=b,weight=w,delta=w*(a-b)) for k,(a,b,w) in channels.items()},
86
+ normalized_delta=delta,peptide_new=pn,peptide_old=po,
87
+ disputed_intervals=regions,new_junctions_supported=not unsupported,
88
+ triggers=dict(molecular=molecular,residue=residue,rna=rna,protein=protein,
89
+ peptide=pn['strong'],structural=structural),
90
+ graph_candidate=c.graph_path,missing_evidence_is_negative=False)
91
+
92
+
93
+ def _anchors(originals, source, support, chains, policy):
94
+ """Greedy non-overlapping original anchors, never based on sparse peptides.
95
+
96
+ Evidence-dependent changes are tested later by compare_adaptive. Original
97
+ anchors absent from the fallback predictor can be retained in separate
98
+ regions without requiring mass-spec detection.
99
+ """
100
+ index=CodingIndex();events=[]
101
+ # Preserve every fallback original, including genuine overlapping genes.
102
+ # Local alternatives must pass compare_adaptive, rather than bypassing its
103
+ # protections via an evidence-sorted initial anchor.
104
+ for c in sorted(originals,key=lambda c:(source not in c.sources,c.uid)):
105
+ if source in c.sources or (not index.conflicts(c) and c.complete and c.canonical):
106
+ index.add(c)
107
+ events.append(dict(event='original_anchor',candidate=c.uid,accepted=True,
108
+ reasons=[],policy=policy,missing_evidence_is_negative=False))
109
+ return index,events
110
+
111
+
112
+ def select_adaptive(candidates,source_models,peptides,support,p):
113
+ chains,votes,exons=predictor_support(candidates)
114
+ source,report=choose_backbone(candidates,source_models,chains,p)
115
+ if p['selection_policy']=='adaptive_locus':
116
+ # A genome/consensus fallback holds source choice independent of which
117
+ # experimental evidence is supplied. Evidence acts in local disputes.
118
+ # Fractions, not raw gene/peptide counts, avoid rewarding larger sets.
119
+ originals_by_source={s:[c for c in candidates if s in c.sources and not c.graph_path]
120
+ for s in source_models}
121
+ source=min(source_models,key=lambda s:(
122
+ -sum(c.complete and c.canonical for c in originals_by_source[s])/max(1,len(originals_by_source[s])),
123
+ -report['sources'][s]['mean_chain_agreement'],s))
124
+ report.update(policy_used=p['selection_policy'],fallback_source=source,
125
+ anchor_policy='source_then_private_originals' if p['selection_policy']=='adaptive_guarded' else 'genome_consensus_fallback_then_local_evidence',
126
+ peptide_counts_choose_backbone=False)
127
+ originals=[c for c in candidates if c.sources and not c.graph_path]
128
+ index,events=_anchors(originals,source,support,chains,p['selection_policy'])
129
+ ordered=sorted(candidates,key=lambda c:(c.graph_path,-int(c.complete and c.canonical),
130
+ -(c.q if c.q is not None else -1),-len(chains.get(chain_key(c.model),())),c.uid))
131
+ for c in ordered:
132
+ if c.uid in index.items: continue
133
+ olds=index.conflicts(c)
134
+ if len(olds)>1:
135
+ events.append(dict(event='replacement',candidate=c.uid,incumbents=[x.uid for x in olds],accepted=False,reasons=['fusion_or_multiple_incumbents']))
136
+ elif olds:
137
+ e=compare_adaptive(c,olds[0],peptides,support,chains,votes,len(source_models),p)
138
+ events.append(e)
139
+ if e['accepted']:index.remove(olds[0]);index.add(c)
140
+ else:
141
+ # Novel models need explicit support. Nonoverlapping original models
142
+ # are retained as anchors, even if no peptide was observed.
143
+ new_ok=all(support.supported_junction(c.model,iv,votes) for iv in c.model.introns)
144
+ supported=(len(chains.get(chain_key(c.model),()))>=2 or
145
+ (bool(c.model.introns) and support.rna_score(c.model)>=.5) or
146
+ len(c.peptides)>=2 or support.protein_score(c.model)>=.8)
147
+ accepted=c.complete and c.canonical and new_ok and supported
148
+ events.append(dict(event='addition',candidate=c.uid,incumbents=[],accepted=accepted,
149
+ reasons=[] if accepted else ['unsupported_novel_addition']))
150
+ if accepted:index.add(c)
151
+ return sorted(index.items.values(),key=lambda c:c.uid),events,source_report(report)
152
+
153
+
154
+ def source_report(report):
155
+ report['experimental']=True
156
+ report['reference_used']=False
157
+ return report
@@ -0,0 +1,126 @@
1
+ """GFF3/GTF readers and deterministic, phase-consistent GFF3 output."""
2
+
3
+ from pathlib import Path
4
+ from collections import defaultdict
5
+ from urllib.parse import unquote, quote
6
+ import re
7
+ from .models import Transcript
8
+ from .intervals import merge
9
+
10
+
11
+ def attributes(text):
12
+ if re.match(r"\s*[^\s;=]+=", text):
13
+ return {
14
+ k: unquote(v)
15
+ for k, v in (
16
+ part.strip().split("=", 1) for part in text.split(";") if "=" in part
17
+ )
18
+ }
19
+ return dict(re.findall(r'([^\s;]+)\s+"([^"\\]*(?:\\.[^"\\]*)*)"\s*;?', text))
20
+
21
+
22
+ def read_annotation(
23
+ path, source="prediction", allow_orphan_cds=False, origin="prediction"
24
+ ):
25
+ parents = {}
26
+ cds = defaultdict(list)
27
+ exons = defaultdict(list)
28
+ with Path(path).open() as f:
29
+ for number, line in enumerate(f, 1):
30
+ if line.startswith("##FASTA"):
31
+ break
32
+ if not line.strip() or line.startswith("#"):
33
+ continue
34
+ row = line.rstrip("\r\n").split("\t")
35
+ if len(row) != 9:
36
+ raise ValueError(f"{path}:{number}: expected nine columns")
37
+ chrom, _, kind, left, right, _, strand, phase, text = row
38
+ if kind not in ("mRNA", "transcript", "CDS", "exon"):
39
+ continue
40
+ if strand not in ("+", "-"):
41
+ raise ValueError(
42
+ f"{path}:{number}: CDS/transcript strand must be + or -"
43
+ )
44
+ a, b = int(left) - 1, int(right)
45
+ if not 0 <= a < b:
46
+ raise ValueError(f"{path}:{number}: invalid coordinates")
47
+ attr = attributes(text)
48
+ if kind in ("mRNA", "transcript"):
49
+ tid = attr.get("ID", attr.get("transcript_id"))
50
+ if not tid:
51
+ raise ValueError(f"{path}:{number}: missing transcript identifier")
52
+ key = (chrom, strand, tid)
53
+ gene = attr.get("Parent", attr.get("gene_id", tid))
54
+ if key in parents and parents[key] != gene:
55
+ raise ValueError(f"{path}:{number}: conflicting transcript parents")
56
+ parents[key] = gene
57
+ else:
58
+ ids = attr.get("Parent", attr.get("transcript_id"))
59
+ if not ids:
60
+ raise ValueError(f"{path}:{number}: missing parent")
61
+ for tid in ids.split(","):
62
+ key = (chrom, strand, tid)
63
+ if kind == "CDS":
64
+ if phase not in ("0", "1", "2"):
65
+ raise ValueError(
66
+ f"{path}:{number}: missing/invalid CDS phase"
67
+ )
68
+ cds[key].append((a, b, int(phase)))
69
+ else:
70
+ exons[key].append((a, b))
71
+ models = []
72
+ for (chrom, strand, tid), segments in sorted(cds.items()):
73
+ key = (chrom, strand, tid)
74
+ if key not in parents and not allow_orphan_cds:
75
+ raise ValueError(f"{path}: CDS has no transcript parent: {key}")
76
+ ss = sorted(set(segments))
77
+ first = ss[0 if strand == "+" else -1][2]
78
+ coords = tuple((a, b) for a, b, p in ss)
79
+ models.append(
80
+ Transcript(
81
+ chrom,
82
+ strand,
83
+ coords,
84
+ source,
85
+ tid,
86
+ first,
87
+ tuple(sorted(set(exons[key]))) or coords,
88
+ parents.get(key, tid),
89
+ origin,
90
+ )
91
+ )
92
+ if not models:
93
+ raise ValueError(f"No coding transcripts found: {path}")
94
+ return models
95
+
96
+
97
+ def write_gff3(models, path):
98
+ models = sorted(models, key=lambda m: (m.contig, m.cds[0][0], m.strand, m.uid))
99
+ with Path(path).open("w") as f:
100
+ f.write("##gff-version 3\n")
101
+ for m in models:
102
+ g = "GS.g" + m.uid
103
+ t = g + ".t1"
104
+ # CDS bases are exonic, including explicitly normalized stop codons.
105
+ ee = merge((m.exons or m.cds) + m.cds)
106
+ lo = min(a for a, b in ee)
107
+ hi = max(b for a, b in ee)
108
+ attr = (
109
+ f'ID={t};Parent={g};origin={quote(m.origin,safe="")};candidate={m.uid}'
110
+ )
111
+ f.write(
112
+ f"{m.contig}\tGeneSensus\tgene\t{lo+1}\t{hi}\t.\t{m.strand}\t.\tID={g}\n{m.contig}\tGeneSensus\tmRNA\t{lo+1}\t{hi}\t.\t{m.strand}\t.\t{attr}\n"
113
+ )
114
+ for i, (a, b) in enumerate(ee, 1):
115
+ f.write(
116
+ f"{m.contig}\tGeneSensus\texon\t{a+1}\t{b}\t.\t{m.strand}\t.\tID={t}.e{i};Parent={t}\n"
117
+ )
118
+ phases = {}
119
+ used = -m.phase
120
+ for a, b in m.cds if m.strand == "+" else reversed(m.cds):
121
+ phases[a, b] = (-used) % 3
122
+ used += b - a
123
+ for i, (a, b) in enumerate(m.cds, 1):
124
+ f.write(
125
+ f"{m.contig}\tGeneSensus\tCDS\t{a+1}\t{b}\t.\t{m.strand}\t{phases[a,b]}\tID={t}.c{i};Parent={t}\n"
126
+ )