MultiMM 2.0.1__tar.gz → 2.0.2__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 (31) hide show
  1. {multimm-2.0.1/src/MultiMM.egg-info → multimm-2.0.2}/PKG-INFO +171 -61
  2. {multimm-2.0.1 → multimm-2.0.2}/README.md +170 -60
  3. {multimm-2.0.1 → multimm-2.0.2}/pyproject.toml +1 -1
  4. {multimm-2.0.1 → multimm-2.0.2/src/MultiMM.egg-info}/PKG-INFO +171 -61
  5. {multimm-2.0.1 → multimm-2.0.2}/src/MultiMM.egg-info/SOURCES.txt +1 -0
  6. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/__init__.py +1 -1
  7. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/config.py +49 -8
  8. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/initial_structure_tools.py +17 -9
  9. multimm-2.0.2/src/multimm/logger.py +51 -0
  10. multimm-2.0.2/src/multimm/model.py +1259 -0
  11. multimm-2.0.2/src/multimm/plots.py +801 -0
  12. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/run.py +193 -36
  13. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/utils.py +44 -58
  14. multimm-2.0.1/src/multimm/model.py +0 -664
  15. multimm-2.0.1/src/multimm/plots.py +0 -240
  16. {multimm-2.0.1 → multimm-2.0.2}/LICENSE +0 -0
  17. {multimm-2.0.1 → multimm-2.0.2}/setup.cfg +0 -0
  18. {multimm-2.0.1 → multimm-2.0.2}/src/MultiMM.egg-info/dependency_links.txt +0 -0
  19. {multimm-2.0.1 → multimm-2.0.2}/src/MultiMM.egg-info/entry_points.txt +0 -0
  20. {multimm-2.0.1 → multimm-2.0.2}/src/MultiMM.egg-info/requires.txt +0 -0
  21. {multimm-2.0.1 → multimm-2.0.2}/src/MultiMM.egg-info/top_level.txt +0 -0
  22. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/args_definition.py +0 -0
  23. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/bridge.py +0 -0
  24. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/data/hg38_gtf_annotations.tsv +0 -0
  25. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/enums.py +0 -0
  26. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/forcefields/dna_histones_ff.xml +0 -0
  27. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/forcefields/ff.xml +0 -0
  28. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/nucleosome_interpolation.py +0 -0
  29. {multimm-2.0.1 → multimm-2.0.2}/src/multimm/validation.py +0 -0
  30. {multimm-2.0.1 → multimm-2.0.2}/tests/test_run_validation.py +0 -0
  31. {multimm-2.0.1 → multimm-2.0.2}/tests/test_simulations.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MultiMM
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: A tool for chromatin modeling from nucleosomes to chromosomal territories.
5
5
  Author-email: Sebastian Korsak <s.korsak@datascience.edu.pl>
6
6
  License: GNU General Public License v3.0
@@ -75,116 +75,215 @@ pip install MultiMM
75
75
 
76
76
  PyPI software: https://pypi.org/project/MultiMM/.
77
77
 
78
- ## Mathematical Model
78
+ ### Model Overview
79
79
 
80
- We model chromatin as a coarse-grained polymer confined inside the nucleus. The system is described by an effective energy functional
80
+ We model chromatin as a coarse-grained polymer where the total energy $E$ is decomposed into a set of physically motivated interaction terms capturing polymer mechanics, epigenetic organization, and structural constraints. Each term encodes a distinct biological mechanism, allowing the model to reproduce both local polymer behavior and large-scale genome organization such as compartments and loops.
81
81
 
82
- $$E = E_{\text{pol}} + E_{\text{lamina}} + E_{\text{loop}} + E_{\text{block}}$$
82
+ At a generic level, the system is governed by a total energy of the form
83
+
84
+ $$E = E_{\text{backbone}} + E_{\text{block-copolymer}} + E_{\text{loops}} + E_{\text{excluded}} + E_{\text{confinement}} + E_{\text{chromosomal}}$$
85
+
86
+ where each contribution controls a different aspect of chromatin folding:
87
+
88
+ * $E_{\text{backbone}}$: enforces polymer connectivity and stiffness through bonded and angular interactions, ensuring a realistic chain-like structure
89
+ * $E_{\text{block-copolymer}}$: captures compartment and subcompartment segregation via state-dependent attractive interactions between beads
90
+ * $E_{\text{loops}}$: introduces long-range constraints between genomic loci, mimicking loop extrusion or experimentally observed contacts
91
+ * $E_{\text{excluded}}$: accounts for steric repulsion, preventing unphysical overlaps between beads
92
+ * $E_{\text{confinement}}$: imposes nuclear geometry through spherical confinement and lamina interactions
93
+ * $E_{\text{chromosomal}}$: promotes large-scale organization such as chromosome territories and global compaction
94
+
95
+ Together, these terms define a minimal yet flexible energy landscape where local polymer physics and global genomic features emerge in a unified framework.
83
96
 
84
- Each bead represents a chromatin segment of fixed genomic length. The equilibrium structure is obtained by energy minimization or short relaxation dynamics.
85
97
 
86
98
  ### Polymer Backbone
87
99
 
88
- Polymer connectivity, stiffness, and excluded volume are enforced by the following potential energy terms:
100
+ The backbone contribution $E_{\text{backbone}}$ encodes the connectivity and local rigidity of the polymer chain. It is composed of two standard terms: harmonic bonds enforcing nearest-neighbor distances, and harmonic angle potentials controlling chain stiffness.
89
101
 
90
- $$
91
- E_{\text{pol}} = E_{\text{bond}} + E_{\text{bend}} + E_{\text{rep}}
92
- $$
102
+ The bond (connectivity) term is given by
93
103
 
94
- where
104
+ $$E_{\text{bond}} = \sum_{i} \frac{k_b}{2} \left( r_{i,i+1} - r_0 \right)^2$$
95
105
 
96
- $$
97
- E_{\text{bond}} = \sum_i k_b (r_{i,i+1} - \ell)^2
98
- $$
106
+ where $r_{i,i+1} = |\mathbf{r}_{i+1} - \mathbf{r}_i|$ is the distance between consecutive beads, $r_0$ is the equilibrium bond length, and $k_b$ is the bond stiffness. This term ensures that the polymer remains connected and fluctuates around a preferred contour length.
99
107
 
100
- is the harmonic bond potential that keeps consecutive beads at distance ≈ ℓ,
108
+ The stiffness (bending) term is defined as
101
109
 
102
- $$
103
- E_{\text{bend}} = \sum_i k_s (\theta_i - \pi)^2
104
- $$
110
+ $$E_{\text{angle}} = \sum_{i} \frac{k_\theta}{2} \left( \theta_i - \theta_0 \right)^2$$
105
111
 
106
- is the bending energy that controls chain stiffness (θᵢ is the angle between bonds i−1→i and i→i+1),
112
+ where $\theta_i$ is the angle formed by three consecutive beads $(i, i+1, i+2)$, $\theta_0$ is the preferred angle, and $k_\theta$ controls the bending rigidity. This term penalizes sharp bends and sets the persistence length of the polymer.
113
+
114
+ Altogether, the backbone energy reads
115
+
116
+ $$E_{\text{backbone}} = E_{\text{bond}} + E_{\text{angle}}$$
117
+
118
+ which corresponds to a discretized worm-like chain model with harmonic stretching and bending fluctuations.
107
119
 
108
- and
109
120
 
110
- $$
111
- E_{\text{rep}} = \sum_{i < j} \epsilon \left( \frac{\sigma}{r_{ij}} \right)^\alpha
112
- $$
113
121
 
114
- is the purely repulsive long-range interaction that enforces excluded volume.
122
+ ### Loop Interactions
115
123
 
116
- The first term fixes bond lengths, the second controls bending rigidity, and the third prevents unphysical monomer overlap.
124
+ The loop contribution $E_{\text{loops}}$ introduces long-range interactions between pairs of beads $(m,n)$, representing loop extrusion or experimentally detected contacts. Each loop acts as an effective tether that constrains the spatial distance between distant genomic loci.
117
125
 
126
+ The default model uses a harmonic potential
118
127
 
119
- ### Looping Interactions
128
+ $$E_{\text{loops}}^{\text{harmonic}} = \sum_{(m,n)} \frac{k}{2} \left( r_{mn} - r_0 \right)^2$$
120
129
 
121
- Chromatin loops detected experimentally are modeled as harmonic restraints
130
+ where $r_{mn} = |\mathbf{r}_n - \mathbf{r}_m|$, $r_0$ is the preferred loop length, and $k$ is the stiffness. This formulation strongly penalizes deviations from $r_0$, effectively enforcing fixed-distance loops and providing a simple baseline model.
122
131
 
123
- $$E_{\text{loop}} =
124
- k_\ell \sum_{(i,j)\in \text{loops}} (r_{ij} - d_{ij})^2 .$$
132
+ To allow more physical flexibility, two alternative bounded interactions are introduced. The first is a soft FENE-like potential
125
133
 
126
- The equilibrium loop length depends on interaction strength $S_{ij}$ as
134
+ $$E_{\text{loops}}^{\text{fene}} = \sum_{(m,n)} \frac{k (r_{mn} - r_0)^2}{1 + \alpha (r_{mn} - r_0)^2}$$
127
135
 
128
- $$d_{ij} \propto S_{ij}^{-2/3},
129
- \qquad
130
- d_{ij} \in [0.1, 0.2] .$$
136
+ which behaves harmonically near equilibrium but saturates at large extensions. This avoids unphysical divergence and models loops as extensible but finite-strength tethers.
137
+
138
+ The second alternative is a Gaussian tether
139
+
140
+ $$E_{\text{loops}}^{\text{gaussian}} = \sum_{(m,n)} k \left( 1 - e^{-(r_{mn} - r_0)^2 / \sigma^2} \right)$$
141
+
142
+ which defines a fully smooth, bounded potential well. Close to $r_0$ it is approximately harmonic, while at large distances it saturates to a constant energy, effectively allowing loop breaking without instability.
131
143
 
132
- For single cell data all loops have the same equilibrium distance.
133
144
 
134
145
  ### Block Copolymer Compartmentalization
135
146
 
136
- Long range compartmentalization is described by a Gaussian attraction between beads of the same compartment
147
+ The block-copolymer contribution $E_{\text{block}}$ encodes epigenetic segregation via state-dependent pairwise interactions. Each bead carries a label $s_i$ representing its compartment or subcompartment identity. These labels selectively activate interactions, driving chromatin phase separation into distinct domains.
137
148
 
138
- $$
139
- E_{\text{block}} = \sum_c E_c \exp\left(-\frac{r^2}{2 r_0^2}\right)
140
- $$
149
+ **Compartment level (A/B):** Interactions follow a Gaussian attractive potential:
150
+
151
+ ```math
152
+ E_{\text{comp}} = -\sum \epsilon(s_i,s_j) \exp\left( -\frac{r_{ij}^2}{2r_c^2} \right)
153
+ ```
154
+
155
+ where $r_{ij}$ is the distance between beads and $r_c$ is the interaction range. The coupling $\epsilon(s_i,s_j)$ is attractive for like compartments (A–A, B–B) and weak or repulsive otherwise, reproducing large-scale A/B segregation seen in Hi-C data.
156
+
157
+ **Subcompartment level:** The model is extended to multiple epigenetic states $\alpha,\beta$:
158
+
159
+ ```math
160
+ E_{\text{sub}} = -\sum \epsilon_{\alpha\beta} \exp\left( -\frac{r_{ij}^2}{2r_{sc}^2} \right) \quad \text{for } s_i=\alpha,\ s_j=\beta
161
+ ```
162
+
163
+ where $r_{sc}$ controls the shorter interaction range. This promotes finer microphase separation inside A/B compartments, creating richer internal chromatin organization.
164
+
165
+ At the **chromosome level**, a weak self-attraction is introduced to promote territorial segregation:
166
+
167
+ ```math
168
+ E_{\text{chrom}} = \sum \delta_{\chi_i,\chi_j} V(r_{ij})
169
+ ```
170
+
171
+ where $\chi_i$ denotes chromosome identity and $V(r)$ is a soft attractive potential acting only between beads of the same chromosome. In the default polynomial form,
172
+
173
+ ```math
174
+ V(r) = dE \left(k_C r^4 - r^3 + r^2\right)
175
+ ```
176
+
177
+ This stabilizes globular chromosome conformations and enhances intra-chromosomal clustering while suppressing inter-chromosomal mixing, supporting the emergence of chromosome territories.
178
+
179
+ Beyond the Gaussian baseline, alternative kernels (e.g. Yukawa, power-law, and threshold interactions) modify the effective interaction range and decay profile, allowing systematic exploration of how the functional form of epigenetic attraction shapes chromatin organization.
180
+
181
+
182
+ * The Yukawa form replaces the Gaussian decay with a screened Coulomb-like interaction
183
+
184
+ $$V(r) \sim -\frac{e^{-r/\lambda}}{r}$$
185
+
186
+ introducing a longer-ranged but exponentially screened attraction. This allows compartmental domains to communicate over larger genomic distances and can enhance domain coarsening.
141
187
 
142
- Only beads sharing the same compartment label interact. The interaction strength satisfies $|E_B| > |E_A|$, enforcing stronger attraction for inactive chromatin. The interaction range is
188
+ * The power-law interaction
143
189
 
144
- $$r_0 = \frac{R_2 - R_1}{20}.$$
190
+ $$V(r) \sim -\frac{1}{r^\alpha + \epsilon}$$
145
191
 
146
- Subcompartments are treated by assigning distinct energy levels.
192
+ removes a characteristic length scale entirely, producing scale-free interactions. This is useful for probing whether compartmental organization can emerge from purely algebraic long-range correlations.
147
193
 
148
- ### Nuclear Geometry and Lamina
194
+ * For subcompartments, the theta (contact) model
149
195
 
150
- Chromatin is confined between two concentric spherical boundaries with radii $R_1$ (nucleolus) and $R_2$ (lamina). Soft boundary conditions are imposed by
196
+ $$V(r) \sim -\Theta(r_c - r)$$
151
197
 
152
- $$E_{\text{bc}} =
153
- C\bigl[\max(0,r-R_2)^2 + \max(0,R_1-r)^2\bigr].$$
198
+ reduces interactions to a hard cutoff contact rule, where only sufficiently close loci interact. This provides a minimal, binary version of epigenetic attraction, useful as a null model for testing the necessity of smooth potentials.
154
199
 
155
- #### B Compartment Lamina Attraction
200
+ * For chromosome-level organization, the alternatives modify the confinement landscape: Gaussian attraction produces smooth globular collapse, while the saturating form
156
201
 
157
- Inactive compartments are attracted to the nuclear lamina via
202
+ $$V(r) \sim -\frac{1}{1 + k_C r^2}$$
203
+
204
+ limits the strength of long-range attraction, preventing over-collapse and allowing more flexible chromosome territories.
205
+
206
+
207
+ ### Nuclear Geometry and Lamina Interactions
208
+
209
+ The lamina-related contribution introduces spatial confinement and peripheral anchoring of specific chromatin states, effectively coupling genome organization to nuclear geometry.
210
+
211
+ The spherical container defines a soft nuclear boundary by penalizing excursions outside a radial shell. The energy is
212
+
213
+ $$E_{\text{container}} = C \sum_i \left[ \max(0, r_i - R_2)^2 + \max(0, R_1 - r_i)^2 \right]$$
214
+
215
+ where $r_i$ is the radial distance of bead $i$ from the nuclear center. This creates a confined annular domain between radii $R_1$ and $R_2$, representing the accessible nuclear volume and preventing unphysical collapse or escape.
216
+
217
+ On top of this geometric confinement, the lamina interaction introduces state-dependent attraction of B-type chromatin to the nuclear periphery:
218
+
219
+ $$E_{\text{lamina}} = - \sum_i B(s_i), V(r_i)$$
220
+
221
+ where $s_i$ is the compartment state and $B(s_i)$ selects B-compartment beads. The function $V(r)$ encodes different radial potentials depending on the model choice:
222
+
223
+ The sinusoidal shell (default) creates a sharp peripheral preference within the shell
224
+
225
+ $$V(r) = \sin^8\left(\frac{\pi (r - R_1)}{R_2 - R_1}\right) - 1$$
226
+
227
+ while Gaussian shells localize attraction around the two boundaries $R_1$ and $R_2$
228
+
229
+ $$V(r) \sim -\left[e^{-(r-R_1)^2/(2\sigma^2)} + e^{-(r-R_2)^2/(2\sigma^2)}\right]$$
230
+
231
+ The harmonic shell instead pulls B-chromatin toward the mid-shell radius $r_0=\frac{R_1+R_2}{2}$,
232
+
233
+ $$V(r) \sim (r - r_0)^2$$
234
+
235
+ and the logistic form creates smooth attractive walls near both boundaries using sigmoidal transitions.
236
+
237
+ Together, these terms implement a minimal physical model of nuclear architecture where confinement defines the available volume, and lamina attraction biases epigenetically marked chromatin toward the nuclear periphery.
238
+
239
+
240
+ ### Nucleosome Scale Interpolation
241
+
242
+ After coarse grained optimization, nucleosome positions are interpolated using a beads on the string zigzag model. Each nucleosome is represented as a helix with 1.65 DNA turns. The number of nucleosomes per bead is derived from normalized ATAC Seq signal, enforcing nucleosome rich regions in low accessibility chromatin.
243
+
244
+
245
+ ## Internal parameter definitions
246
+
247
+ All geometric and interaction scales are now derived from a single microscopic length scale, the polymer bond length $b_0 =$ POL_HARMONIC_BOND_R0, ensuring consistent density and eliminating arbitrary global normalization factors.
248
+
249
+ The nuclear confinement is modeled as a dense polymer globule with constant monomer density. In this regime, the outer nuclear radius follows the standard scaling law
158
250
 
159
251
  $$
160
- E_{Bl} = B \left( \sin^8 \frac{r-R_1}{R_2-R_1} - 1 \right)
161
- \left[ \delta(s+1) + \delta(s+2) \right]
252
+ R_2 = b_0 N^{1/3},
162
253
  $$
163
254
 
164
- This potential has minima near both inner and outer boundaries.
255
+ which enforces $N / R_2^3 \approx \text{const}$ and guarantees physically consistent compaction as system size changes. The inner compartment (nucleolus-like region) is defined via a fixed volume fraction $f$ of the nuclear volume, leading to
165
256
 
166
- #### Chromosome Size Dependent Nucleolar Attraction
257
+ $$
258
+ R_1 = R_2 f^{1/3}.
259
+ $$
167
260
 
168
- Smaller chromosomes experience a weak attraction toward the nucleolus
261
+ This construction ensures that compartment organization scales in a volume-preserving manner rather than through independent geometric tuning.
262
+
263
+ The compartment interaction length scale $r_c$ (previously $r_{\text{comp}}$) is no longer tied to geometric confinement. Instead, it represents the physical decay length of short-range attractive interactions between chromatin compartments and nuclear structures. It is defined directly from the polymer bond length as
169
264
 
170
265
  $$
171
- E_G = G s_c \left( \sin\frac{r-R_1}{\ell_G} - \left(\frac{r-R_1}{\ell_G}\right)^2 \right)
266
+ r_c \sim \mathcal{O}(b_0),
172
267
  $$
173
268
 
174
- where $s_c \in [0,1]$ encodes chromosome size ranking.
269
+ typically chosen as a small multiple of $b_0$ (e.g. $r_c \approx 1.5 b_0$), ensuring that interactions remain local and comparable to nearest-neighbor connectivity along the polymer backbone.
175
270
 
176
- ### Optional Chromosome Globularization
271
+ Loop constraints are encoded through bond-specific equilibrium distances $r_0^{(i)}$, which may either be globally fixed or informed by experimental loop length data $d_i$. This introduces controlled heterogeneity in loop architecture:
177
272
 
178
- When loop or compartment information is insufficient, an optional weak confining potential can be applied
273
+ $$
274
+ r_0^{(i)} \in (r_0^{\text{global}}, d_i),
275
+ $$
179
276
 
180
- $$E_{\text{chrom}} =
181
- \sum E_n \left(k_C r^4 - b r^3 + c r^2\right).$$
277
+ allowing loops to interpolate between polymer-native scales and experimentally inferred constraints.
182
278
 
183
- This term has no direct biological interpretation and is disabled by default.
279
+ Each bead carries discrete state variables such as compartment identity $s_i$ and chromosome label $\chi_i$. These variables do not directly define geometry but modulate interactions through selection rules of the form
184
280
 
185
- ### Nucleosome Scale Interpolation
281
+ $$
282
+ E_{ij} \propto \delta(s_i, s_j) \quad E_{ij} \propto \delta(\chi_i, \chi_j),
283
+ $$
284
+
285
+ ensuring that only compatible epigenetic or chromosomal states contribute to attractive or repulsive terms. Together, these elements couple polymer physics, nuclear confinement, and epigenetic structure into a unified multiscale chromatin framework.
186
286
 
187
- After coarse grained optimization, nucleosome positions are interpolated using a beads on the string zigzag model. Each nucleosome is represented as a helix with 1.65 DNA turns. The number of nucleosomes per bead is derived from normalized ATAC Seq signal, enforcing nucleosome rich regions in low accessibility chromatin.
188
287
 
189
288
 
190
289
  ## Input Data
@@ -438,7 +537,7 @@ Below is a categorized description of the simulation arguments and their default
438
537
  | SC_SCALE | float | 1000.0 | kJ/mol/nm^2 | Scaling factor for the spherical container. |
439
538
  | CHB_USE_CHROMOSOMAL_BLOCKS | bool | False | None | Use chromosomal blocks. |
440
539
  | CHB_KC | float | 0.3 | nm^(-4) | Block copolymer width parameter. |
441
- | CHB_DE | float | 1e-5 | kJ/mol | Energy factor for chromosomal blocks. |
540
+ | CHB_DE | float | 1e-4 | kJ/mol | Energy factor for chromosomal blocks. |
442
541
  | SCB_USE_SUBCOMPARTMENT_BLOCKS| bool | False | None | Use subcompartment blocks. |
443
542
  | SCB_DISTANCE | float | None | nm | Equilibrium distance for subcompartment blocks. |
444
543
  | SCB_EA1 | float | 1.0 | kJ/mol | Energy strength for A1 compartment. |
@@ -465,6 +564,17 @@ Below is a categorized description of the simulation arguments and their default
465
564
  | POINTS_PER_NUC | int | 20 | None | Number of points in a nucleosome helix. |
466
565
  | PHI_NORM | float | pi/5 | None | Zig-zag angle for nucleosome helix. |
467
566
 
567
+ #### Functional Form Switches (Forcefield Modes) - Experimental
568
+ | Argument Name | Type | Default | Options | Description |
569
+ | ------------------ | ---- | ---------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
570
+ | EV_FORCE_TYPE | str | powerlaw | powerlaw, soft_lj, gaussian_core | Controls excluded volume repulsion functional form (from hard-scale repulsion to soft-core melt-like behavior). |
571
+ | COB_FORCE_TYPE | str | gaussian | gaussian, yukawa, powerlaw, theta | Sets compartment A/B interaction kernel (short-range Gaussian segregation, screened Yukawa, scale-free powerlaw, or hard contact model). |
572
+ | SCB_FORCE_TYPE | str | gaussian | gaussian, yukawa, powerlaw, theta | Subcompartment interaction kernel with finer epigenetic state resolution (same functional family as compartments but higher specificity). |
573
+ | BLAMINA_FORCE_TYPE | str | sin | sin, gaussian_shell, harmonic_shell, logistic_shell | Defines lamina interaction profile for B-type compartments (oscillatory shell, localized Gaussian layers, harmonic attraction, or smooth boundary walls). |
574
+ | LE_LOOP_FORCE_TYPE | str | harmonic | harmonic, fene_soft, gaussian_tether | Loop constraint model (linear spring, bounded FENE-like spring, or smooth Gaussian tether). |
575
+ | CHB_FORCE_TYPE | str | polynomial | polynomial, gaussian, saturating | Chromosome-level self-attraction kernel controlling global compaction into chromosome territories. |
576
+ | CENTRAL_FORCE_TYPE | str | harmonic | harmonic, gaussian, logistic | Central nucleolar attraction model controlling radial bias of chromosomes toward nucleus center; encodes size-dependent positioning and nucleolar enrichment strength. |
577
+
468
578
 
469
579
  ## Output Directory
470
580
  The output directory is organized in the following folders,
@@ -39,116 +39,215 @@ pip install MultiMM
39
39
 
40
40
  PyPI software: https://pypi.org/project/MultiMM/.
41
41
 
42
- ## Mathematical Model
42
+ ### Model Overview
43
43
 
44
- We model chromatin as a coarse-grained polymer confined inside the nucleus. The system is described by an effective energy functional
44
+ We model chromatin as a coarse-grained polymer where the total energy $E$ is decomposed into a set of physically motivated interaction terms capturing polymer mechanics, epigenetic organization, and structural constraints. Each term encodes a distinct biological mechanism, allowing the model to reproduce both local polymer behavior and large-scale genome organization such as compartments and loops.
45
45
 
46
- $$E = E_{\text{pol}} + E_{\text{lamina}} + E_{\text{loop}} + E_{\text{block}}$$
46
+ At a generic level, the system is governed by a total energy of the form
47
+
48
+ $$E = E_{\text{backbone}} + E_{\text{block-copolymer}} + E_{\text{loops}} + E_{\text{excluded}} + E_{\text{confinement}} + E_{\text{chromosomal}}$$
49
+
50
+ where each contribution controls a different aspect of chromatin folding:
51
+
52
+ * $E_{\text{backbone}}$: enforces polymer connectivity and stiffness through bonded and angular interactions, ensuring a realistic chain-like structure
53
+ * $E_{\text{block-copolymer}}$: captures compartment and subcompartment segregation via state-dependent attractive interactions between beads
54
+ * $E_{\text{loops}}$: introduces long-range constraints between genomic loci, mimicking loop extrusion or experimentally observed contacts
55
+ * $E_{\text{excluded}}$: accounts for steric repulsion, preventing unphysical overlaps between beads
56
+ * $E_{\text{confinement}}$: imposes nuclear geometry through spherical confinement and lamina interactions
57
+ * $E_{\text{chromosomal}}$: promotes large-scale organization such as chromosome territories and global compaction
58
+
59
+ Together, these terms define a minimal yet flexible energy landscape where local polymer physics and global genomic features emerge in a unified framework.
47
60
 
48
- Each bead represents a chromatin segment of fixed genomic length. The equilibrium structure is obtained by energy minimization or short relaxation dynamics.
49
61
 
50
62
  ### Polymer Backbone
51
63
 
52
- Polymer connectivity, stiffness, and excluded volume are enforced by the following potential energy terms:
64
+ The backbone contribution $E_{\text{backbone}}$ encodes the connectivity and local rigidity of the polymer chain. It is composed of two standard terms: harmonic bonds enforcing nearest-neighbor distances, and harmonic angle potentials controlling chain stiffness.
53
65
 
54
- $$
55
- E_{\text{pol}} = E_{\text{bond}} + E_{\text{bend}} + E_{\text{rep}}
56
- $$
66
+ The bond (connectivity) term is given by
57
67
 
58
- where
68
+ $$E_{\text{bond}} = \sum_{i} \frac{k_b}{2} \left( r_{i,i+1} - r_0 \right)^2$$
59
69
 
60
- $$
61
- E_{\text{bond}} = \sum_i k_b (r_{i,i+1} - \ell)^2
62
- $$
70
+ where $r_{i,i+1} = |\mathbf{r}_{i+1} - \mathbf{r}_i|$ is the distance between consecutive beads, $r_0$ is the equilibrium bond length, and $k_b$ is the bond stiffness. This term ensures that the polymer remains connected and fluctuates around a preferred contour length.
63
71
 
64
- is the harmonic bond potential that keeps consecutive beads at distance ≈ ℓ,
72
+ The stiffness (bending) term is defined as
65
73
 
66
- $$
67
- E_{\text{bend}} = \sum_i k_s (\theta_i - \pi)^2
68
- $$
74
+ $$E_{\text{angle}} = \sum_{i} \frac{k_\theta}{2} \left( \theta_i - \theta_0 \right)^2$$
69
75
 
70
- is the bending energy that controls chain stiffness (θᵢ is the angle between bonds i−1→i and i→i+1),
76
+ where $\theta_i$ is the angle formed by three consecutive beads $(i, i+1, i+2)$, $\theta_0$ is the preferred angle, and $k_\theta$ controls the bending rigidity. This term penalizes sharp bends and sets the persistence length of the polymer.
77
+
78
+ Altogether, the backbone energy reads
79
+
80
+ $$E_{\text{backbone}} = E_{\text{bond}} + E_{\text{angle}}$$
81
+
82
+ which corresponds to a discretized worm-like chain model with harmonic stretching and bending fluctuations.
71
83
 
72
- and
73
84
 
74
- $$
75
- E_{\text{rep}} = \sum_{i < j} \epsilon \left( \frac{\sigma}{r_{ij}} \right)^\alpha
76
- $$
77
85
 
78
- is the purely repulsive long-range interaction that enforces excluded volume.
86
+ ### Loop Interactions
79
87
 
80
- The first term fixes bond lengths, the second controls bending rigidity, and the third prevents unphysical monomer overlap.
88
+ The loop contribution $E_{\text{loops}}$ introduces long-range interactions between pairs of beads $(m,n)$, representing loop extrusion or experimentally detected contacts. Each loop acts as an effective tether that constrains the spatial distance between distant genomic loci.
81
89
 
90
+ The default model uses a harmonic potential
82
91
 
83
- ### Looping Interactions
92
+ $$E_{\text{loops}}^{\text{harmonic}} = \sum_{(m,n)} \frac{k}{2} \left( r_{mn} - r_0 \right)^2$$
84
93
 
85
- Chromatin loops detected experimentally are modeled as harmonic restraints
94
+ where $r_{mn} = |\mathbf{r}_n - \mathbf{r}_m|$, $r_0$ is the preferred loop length, and $k$ is the stiffness. This formulation strongly penalizes deviations from $r_0$, effectively enforcing fixed-distance loops and providing a simple baseline model.
86
95
 
87
- $$E_{\text{loop}} =
88
- k_\ell \sum_{(i,j)\in \text{loops}} (r_{ij} - d_{ij})^2 .$$
96
+ To allow more physical flexibility, two alternative bounded interactions are introduced. The first is a soft FENE-like potential
89
97
 
90
- The equilibrium loop length depends on interaction strength $S_{ij}$ as
98
+ $$E_{\text{loops}}^{\text{fene}} = \sum_{(m,n)} \frac{k (r_{mn} - r_0)^2}{1 + \alpha (r_{mn} - r_0)^2}$$
91
99
 
92
- $$d_{ij} \propto S_{ij}^{-2/3},
93
- \qquad
94
- d_{ij} \in [0.1, 0.2] .$$
100
+ which behaves harmonically near equilibrium but saturates at large extensions. This avoids unphysical divergence and models loops as extensible but finite-strength tethers.
101
+
102
+ The second alternative is a Gaussian tether
103
+
104
+ $$E_{\text{loops}}^{\text{gaussian}} = \sum_{(m,n)} k \left( 1 - e^{-(r_{mn} - r_0)^2 / \sigma^2} \right)$$
105
+
106
+ which defines a fully smooth, bounded potential well. Close to $r_0$ it is approximately harmonic, while at large distances it saturates to a constant energy, effectively allowing loop breaking without instability.
95
107
 
96
- For single cell data all loops have the same equilibrium distance.
97
108
 
98
109
  ### Block Copolymer Compartmentalization
99
110
 
100
- Long range compartmentalization is described by a Gaussian attraction between beads of the same compartment
111
+ The block-copolymer contribution $E_{\text{block}}$ encodes epigenetic segregation via state-dependent pairwise interactions. Each bead carries a label $s_i$ representing its compartment or subcompartment identity. These labels selectively activate interactions, driving chromatin phase separation into distinct domains.
101
112
 
102
- $$
103
- E_{\text{block}} = \sum_c E_c \exp\left(-\frac{r^2}{2 r_0^2}\right)
104
- $$
113
+ **Compartment level (A/B):** Interactions follow a Gaussian attractive potential:
114
+
115
+ ```math
116
+ E_{\text{comp}} = -\sum \epsilon(s_i,s_j) \exp\left( -\frac{r_{ij}^2}{2r_c^2} \right)
117
+ ```
118
+
119
+ where $r_{ij}$ is the distance between beads and $r_c$ is the interaction range. The coupling $\epsilon(s_i,s_j)$ is attractive for like compartments (A–A, B–B) and weak or repulsive otherwise, reproducing large-scale A/B segregation seen in Hi-C data.
120
+
121
+ **Subcompartment level:** The model is extended to multiple epigenetic states $\alpha,\beta$:
122
+
123
+ ```math
124
+ E_{\text{sub}} = -\sum \epsilon_{\alpha\beta} \exp\left( -\frac{r_{ij}^2}{2r_{sc}^2} \right) \quad \text{for } s_i=\alpha,\ s_j=\beta
125
+ ```
126
+
127
+ where $r_{sc}$ controls the shorter interaction range. This promotes finer microphase separation inside A/B compartments, creating richer internal chromatin organization.
128
+
129
+ At the **chromosome level**, a weak self-attraction is introduced to promote territorial segregation:
130
+
131
+ ```math
132
+ E_{\text{chrom}} = \sum \delta_{\chi_i,\chi_j} V(r_{ij})
133
+ ```
134
+
135
+ where $\chi_i$ denotes chromosome identity and $V(r)$ is a soft attractive potential acting only between beads of the same chromosome. In the default polynomial form,
136
+
137
+ ```math
138
+ V(r) = dE \left(k_C r^4 - r^3 + r^2\right)
139
+ ```
140
+
141
+ This stabilizes globular chromosome conformations and enhances intra-chromosomal clustering while suppressing inter-chromosomal mixing, supporting the emergence of chromosome territories.
142
+
143
+ Beyond the Gaussian baseline, alternative kernels (e.g. Yukawa, power-law, and threshold interactions) modify the effective interaction range and decay profile, allowing systematic exploration of how the functional form of epigenetic attraction shapes chromatin organization.
144
+
145
+
146
+ * The Yukawa form replaces the Gaussian decay with a screened Coulomb-like interaction
147
+
148
+ $$V(r) \sim -\frac{e^{-r/\lambda}}{r}$$
149
+
150
+ introducing a longer-ranged but exponentially screened attraction. This allows compartmental domains to communicate over larger genomic distances and can enhance domain coarsening.
105
151
 
106
- Only beads sharing the same compartment label interact. The interaction strength satisfies $|E_B| > |E_A|$, enforcing stronger attraction for inactive chromatin. The interaction range is
152
+ * The power-law interaction
107
153
 
108
- $$r_0 = \frac{R_2 - R_1}{20}.$$
154
+ $$V(r) \sim -\frac{1}{r^\alpha + \epsilon}$$
109
155
 
110
- Subcompartments are treated by assigning distinct energy levels.
156
+ removes a characteristic length scale entirely, producing scale-free interactions. This is useful for probing whether compartmental organization can emerge from purely algebraic long-range correlations.
111
157
 
112
- ### Nuclear Geometry and Lamina
158
+ * For subcompartments, the theta (contact) model
113
159
 
114
- Chromatin is confined between two concentric spherical boundaries with radii $R_1$ (nucleolus) and $R_2$ (lamina). Soft boundary conditions are imposed by
160
+ $$V(r) \sim -\Theta(r_c - r)$$
115
161
 
116
- $$E_{\text{bc}} =
117
- C\bigl[\max(0,r-R_2)^2 + \max(0,R_1-r)^2\bigr].$$
162
+ reduces interactions to a hard cutoff contact rule, where only sufficiently close loci interact. This provides a minimal, binary version of epigenetic attraction, useful as a null model for testing the necessity of smooth potentials.
118
163
 
119
- #### B Compartment Lamina Attraction
164
+ * For chromosome-level organization, the alternatives modify the confinement landscape: Gaussian attraction produces smooth globular collapse, while the saturating form
120
165
 
121
- Inactive compartments are attracted to the nuclear lamina via
166
+ $$V(r) \sim -\frac{1}{1 + k_C r^2}$$
167
+
168
+ limits the strength of long-range attraction, preventing over-collapse and allowing more flexible chromosome territories.
169
+
170
+
171
+ ### Nuclear Geometry and Lamina Interactions
172
+
173
+ The lamina-related contribution introduces spatial confinement and peripheral anchoring of specific chromatin states, effectively coupling genome organization to nuclear geometry.
174
+
175
+ The spherical container defines a soft nuclear boundary by penalizing excursions outside a radial shell. The energy is
176
+
177
+ $$E_{\text{container}} = C \sum_i \left[ \max(0, r_i - R_2)^2 + \max(0, R_1 - r_i)^2 \right]$$
178
+
179
+ where $r_i$ is the radial distance of bead $i$ from the nuclear center. This creates a confined annular domain between radii $R_1$ and $R_2$, representing the accessible nuclear volume and preventing unphysical collapse or escape.
180
+
181
+ On top of this geometric confinement, the lamina interaction introduces state-dependent attraction of B-type chromatin to the nuclear periphery:
182
+
183
+ $$E_{\text{lamina}} = - \sum_i B(s_i), V(r_i)$$
184
+
185
+ where $s_i$ is the compartment state and $B(s_i)$ selects B-compartment beads. The function $V(r)$ encodes different radial potentials depending on the model choice:
186
+
187
+ The sinusoidal shell (default) creates a sharp peripheral preference within the shell
188
+
189
+ $$V(r) = \sin^8\left(\frac{\pi (r - R_1)}{R_2 - R_1}\right) - 1$$
190
+
191
+ while Gaussian shells localize attraction around the two boundaries $R_1$ and $R_2$
192
+
193
+ $$V(r) \sim -\left[e^{-(r-R_1)^2/(2\sigma^2)} + e^{-(r-R_2)^2/(2\sigma^2)}\right]$$
194
+
195
+ The harmonic shell instead pulls B-chromatin toward the mid-shell radius $r_0=\frac{R_1+R_2}{2}$,
196
+
197
+ $$V(r) \sim (r - r_0)^2$$
198
+
199
+ and the logistic form creates smooth attractive walls near both boundaries using sigmoidal transitions.
200
+
201
+ Together, these terms implement a minimal physical model of nuclear architecture where confinement defines the available volume, and lamina attraction biases epigenetically marked chromatin toward the nuclear periphery.
202
+
203
+
204
+ ### Nucleosome Scale Interpolation
205
+
206
+ After coarse grained optimization, nucleosome positions are interpolated using a beads on the string zigzag model. Each nucleosome is represented as a helix with 1.65 DNA turns. The number of nucleosomes per bead is derived from normalized ATAC Seq signal, enforcing nucleosome rich regions in low accessibility chromatin.
207
+
208
+
209
+ ## Internal parameter definitions
210
+
211
+ All geometric and interaction scales are now derived from a single microscopic length scale, the polymer bond length $b_0 =$ POL_HARMONIC_BOND_R0, ensuring consistent density and eliminating arbitrary global normalization factors.
212
+
213
+ The nuclear confinement is modeled as a dense polymer globule with constant monomer density. In this regime, the outer nuclear radius follows the standard scaling law
122
214
 
123
215
  $$
124
- E_{Bl} = B \left( \sin^8 \frac{r-R_1}{R_2-R_1} - 1 \right)
125
- \left[ \delta(s+1) + \delta(s+2) \right]
216
+ R_2 = b_0 N^{1/3},
126
217
  $$
127
218
 
128
- This potential has minima near both inner and outer boundaries.
219
+ which enforces $N / R_2^3 \approx \text{const}$ and guarantees physically consistent compaction as system size changes. The inner compartment (nucleolus-like region) is defined via a fixed volume fraction $f$ of the nuclear volume, leading to
129
220
 
130
- #### Chromosome Size Dependent Nucleolar Attraction
221
+ $$
222
+ R_1 = R_2 f^{1/3}.
223
+ $$
131
224
 
132
- Smaller chromosomes experience a weak attraction toward the nucleolus
225
+ This construction ensures that compartment organization scales in a volume-preserving manner rather than through independent geometric tuning.
226
+
227
+ The compartment interaction length scale $r_c$ (previously $r_{\text{comp}}$) is no longer tied to geometric confinement. Instead, it represents the physical decay length of short-range attractive interactions between chromatin compartments and nuclear structures. It is defined directly from the polymer bond length as
133
228
 
134
229
  $$
135
- E_G = G s_c \left( \sin\frac{r-R_1}{\ell_G} - \left(\frac{r-R_1}{\ell_G}\right)^2 \right)
230
+ r_c \sim \mathcal{O}(b_0),
136
231
  $$
137
232
 
138
- where $s_c \in [0,1]$ encodes chromosome size ranking.
233
+ typically chosen as a small multiple of $b_0$ (e.g. $r_c \approx 1.5 b_0$), ensuring that interactions remain local and comparable to nearest-neighbor connectivity along the polymer backbone.
139
234
 
140
- ### Optional Chromosome Globularization
235
+ Loop constraints are encoded through bond-specific equilibrium distances $r_0^{(i)}$, which may either be globally fixed or informed by experimental loop length data $d_i$. This introduces controlled heterogeneity in loop architecture:
141
236
 
142
- When loop or compartment information is insufficient, an optional weak confining potential can be applied
237
+ $$
238
+ r_0^{(i)} \in (r_0^{\text{global}}, d_i),
239
+ $$
143
240
 
144
- $$E_{\text{chrom}} =
145
- \sum E_n \left(k_C r^4 - b r^3 + c r^2\right).$$
241
+ allowing loops to interpolate between polymer-native scales and experimentally inferred constraints.
146
242
 
147
- This term has no direct biological interpretation and is disabled by default.
243
+ Each bead carries discrete state variables such as compartment identity $s_i$ and chromosome label $\chi_i$. These variables do not directly define geometry but modulate interactions through selection rules of the form
148
244
 
149
- ### Nucleosome Scale Interpolation
245
+ $$
246
+ E_{ij} \propto \delta(s_i, s_j) \quad E_{ij} \propto \delta(\chi_i, \chi_j),
247
+ $$
248
+
249
+ ensuring that only compatible epigenetic or chromosomal states contribute to attractive or repulsive terms. Together, these elements couple polymer physics, nuclear confinement, and epigenetic structure into a unified multiscale chromatin framework.
150
250
 
151
- After coarse grained optimization, nucleosome positions are interpolated using a beads on the string zigzag model. Each nucleosome is represented as a helix with 1.65 DNA turns. The number of nucleosomes per bead is derived from normalized ATAC Seq signal, enforcing nucleosome rich regions in low accessibility chromatin.
152
251
 
153
252
 
154
253
  ## Input Data
@@ -402,7 +501,7 @@ Below is a categorized description of the simulation arguments and their default
402
501
  | SC_SCALE | float | 1000.0 | kJ/mol/nm^2 | Scaling factor for the spherical container. |
403
502
  | CHB_USE_CHROMOSOMAL_BLOCKS | bool | False | None | Use chromosomal blocks. |
404
503
  | CHB_KC | float | 0.3 | nm^(-4) | Block copolymer width parameter. |
405
- | CHB_DE | float | 1e-5 | kJ/mol | Energy factor for chromosomal blocks. |
504
+ | CHB_DE | float | 1e-4 | kJ/mol | Energy factor for chromosomal blocks. |
406
505
  | SCB_USE_SUBCOMPARTMENT_BLOCKS| bool | False | None | Use subcompartment blocks. |
407
506
  | SCB_DISTANCE | float | None | nm | Equilibrium distance for subcompartment blocks. |
408
507
  | SCB_EA1 | float | 1.0 | kJ/mol | Energy strength for A1 compartment. |
@@ -429,6 +528,17 @@ Below is a categorized description of the simulation arguments and their default
429
528
  | POINTS_PER_NUC | int | 20 | None | Number of points in a nucleosome helix. |
430
529
  | PHI_NORM | float | pi/5 | None | Zig-zag angle for nucleosome helix. |
431
530
 
531
+ #### Functional Form Switches (Forcefield Modes) - Experimental
532
+ | Argument Name | Type | Default | Options | Description |
533
+ | ------------------ | ---- | ---------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
534
+ | EV_FORCE_TYPE | str | powerlaw | powerlaw, soft_lj, gaussian_core | Controls excluded volume repulsion functional form (from hard-scale repulsion to soft-core melt-like behavior). |
535
+ | COB_FORCE_TYPE | str | gaussian | gaussian, yukawa, powerlaw, theta | Sets compartment A/B interaction kernel (short-range Gaussian segregation, screened Yukawa, scale-free powerlaw, or hard contact model). |
536
+ | SCB_FORCE_TYPE | str | gaussian | gaussian, yukawa, powerlaw, theta | Subcompartment interaction kernel with finer epigenetic state resolution (same functional family as compartments but higher specificity). |
537
+ | BLAMINA_FORCE_TYPE | str | sin | sin, gaussian_shell, harmonic_shell, logistic_shell | Defines lamina interaction profile for B-type compartments (oscillatory shell, localized Gaussian layers, harmonic attraction, or smooth boundary walls). |
538
+ | LE_LOOP_FORCE_TYPE | str | harmonic | harmonic, fene_soft, gaussian_tether | Loop constraint model (linear spring, bounded FENE-like spring, or smooth Gaussian tether). |
539
+ | CHB_FORCE_TYPE | str | polynomial | polynomial, gaussian, saturating | Chromosome-level self-attraction kernel controlling global compaction into chromosome territories. |
540
+ | CENTRAL_FORCE_TYPE | str | harmonic | harmonic, gaussian, logistic | Central nucleolar attraction model controlling radial bias of chromosomes toward nucleus center; encodes size-dependent positioning and nucleolar enrichment strength. |
541
+
432
542
 
433
543
  ## Output Directory
434
544
  The output directory is organized in the following folders,
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "MultiMM"
7
- version = "2.0.1"
7
+ version = "2.0.2"
8
8
  description = "A tool for chromatin modeling from nucleosomes to chromosomal territories."
9
9
  readme = "README.md"
10
10
  authors = [