draft-grn 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 (157) hide show
  1. draft_grn-0.1.0/LICENSE +21 -0
  2. draft_grn-0.1.0/MANIFEST.in +31 -0
  3. draft_grn-0.1.0/PKG-INFO +127 -0
  4. draft_grn-0.1.0/README.md +166 -0
  5. draft_grn-0.1.0/configs/examples/fly_ccc.yaml +77 -0
  6. draft_grn-0.1.0/configs/examples/fly_germ.yaml +125 -0
  7. draft_grn-0.1.0/configs/examples/fly_soma.yaml +125 -0
  8. draft_grn-0.1.0/configs/examples/mouse_development.yaml +129 -0
  9. draft_grn-0.1.0/configs/examples/mouse_motifs.yaml +141 -0
  10. draft_grn-0.1.0/configs/reproduction/dro_germ.yaml +28 -0
  11. draft_grn-0.1.0/configs/reproduction/mouse.yaml +29 -0
  12. draft_grn-0.1.0/configs/reproduction/soma.yaml +28 -0
  13. draft_grn-0.1.0/dev/README.md +12 -0
  14. draft_grn-0.1.0/dev/make_example_data.py +102 -0
  15. draft_grn-0.1.0/dev/make_motif_example.py +94 -0
  16. draft_grn-0.1.0/dev/package_simulation_example.py +185 -0
  17. draft_grn-0.1.0/dev/release_check.py +112 -0
  18. draft_grn-0.1.0/dev/validate_scmtni_prior.py +202 -0
  19. draft_grn-0.1.0/dev/validate_tutorials.py +95 -0
  20. draft_grn-0.1.0/docs/README_PYPI.md +46 -0
  21. draft_grn-0.1.0/docs/downstream.ipynb +220 -0
  22. draft_grn-0.1.0/docs/downstream.md +123 -0
  23. draft_grn-0.1.0/docs/input_formats.md +338 -0
  24. draft_grn-0.1.0/docs/model.png +0 -0
  25. draft_grn-0.1.0/pyproject.toml +110 -0
  26. draft_grn-0.1.0/scripts/install_simulation_r.R +42 -0
  27. draft_grn-0.1.0/scripts/train_reproduction.py +108 -0
  28. draft_grn-0.1.0/setup.cfg +4 -0
  29. draft_grn-0.1.0/src/draft_grn.egg-info/PKG-INFO +127 -0
  30. draft_grn-0.1.0/src/draft_grn.egg-info/SOURCES.txt +155 -0
  31. draft_grn-0.1.0/src/draft_grn.egg-info/dependency_links.txt +1 -0
  32. draft_grn-0.1.0/src/draft_grn.egg-info/entry_points.txt +4 -0
  33. draft_grn-0.1.0/src/draft_grn.egg-info/requires.txt +63 -0
  34. draft_grn-0.1.0/src/draft_grn.egg-info/top_level.txt +2 -0
  35. draft_grn-0.1.0/src/draft_paired/R/check_simulator.R +140 -0
  36. draft_grn-0.1.0/src/draft_paired/R/positive_kinetics.R +44 -0
  37. draft_grn-0.1.0/src/draft_paired/R/prior_trial_context.R +24 -0
  38. draft_grn-0.1.0/src/draft_paired/R/simulate_prior.R +197 -0
  39. draft_grn-0.1.0/src/draft_paired/__init__.py +3 -0
  40. draft_grn-0.1.0/src/draft_paired/analysis/__init__.py +43 -0
  41. draft_grn-0.1.0/src/draft_paired/analysis/ccc.py +1567 -0
  42. draft_grn-0.1.0/src/draft_paired/analysis/ccc_alignment.py +235 -0
  43. draft_grn-0.1.0/src/draft_paired/analysis/ccc_config.py +95 -0
  44. draft_grn-0.1.0/src/draft_paired/analysis/ccc_networks.py +209 -0
  45. draft_grn-0.1.0/src/draft_paired/analysis/ccc_timing.py +1030 -0
  46. draft_grn-0.1.0/src/draft_paired/analysis/consensus.py +384 -0
  47. draft_grn-0.1.0/src/draft_paired/analysis/continuous_activity.py +443 -0
  48. draft_grn-0.1.0/src/draft_paired/analysis/edge_cluster.py +546 -0
  49. draft_grn-0.1.0/src/draft_paired/analysis/gene_keys.py +122 -0
  50. draft_grn-0.1.0/src/draft_paired/analysis/network.py +1353 -0
  51. draft_grn-0.1.0/src/draft_paired/analysis/repro.py +513 -0
  52. draft_grn-0.1.0/src/draft_paired/analysis/single_tf.py +897 -0
  53. draft_grn-0.1.0/src/draft_paired/analysis/topic.py +662 -0
  54. draft_grn-0.1.0/src/draft_paired/ccc_inputs.py +129 -0
  55. draft_grn-0.1.0/src/draft_paired/ccc_workflow.py +20 -0
  56. draft_grn-0.1.0/src/draft_paired/checkpoint.py +35 -0
  57. draft_grn-0.1.0/src/draft_paired/cli.py +338 -0
  58. draft_grn-0.1.0/src/draft_paired/cli_options.py +202 -0
  59. draft_grn-0.1.0/src/draft_paired/config_init.py +136 -0
  60. draft_grn-0.1.0/src/draft_paired/config_profiles.py +38 -0
  61. draft_grn-0.1.0/src/draft_paired/directory_inputs.py +249 -0
  62. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/inputs_101.npz +0 -0
  63. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/inputs_102.npz +0 -0
  64. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/inputs_103.npz +0 -0
  65. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/manifest.json +120 -0
  66. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/prior.tsv +1801 -0
  67. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/prior_provenance.json +6 -0
  68. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/truth_101.npz +0 -0
  69. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/truth_102.npz +0 -0
  70. draft_grn-0.1.0/src/draft_paired/examples/simulation_9plus3/truth_103.npz +0 -0
  71. draft_grn-0.1.0/src/draft_paired/graph_builder.py +293 -0
  72. draft_grn-0.1.0/src/draft_paired/graph_input.py +143 -0
  73. draft_grn-0.1.0/src/draft_paired/infer.py +286 -0
  74. draft_grn-0.1.0/src/draft_paired/input_schema.py +143 -0
  75. draft_grn-0.1.0/src/draft_paired/io.py +101 -0
  76. draft_grn-0.1.0/src/draft_paired/lineage.py +152 -0
  77. draft_grn-0.1.0/src/draft_paired/models/__init__.py +23 -0
  78. draft_grn-0.1.0/src/draft_paired/models/gnn.py +267 -0
  79. draft_grn-0.1.0/src/draft_paired/pipeline.py +85 -0
  80. draft_grn-0.1.0/src/draft_paired/preprocess.py +336 -0
  81. draft_grn-0.1.0/src/draft_paired/prior_preparation.py +765 -0
  82. draft_grn-0.1.0/src/draft_paired/prior_resources.py +215 -0
  83. draft_grn-0.1.0/src/draft_paired/reproduce.py +394 -0
  84. draft_grn-0.1.0/src/draft_paired/simulation.py +563 -0
  85. draft_grn-0.1.0/src/draft_paired/simulation_generate.py +646 -0
  86. draft_grn-0.1.0/src/draft_paired/simulation_training.py +196 -0
  87. draft_grn-0.1.0/src/draft_paired/templates/draft_ccc_template.yaml +39 -0
  88. draft_grn-0.1.0/src/draft_paired/templates/draft_example_fly_ccc.yaml +77 -0
  89. draft_grn-0.1.0/src/draft_paired/templates/draft_example_fly_germ.yaml +125 -0
  90. draft_grn-0.1.0/src/draft_paired/templates/draft_example_fly_soma.yaml +125 -0
  91. draft_grn-0.1.0/src/draft_paired/templates/draft_example_mouse_development.yaml +129 -0
  92. draft_grn-0.1.0/src/draft_paired/templates/draft_example_mouse_motifs.yaml +141 -0
  93. draft_grn-0.1.0/src/draft_paired/templates/draft_lineage_template.yaml +122 -0
  94. draft_grn-0.1.0/src/draft_paired/templates/draft_simulation_prior_template.yaml +44 -0
  95. draft_grn-0.1.0/src/draft_paired/templates/draft_simulation_template.yaml +29 -0
  96. draft_grn-0.1.0/src/draft_paired/templates/method_profiles.yaml +29 -0
  97. draft_grn-0.1.0/src/draft_paired/train.py +1027 -0
  98. draft_grn-0.1.0/src/draft_paired/tutorial_data.py +240 -0
  99. draft_grn-0.1.0/src/draft_paired/utils.py +141 -0
  100. draft_grn-0.1.0/src/draft_paired/workflow.py +167 -0
  101. draft_grn-0.1.0/src/draft_paired/workflow_cli.py +282 -0
  102. draft_grn-0.1.0/src/draft_unpaired/__init__.py +3 -0
  103. draft_grn-0.1.0/src/draft_unpaired/analysis/__init__.py +3 -0
  104. draft_grn-0.1.0/src/draft_unpaired/analysis/continuous_activity.py +8 -0
  105. draft_grn-0.1.0/src/draft_unpaired/analysis/edge_cluster.py +71 -0
  106. draft_grn-0.1.0/src/draft_unpaired/analysis/network.py +743 -0
  107. draft_grn-0.1.0/src/draft_unpaired/analysis/repro.py +23 -0
  108. draft_grn-0.1.0/src/draft_unpaired/analysis/single_tf.py +431 -0
  109. draft_grn-0.1.0/src/draft_unpaired/analysis/topic.py +77 -0
  110. draft_grn-0.1.0/src/draft_unpaired/checkpoint.py +13 -0
  111. draft_grn-0.1.0/src/draft_unpaired/cli.py +200 -0
  112. draft_grn-0.1.0/src/draft_unpaired/config_init.py +81 -0
  113. draft_grn-0.1.0/src/draft_unpaired/graph_builder.py +220 -0
  114. draft_grn-0.1.0/src/draft_unpaired/infer.py +128 -0
  115. draft_grn-0.1.0/src/draft_unpaired/io.py +101 -0
  116. draft_grn-0.1.0/src/draft_unpaired/lineage.py +5 -0
  117. draft_grn-0.1.0/src/draft_unpaired/models/__init__.py +5 -0
  118. draft_grn-0.1.0/src/draft_unpaired/models/gnn.py +187 -0
  119. draft_grn-0.1.0/src/draft_unpaired/pipeline.py +88 -0
  120. draft_grn-0.1.0/src/draft_unpaired/preprocess.py +319 -0
  121. draft_grn-0.1.0/src/draft_unpaired/prior.py +301 -0
  122. draft_grn-0.1.0/src/draft_unpaired/reproduce.py +152 -0
  123. draft_grn-0.1.0/src/draft_unpaired/scmtni_prior.py +482 -0
  124. draft_grn-0.1.0/src/draft_unpaired/templates/draft_motif_template.yaml +136 -0
  125. draft_grn-0.1.0/src/draft_unpaired/templates/draft_staged_prior_template.yaml +123 -0
  126. draft_grn-0.1.0/src/draft_unpaired/templates/draft_unpaired_template.yaml +128 -0
  127. draft_grn-0.1.0/src/draft_unpaired/train.py +568 -0
  128. draft_grn-0.1.0/src/draft_unpaired/utils.py +19 -0
  129. draft_grn-0.1.0/tests/fixtures/scmtni_reference.json +3075 -0
  130. draft_grn-0.1.0/tests/scmtni_cases.py +101 -0
  131. draft_grn-0.1.0/tests/test_auto_prior.py +289 -0
  132. draft_grn-0.1.0/tests/test_ccc_model_inputs.py +208 -0
  133. draft_grn-0.1.0/tests/test_cli_options.py +187 -0
  134. draft_grn-0.1.0/tests/test_config_profiles.py +81 -0
  135. draft_grn-0.1.0/tests/test_consensus.py +138 -0
  136. draft_grn-0.1.0/tests/test_consensus_workflow.py +131 -0
  137. draft_grn-0.1.0/tests/test_continuous_cli.py +50 -0
  138. draft_grn-0.1.0/tests/test_directory_inputs.py +258 -0
  139. draft_grn-0.1.0/tests/test_downstream_sequence.py +83 -0
  140. draft_grn-0.1.0/tests/test_example_data.py +61 -0
  141. draft_grn-0.1.0/tests/test_gene_case.py +193 -0
  142. draft_grn-0.1.0/tests/test_generic_ccc.py +101 -0
  143. draft_grn-0.1.0/tests/test_generic_workflows.py +257 -0
  144. draft_grn-0.1.0/tests/test_graph_training.py +221 -0
  145. draft_grn-0.1.0/tests/test_input_contracts.py +194 -0
  146. draft_grn-0.1.0/tests/test_manuscript_methods.py +463 -0
  147. draft_grn-0.1.0/tests/test_motif_subset.py +32 -0
  148. draft_grn-0.1.0/tests/test_network_cutoff.py +25 -0
  149. draft_grn-0.1.0/tests/test_pipeline_order.py +69 -0
  150. draft_grn-0.1.0/tests/test_preprocessing_workflow.py +135 -0
  151. draft_grn-0.1.0/tests/test_scmtni_prior.py +197 -0
  152. draft_grn-0.1.0/tests/test_shared_inputs.py +238 -0
  153. draft_grn-0.1.0/tests/test_simulation.py +197 -0
  154. draft_grn-0.1.0/tests/test_simulation_generate.py +366 -0
  155. draft_grn-0.1.0/tests/test_smoke.py +127 -0
  156. draft_grn-0.1.0/tests/test_tutorials.py +20 -0
  157. draft_grn-0.1.0/tests/test_unpaired_assays.py +160 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Velten Group
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,31 @@
1
+ include LICENSE
2
+ include README.md
3
+ include pyproject.toml
4
+
5
+ include docs/README_PYPI.md
6
+ recursive-include docs *.md
7
+ recursive-include configs *.yaml *.md
8
+ recursive-include docs *.ipynb
9
+ recursive-include configs/examples *.yaml
10
+ include docs/model.png
11
+
12
+ include scripts/install_simulation_r.R
13
+ include scripts/train_reproduction.py
14
+ recursive-include dev *.py *.md
15
+
16
+ recursive-include src *.py
17
+ recursive-include src *.yaml
18
+ recursive-include src/draft_paired/examples *.npz *.json
19
+ recursive-include src/draft_paired/examples *.tsv
20
+ recursive-include src/draft_paired/R *.R
21
+ recursive-include tests *.py *.json
22
+
23
+ prune data
24
+ prune notebook
25
+ prune result
26
+ prune .release-check
27
+
28
+ global-exclude __pycache__
29
+ global-exclude *.py[cod]
30
+ global-exclude .DS_Store
31
+ global-exclude Thumbs.db
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: draft-grn
3
+ Version: 0.1.0
4
+ Summary: Dynamic gene regulatory networks from paired or unpaired single-cell RNA and ATAC data along lineage trees.
5
+ Author-email: Zehua Zhang <zehua.zhang@cos.uni-heidelberg.de>
6
+ Maintainer-email: Zehua Zhang <zehua.zhang@cos.uni-heidelberg.de>
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/velten-group/DRAFT
9
+ Project-URL: Repository, https://github.com/velten-group/DRAFT
10
+ Project-URL: Issues, https://github.com/velten-group/DRAFT/issues
11
+ Project-URL: Documentation, https://github.com/velten-group/DRAFT#readme
12
+ Keywords: single-cell,graph-neural-network,dynamic-gene-regulatory-network,multiomics,trajectory
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pyyaml>=6.0
26
+ Provides-Extra: paired
27
+ Requires-Dist: numpy>=1.24; extra == "paired"
28
+ Requires-Dist: pandas>=2.0; extra == "paired"
29
+ Requires-Dist: torch>=2.1; extra == "paired"
30
+ Requires-Dist: torch-geometric>=2.5; extra == "paired"
31
+ Requires-Dist: anndata>=0.10; extra == "paired"
32
+ Requires-Dist: scipy>=1.11; extra == "paired"
33
+ Requires-Dist: matplotlib>=3.8; extra == "paired"
34
+ Requires-Dist: scikit-learn>=1.4; extra == "paired"
35
+ Requires-Dist: networkx>=3.2; extra == "paired"
36
+ Provides-Extra: unpaired
37
+ Requires-Dist: numpy>=1.24; extra == "unpaired"
38
+ Requires-Dist: pandas>=2.0; extra == "unpaired"
39
+ Requires-Dist: torch>=2.1; extra == "unpaired"
40
+ Requires-Dist: torch-geometric>=2.5; extra == "unpaired"
41
+ Requires-Dist: anndata>=0.10; extra == "unpaired"
42
+ Requires-Dist: scipy>=1.11; extra == "unpaired"
43
+ Requires-Dist: matplotlib>=3.8; extra == "unpaired"
44
+ Requires-Dist: scikit-learn>=1.4; extra == "unpaired"
45
+ Requires-Dist: networkx>=3.2; extra == "unpaired"
46
+ Provides-Extra: full
47
+ Requires-Dist: pybigtools<0.4,>=0.3.0; extra == "full"
48
+ Requires-Dist: numpy>=1.24; extra == "full"
49
+ Requires-Dist: pandas>=2.0; extra == "full"
50
+ Requires-Dist: torch>=2.1; extra == "full"
51
+ Requires-Dist: torch-geometric>=2.5; extra == "full"
52
+ Requires-Dist: anndata>=0.10; extra == "full"
53
+ Requires-Dist: scipy>=1.11; extra == "full"
54
+ Requires-Dist: matplotlib>=3.8; extra == "full"
55
+ Requires-Dist: scikit-learn>=1.4; extra == "full"
56
+ Requires-Dist: networkx>=3.2; extra == "full"
57
+ Provides-Extra: prior
58
+ Requires-Dist: numpy>=1.24; extra == "prior"
59
+ Requires-Dist: pandas>=2.0; extra == "prior"
60
+ Requires-Dist: anndata>=0.10; extra == "prior"
61
+ Requires-Dist: scipy>=1.11; extra == "prior"
62
+ Requires-Dist: pybigtools<0.4,>=0.3.0; extra == "prior"
63
+ Provides-Extra: dev
64
+ Requires-Dist: build>=1.2; extra == "dev"
65
+ Requires-Dist: pytest>=8.0; extra == "dev"
66
+ Requires-Dist: ruff>=0.6; extra == "dev"
67
+ Requires-Dist: twine>=5.1; extra == "dev"
68
+ Requires-Dist: nbformat>=5.10; extra == "dev"
69
+ Requires-Dist: nbclient>=0.10; extra == "dev"
70
+ Requires-Dist: ipykernel>=6.29; extra == "dev"
71
+ Provides-Extra: tutorial
72
+ Requires-Dist: nbformat>=5.10; extra == "tutorial"
73
+ Requires-Dist: nbclient>=0.10; extra == "tutorial"
74
+ Requires-Dist: ipykernel>=6.29; extra == "tutorial"
75
+ Provides-Extra: release
76
+ Requires-Dist: build>=1.2; extra == "release"
77
+ Requires-Dist: twine>=5.1; extra == "release"
78
+ Provides-Extra: enrich
79
+ Requires-Dist: gseapy>=1.1; extra == "enrich"
80
+ Dynamic: license-file
81
+
82
+ # DRAFT
83
+
84
+ DRAFT infers dynamic gene regulatory networks from paired or unpaired
85
+ single-cell RNA and ATAC data along a lineage tree, and compares two lineages
86
+ by developmental alignment (DTW) and cell-cell communication (CCC).
87
+
88
+ > **Status:** early release; commands and options may still change.
89
+
90
+ ## Installation
91
+
92
+ Python 3.10 or newer:
93
+
94
+ ```bash
95
+ pip install "draft-grn[full]"
96
+ draft simulation # quick start on bundled simulated data; results in result/simulation/
97
+ ```
98
+
99
+ Optional extras: `[enrich]` adds GO enrichment of regulatory topics, `[tutorial]`
100
+ runs the interactive example. The tutorial's example inputs (`data/`) and the
101
+ manuscript reproduction script are in the GitHub repository; to use them, install
102
+ from a clone:
103
+
104
+ ```bash
105
+ git clone https://github.com/velten-group/DRAFT.git
106
+ cd DRAFT
107
+ pip install -e ".[full]"
108
+ ```
109
+
110
+ ## Documentation
111
+
112
+ - [README](https://github.com/velten-group/DRAFT#readme): tutorial on example
113
+ data (preprocess, train, networks, regulons, two-lineage comparison) and
114
+ [manuscript reproduction](https://github.com/velten-group/DRAFT#reproducing-the-manuscript)
115
+ - [Input guide](https://github.com/velten-group/DRAFT/blob/main/docs/input_formats.md)
116
+ - [Downstream analyses](https://github.com/velten-group/DRAFT/blob/main/docs/downstream.md)
117
+ - Manuscript analyses and figures: [DRAFT-analysis](https://github.com/velten-group/DRAFT-analysis)
118
+
119
+ ## Citation
120
+
121
+ Zhang Z, Santhi Sekhar P, van Nierop y Sanchez P, Lohmann I, Velten B. DRAFT: graph-recurrent learning of
122
+ dynamic gene regulatory networks along single-cell multi-omics trajectories. bioRxiv (2026).
123
+ [doi:10.64898/2026.11.17.767145](https://doi.org/10.64898/2026.11.17.767145)
124
+
125
+ ## License and contact
126
+
127
+ MIT. Questions and bug reports: [GitHub issues](https://github.com/velten-group/DRAFT/issues).
@@ -0,0 +1,166 @@
1
+ # DRAFT
2
+
3
+ DRAFT infers dynamic gene regulatory networks from single-cell RNA and ATAC
4
+ data along a lineage tree, and compares two lineages by developmental
5
+ alignment (DTW) and cell-cell communication (CCC).
6
+
7
+ > **Status:** DRAFT is being packaged for PyPI. Until the release, install it
8
+ > from this repository as shown below. Commands and options may still change.
9
+
10
+ ![DRAFT model overview](docs/model.png)
11
+
12
+ DRAFT works with paired and unpaired data. The two modes differ only in the
13
+ preprocessing step:
14
+
15
+ | | Paired | Unpaired |
16
+ |---|---|---|
17
+ | Data | RNA and ATAC measured in the same cells | RNA and ATAC measured in different cells, each labelled with the same tree nodes |
18
+ | Preprocessing | `--mode paired` | `--mode unpaired` |
19
+ | Graph per tree node | TF, RE (ATAC peak) and TG nodes | TF and TG nodes; candidate TF-TG edges from ATAC and the priors |
20
+ | Input files, other commands | Same | Same |
21
+
22
+ ## Installation
23
+
24
+ Python 3.10 or newer:
25
+
26
+ ```bash
27
+ git clone https://github.com/velten-group/DRAFT.git
28
+ cd DRAFT
29
+ pip install -e ".[full]"
30
+ ```
31
+
32
+ `[full]` installs everything the workflow below needs. Optional extras:
33
+ `[enrich]` adds GO enrichment of regulatory topics, `[tutorial]` runs the
34
+ [interactive example](docs/downstream.ipynb). A GPU speeds up training but is
35
+ not required for the examples. Run all commands from this `DRAFT/` directory.
36
+
37
+ ## Quick start
38
+
39
+ ```bash
40
+ draft simulation
41
+ ```
42
+
43
+ This trains DRAFT on bundled simulated RNA/ATAC data with a known network and
44
+ writes `result/simulation/`: `runs.tsv` summarizes network recovery and
45
+ temporal smoothness, and each `seed_*/model_*/` folder holds the model,
46
+ embeddings, networks and figures. To simulate data from your own prior
47
+ network, see [simulation priors](docs/input_formats.md#simulation-priors).
48
+
49
+ ## Tutorial
50
+
51
+ **Preprocess → train → networks and clustering → regulons → two-lineage
52
+ comparison**, run as written on the example inputs in [`data/`](data/README.md):
53
+ two small lineages (`data/lineage1/`, `data/lineage2/`) and ligand-receptor
54
+ pairs (`data/ligand_receptor.csv`). For your own analysis, replace them with
55
+ your files in the same layout ([file formats](docs/input_formats.md)) and use
56
+ your own TF and tree-node names.
57
+
58
+ ### 1. Preprocess
59
+
60
+ One folder per lineage, in the same layout for both modes:
61
+
62
+ ```text
63
+ data/lineage1/
64
+ rna.h5ad, atac.h5ad
65
+ rna_cells.tsv, atac_cells.tsv # tree node of each cell; optional if the H5AD obs has cell_type
66
+ tree.tsv, TF.tsv, TG.tsv
67
+ TF_RE.tsv, RE_TG.tsv # optional regulatory priors
68
+ ```
69
+
70
+ ```bash
71
+ draft preprocess --input-dir data/lineage1 --mode paired --output prepared/lineage1
72
+ draft preprocess --input-dir data/lineage2 --mode paired --output prepared/lineage2
73
+ ```
74
+
75
+ - Use `--mode unpaired` for RNA and ATAC from different cells. The example's
76
+ RNA and ATAC share cells, so both modes run on it.
77
+ - Without `TF_RE.tsv`/`RE_TG.tsv`, add `--genome hg38`, `mm10` or `dm6`, and
78
+ DRAFT builds [motif-based priors](docs/input_formats.md#when-regulatory-priors-are-unavailable).
79
+ - Each output folder receives `graphs.pt` (the model input) and `train.yaml`,
80
+ the config of every later step.
81
+
82
+ ### 2. Train
83
+
84
+ ```bash
85
+ draft train --config prepared/lineage1/train.yaml
86
+ draft train --config prepared/lineage2/train.yaml
87
+ ```
88
+
89
+ Checkpoints go to `result/<lineage>/model/`.
90
+
91
+ ### 3. Export networks and cluster edges
92
+
93
+ ```bash
94
+ draft reproduce --config prepared/lineage1/train.yaml
95
+ draft network-export --config prepared/lineage1/train.yaml
96
+ draft edge-cluster --config prepared/lineage1/train.yaml
97
+ draft topic --config prepared/lineage1/train.yaml
98
+ ```
99
+
100
+ Results go to `result/lineage1/` (`reproduce/`, `network/`, `edge_cluster/`,
101
+ `topic/`).
102
+
103
+ ### 4. Inspect TF regulons
104
+
105
+ ```bash
106
+ draft single-tf --config prepared/lineage1/train.yaml --tf TF1 --stage stage1 --consensus-stages stage1 stage2
107
+ ```
108
+
109
+ `TF1` is a TF and `stage1`, `stage2` are tree nodes of the example. Results go
110
+ to `result/lineage1/single_tf/`.
111
+
112
+ ### 5. Compare two lineages (DTW + CCC)
113
+
114
+ ```bash
115
+ draft ccc --lineage1 prepared/lineage1/train.yaml --lineage2 prepared/lineage2/train.yaml --lr data/ligand_receptor.csv --early1 1 --early2 1 --output result/ccc
116
+ ```
117
+
118
+ `--early1`/`--early2` give the number of initial stages that form each
119
+ lineage's early window. Ligand and receptor genes must be in both lineages'
120
+ `TG.tsv`. The two models may be of either mode.
121
+
122
+ ## Documentation
123
+
124
+ - [Input guide](docs/input_formats.md): file formats, preprocessing options,
125
+ motif-based priors and the inputs of the other commands.
126
+ - [Downstream analyses](docs/downstream.md): outputs and options of each
127
+ command after training.
128
+ - [Interactive example](docs/downstream.ipynb): export, clustering and CCC in a
129
+ notebook (`pip install -e ".[full,tutorial]"`).
130
+ - `draft --help` and `draft <command> --help` list all options.
131
+
132
+ ## Reproducing the manuscript
133
+
134
+ Retrains the mouse and Drosophila models; a GPU with at least **48 GB** is
135
+ recommended.
136
+
137
+ 1. Install DRAFT as above.
138
+ 2. Download `mouse_graphs.pt`, `dro_germ_graphs.pt` and `soma_graphs.pt` from
139
+ [Zenodo](https://doi.org/10.5281/zenodo.23678662) into `DRAFT/graph_data/`.
140
+ 3. Train:
141
+
142
+ ```bash
143
+ python scripts/train_reproduction.py --graph-dir graph_data
144
+ ```
145
+
146
+ Add `--dataset mouse`, `dro_germ` or `soma` for one model, or `--check-only`
147
+ to validate the files first.
148
+
149
+ Results go to `result/reproduction/<dataset>/` (`model/`, `train/`,
150
+ `config.yaml`).
151
+
152
+ To reproduce the manuscript's downstream analyses and figures, use
153
+ [DRAFT-analysis](https://github.com/velten-group/DRAFT-analysis).
154
+
155
+ ## Citation
156
+
157
+ If you use DRAFT, please cite:
158
+
159
+ Zhang Z, Santhi Sekhar P, van Nierop y Sanchez P, Lohmann I, Velten B. DRAFT: graph-recurrent learning of
160
+ dynamic gene regulatory networks along single-cell multi-omics trajectories. bioRxiv (2026).
161
+ [doi:10.64898/2026.11.17.767145](https://doi.org/10.64898/2026.11.17.767145)
162
+
163
+ ## License and contact
164
+
165
+ MIT, see [LICENSE](LICENSE). Questions and bug reports:
166
+ [GitHub issues](https://github.com/velten-group/DRAFT/issues).
@@ -0,0 +1,77 @@
1
+ # Communication analysis for the two Drosophila lineage models.
2
+ soma_result_root: result/fly_soma
3
+ germ_result_root: result/fly_germ
4
+ ccc_result_root: result/ccc
5
+ data:
6
+ rna_h5ad: data/raw/A_rna_focus.h5ad
7
+ atac_h5ad: data/raw/B_atac_focus.h5ad
8
+ annotation: data/raw/cell_annotation.csv
9
+ cell_id_column: cell_id
10
+ cell_id_normalization: sample_suffix
11
+ group_column: GEX_latent_time_bins_annotated
12
+ rna_layer: lognorm
13
+ tf_list: data/raw/TF.tsv
14
+ tg_list: data/raw/TG.tsv
15
+ ccc:
16
+ output_dir: ${ccc_result_root}
17
+ score_mode: receptor_centrality
18
+ network_dir_soma: ${soma_result_root}/network_dense
19
+ network_dir_germ: ${germ_result_root}/network_dense
20
+ tf_annot_soma: data/raw/TF.tsv
21
+ tf_annot_germ: data/raw/TF.tsv
22
+ tg_annot_soma: data/raw/TG.tsv
23
+ tg_annot_germ: data/raw/TG.tsv
24
+ ccc_csv: data/raw/ccc.csv
25
+ finger_r: 20
26
+ norm_eps: 1.0e-08
27
+ alignment_method: dtw
28
+ dtw_ent_w: 0.0
29
+ dtw_band: 6
30
+ dtw_lam_d2: 1.0
31
+ dtw_n_iter: 50
32
+ warp_dtw_tsv: time_warp_dtw_soma_to_germ.tsv
33
+ ligand_min_frac: 0.05
34
+ receptor_gate: 0.05
35
+ dynamic_range_min: 0.1
36
+ hub_group: Hub_0
37
+ directions:
38
+ - hub_to_germline
39
+ - hub_to_soma
40
+ - soma_to_germline
41
+ - germline_to_soma
42
+ soma:
43
+ config: configs/examples/fly_soma.yaml
44
+ stage_groups:
45
+ - Soma_0
46
+ - Soma_1
47
+ - Soma_2
48
+ - Soma_3
49
+ - Soma_4
50
+ - Soma_5
51
+ - Soma_6
52
+ - Soma_7a
53
+ - Soma_7b
54
+ parallel_groups:
55
+ - Soma_7a
56
+ - Soma_7b
57
+ early_stage_count: 4
58
+ germ:
59
+ config: configs/examples/fly_germ.yaml
60
+ stage_groups:
61
+ - Germline_0
62
+ - Germline_1
63
+ - Germline_2
64
+ - Germline_3
65
+ - Germline_4
66
+ - Germline_5
67
+ - Germline_6
68
+ - Germline_7
69
+ - Germline_8
70
+ - Germline_9
71
+ - Germline_10
72
+ - Germline_11
73
+ - Germline_12
74
+ - Germline_13
75
+ - Germline_14
76
+ early_stage_count: 6
77
+ save_fig: true
@@ -0,0 +1,125 @@
1
+ lineage: lineage2
2
+ lineage_data_dir: data/raw/germ
3
+ result_root: result/fly_germ
4
+ output_dir: ${result_root}/train
5
+ data:
6
+ tf_list: data/raw/TF.tsv
7
+ tg_list: data/raw/TG.tsv
8
+ re_list: data/raw/RE.txt
9
+ rna_h5ad: ${lineage_data_dir}/germ_rna.h5ad
10
+ atac_h5ad: ${lineage_data_dir}/germ_atac.h5ad
11
+ tf_re_prior: data/raw/TF_RE_top3pct_edges.tsv
12
+ re_tg_prior: data/raw/RE_TG_100kb.tsv
13
+ annotation: ${lineage_data_dir}/germ_cell_annotation.csv
14
+ tree: ${lineage_data_dir}/germ_tree.csv
15
+ model:
16
+ hidden_channels: 64
17
+ out_channels: 64
18
+ dropout_rate: 0.4
19
+ gat_heads: 2
20
+ training:
21
+ seed: 2025
22
+ neg_sampling_ratio: 1.0
23
+ dedup_neg: true
24
+ num_epochs: 600
25
+ checkpoint_selection: last
26
+ weight_decay: 1e-5
27
+ auto_lambda_smooth: true
28
+ lambda_smooth_init: 0.0
29
+ log_every: 10
30
+ lr: 0.0005
31
+ artifacts:
32
+ dir: ${result_root}/train/artifacts
33
+ filename: fly_germ_graphs.pt
34
+ checkpoints:
35
+ dir: ${result_root}/model
36
+ reproduce:
37
+ output_dir: ${result_root}/reproduce
38
+ artifact_path: ${result_root}/train/artifacts/fly_germ_graphs.pt
39
+ checkpoint_pattern: '*.pt'
40
+ save_embeddings: true
41
+ smoothness:
42
+ row_bs: 1024
43
+ col_bs: 4096
44
+ save_heatmap: true
45
+ network:
46
+ output_dir: ${result_root}/network
47
+ tf_filter_file: data/raw/TF_filtered.tsv
48
+ active_frac_tf_tg: 0.05
49
+ active_frac_re: 0.05
50
+ top_k_global: 10000
51
+ min_score_keep: 0.83
52
+ m_min: 0
53
+ m_max: 2000
54
+ gamma: 3.0
55
+ eps: 1.0e-12
56
+ topn_re_per_tg: 2
57
+ max_dist_bp: 250000
58
+ dist_lambda: 50000.0
59
+ w_re_tg: 0.4
60
+ w_dist: 0.3
61
+ w_tf_re: 0.2
62
+ w_act: 0.1
63
+ strict_score_mode: score_cos_prob
64
+ dense:
65
+ output_dir: ${result_root}/network_dense
66
+ n_interp: 4
67
+ sigma_time: 0.7
68
+ active_thr: 0.05
69
+ min_score_keep: 0.82
70
+ top_k_global: 50000
71
+ rescue_gamma: 4.0
72
+ rescue_m_min: 0
73
+ rescue_m_max: 0
74
+ rescue_eps: 1.0e-08
75
+ use_one_based: false
76
+ keep_id_cols: true
77
+ add_prefix: false
78
+ single_tf:
79
+ enabled: true
80
+ output_dir: ${result_root}/single_tf
81
+ tf_symbols:
82
+ - ovo
83
+ time_for_top: 0
84
+ topn_tg: 50
85
+ consensus:
86
+ enabled: false
87
+ time_points:
88
+ - 0
89
+ - 1
90
+ - 2
91
+ - 3
92
+ rank_method: geometric_mean
93
+ topn: 20
94
+ max_expr_frac: 0.7
95
+ continuous_activity:
96
+ enabled: true
97
+ network_dir: ${result_root}/network_dense
98
+ output_dir: ${result_root}/continuous_activity
99
+ tf_list:
100
+ - ovo
101
+ sigma_time: 0.5
102
+ edge_cluster:
103
+ enabled: true
104
+ network_dir: ${result_root}/network
105
+ output_dir: ${result_root}/edge_cluster
106
+ selection_mode: topk
107
+ top_n_per_cluster: 10000
108
+ n_clusters: 12
109
+ topic:
110
+ enabled: true
111
+ network_dir: ${result_root}/network
112
+ output_dir: ${result_root}/topic
113
+ selection_mode: topk
114
+ top_n_per_cluster: 10000
115
+ n_topics: 12
116
+ do_enrich: false
117
+ enrich_db: GO_Biological_Process_2018
118
+ enrich_organism: Fly
119
+ enrich_background: null
120
+ pipeline:
121
+ output_dir: ${result_root}/pipeline
122
+ method_profile:
123
+ name: methods
124
+ config_version: 2
125
+ application_profile: fly_germ
@@ -0,0 +1,125 @@
1
+ lineage: lineage1
2
+ lineage_data_dir: data/raw/soma
3
+ result_root: result/fly_soma
4
+ output_dir: ${result_root}/train
5
+ data:
6
+ tf_list: data/raw/TF.tsv
7
+ tg_list: data/raw/TG.tsv
8
+ re_list: data/raw/RE.txt
9
+ rna_h5ad: ${lineage_data_dir}/soma_rna.h5ad
10
+ atac_h5ad: ${lineage_data_dir}/soma_atac.h5ad
11
+ tf_re_prior: data/raw/TF_RE_top3pct_edges.tsv
12
+ re_tg_prior: data/raw/RE_TG_100kb.tsv
13
+ annotation: ${lineage_data_dir}/soma_cell_annotation.csv
14
+ tree: ${lineage_data_dir}/soma_tree.csv
15
+ model:
16
+ hidden_channels: 64
17
+ out_channels: 64
18
+ dropout_rate: 0.4
19
+ gat_heads: 2
20
+ training:
21
+ seed: 2025
22
+ neg_sampling_ratio: 1.0
23
+ dedup_neg: true
24
+ num_epochs: 600
25
+ checkpoint_selection: best_loss
26
+ weight_decay: 1e-5
27
+ auto_lambda_smooth: true
28
+ lambda_smooth_init: 0.0
29
+ log_every: 10
30
+ lr: 0.0003
31
+ artifacts:
32
+ dir: ${result_root}/train/artifacts
33
+ filename: fly_soma_graphs.pt
34
+ checkpoints:
35
+ dir: ${result_root}/model
36
+ reproduce:
37
+ output_dir: ${result_root}/reproduce
38
+ artifact_path: ${result_root}/train/artifacts/fly_soma_graphs.pt
39
+ checkpoint_pattern: '*.pt'
40
+ save_embeddings: true
41
+ smoothness:
42
+ row_bs: 1024
43
+ col_bs: 4096
44
+ save_heatmap: true
45
+ network:
46
+ output_dir: ${result_root}/network
47
+ tf_filter_file: data/raw/TF_filtered.tsv
48
+ active_frac_tf_tg: 0.05
49
+ active_frac_re: 0.05
50
+ top_k_global: 10000
51
+ min_score_keep: 0.83
52
+ m_min: 0
53
+ m_max: 2000
54
+ gamma: 3.0
55
+ eps: 1.0e-12
56
+ topn_re_per_tg: 2
57
+ max_dist_bp: 250000
58
+ dist_lambda: 50000.0
59
+ w_re_tg: 0.4
60
+ w_dist: 0.3
61
+ w_tf_re: 0.2
62
+ w_act: 0.1
63
+ strict_score_mode: score_cos_prob
64
+ dense:
65
+ output_dir: ${result_root}/network_dense
66
+ n_interp: 4
67
+ sigma_time: 0.7
68
+ active_thr: 0.05
69
+ min_score_keep: 0.82
70
+ top_k_global: 50000
71
+ rescue_gamma: 4.0
72
+ rescue_m_min: 0
73
+ rescue_m_max: 0
74
+ rescue_eps: 1.0e-08
75
+ use_one_based: false
76
+ keep_id_cols: true
77
+ add_prefix: false
78
+ single_tf:
79
+ enabled: true
80
+ output_dir: ${result_root}/single_tf
81
+ tf_symbols:
82
+ - ovo
83
+ time_for_top: 0
84
+ topn_tg: 50
85
+ consensus:
86
+ enabled: false
87
+ time_points:
88
+ - 0
89
+ - 1
90
+ - 2
91
+ - 3
92
+ rank_method: geometric_mean
93
+ topn: 20
94
+ max_expr_frac: 0.8
95
+ continuous_activity:
96
+ enabled: true
97
+ network_dir: ${result_root}/network_dense
98
+ output_dir: ${result_root}/continuous_activity
99
+ tf_list:
100
+ - ovo
101
+ sigma_time: 0.5
102
+ edge_cluster:
103
+ enabled: true
104
+ network_dir: ${result_root}/network
105
+ output_dir: ${result_root}/edge_cluster
106
+ selection_mode: topk
107
+ top_n_per_cluster: 10000
108
+ n_clusters: 12
109
+ topic:
110
+ enabled: true
111
+ network_dir: ${result_root}/network
112
+ output_dir: ${result_root}/topic
113
+ selection_mode: topk
114
+ top_n_per_cluster: 10000
115
+ n_topics: 12
116
+ do_enrich: false
117
+ enrich_db: GO_Biological_Process_2018
118
+ enrich_organism: Fly
119
+ enrich_background: null
120
+ pipeline:
121
+ output_dir: ${result_root}/pipeline
122
+ method_profile:
123
+ name: methods
124
+ config_version: 2
125
+ application_profile: fly_soma