pyLoopSage 1.1.5__tar.gz → 1.1.7__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.
- {pyloopsage-1.1.5/pyLoopSage.egg-info → pyloopsage-1.1.7}/PKG-INFO +75 -46
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/README.md +74 -45
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/__init__.py +1 -1
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/args_definition.py +19 -6
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/initial_structures.py +22 -2
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/knots.py +3 -0
- pyloopsage-1.1.7/loopsage/logger.py +64 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/md.py +108 -33
- pyloopsage-1.1.7/loopsage/plots.py +495 -0
- pyloopsage-1.1.7/loopsage/preproc.py +1139 -0
- pyloopsage-1.1.7/loopsage/run.py +232 -0
- pyloopsage-1.1.7/loopsage/stochastic_simulation.py +1071 -0
- pyloopsage-1.1.7/loopsage/utils.py +1197 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/vizualization_tools.py +5 -2
- {pyloopsage-1.1.5 → pyloopsage-1.1.7/pyLoopSage.egg-info}/PKG-INFO +75 -46
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/pyLoopSage.egg-info/SOURCES.txt +1 -1
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/setup.py +2 -2
- pyloopsage-1.1.5/loopsage/em.py +0 -135
- pyloopsage-1.1.5/loopsage/plots.py +0 -254
- pyloopsage-1.1.5/loopsage/preproc.py +0 -124
- pyloopsage-1.1.5/loopsage/run.py +0 -102
- pyloopsage-1.1.5/loopsage/stochastic_simulation.py +0 -380
- pyloopsage-1.1.5/loopsage/utils.py +0 -476
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/LICENSE +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/MANIFEST.in +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/loopsage/forcefields/classic_sm_ff.xml +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/pyLoopSage.egg-info/dependency_links.txt +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/pyLoopSage.egg-info/entry_points.txt +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/pyLoopSage.egg-info/requires.txt +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/pyLoopSage.egg-info/top_level.txt +0 -0
- {pyloopsage-1.1.5 → pyloopsage-1.1.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyLoopSage
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7
|
|
4
4
|
Summary: An energy-based stochastic model of loop extrusion in chromatin.
|
|
5
5
|
Home-page: https://github.com/SFGLab/pyLoopSage
|
|
6
6
|
Author: Sebastian Korsak
|
|
@@ -48,6 +48,8 @@ Dynamic: summary
|
|
|
48
48
|
# pyLoopSage
|
|
49
49
|
Updated version of the stochastic loop extrusion model: LoopSage with capability to run incredibly fast, parallelized across CPU cores. This package is even more user-friendly and it can be installed via PyPI.
|
|
50
50
|
|
|
51
|
+

|
|
52
|
+
|
|
51
53
|
## New features
|
|
52
54
|
|
|
53
55
|
- More user-friendly environment.
|
|
@@ -80,7 +82,7 @@ $K(m_{i},n_{i};m_{j},n_{j})$ which takes the value 1 when $m_{i} < m_{j} < n_{i}
|
|
|
80
82
|
|
|
81
83
|
These $L(\cdot), R(\cdot)$ functions are two functions that define the binding potential and they are orientation specific - so they are different for left and right position of cohesin (because CTCF motifs are orientation specific), therefore when we have a gap in these functions, it means presence of CTCF. These two functions are derived from data with CTCF binning and by running the script for probabilistic orientation. Moreover, by $N_{(\cdot)}$ we symbolize the normalization constants for each factor,
|
|
82
84
|
|
|
83
|
-
$$c_{\text{fold}}=-\dfrac{N_{\text{beads}}f}{N_{\text{lef}}\log(N_{\text{beads}}/N_{\text{lef}})},\quad c_{\text{bind}}=-\dfrac{
|
|
85
|
+
$$c_{\text{fold}}=-\dfrac{N_{\text{beads}}f}{N_{\text{lef}}\log(N_{\text{beads}}/N_{\text{lef}})},\quad c_{\text{bind}}=-\dfrac{2N_{\text{beads}}b}{N_{CTCF}},\quad c_{\text{cross}}=\kappa \times 10^4.$$
|
|
84
86
|
|
|
85
87
|
The parameters are defined in such a way that when $f=b=\kappa=1$, the three terms of the stochastic energy are balanced. To clarrify, this parametrization is slightly different than this of the original paper. We multiply with $N_{\text{beads}}$, so as to keep the input parameters $f,b,\kappa$ simpler close to 1. Therefore, a value $f=0.1$ leads to unfolded structures, and a value $f=2$ it leads to very fast propagating long loops.
|
|
86
88
|
|
|
@@ -168,6 +170,7 @@ You do **not** need to manually stop or clean up anything—the container is tem
|
|
|
168
170
|
|
|
169
171
|
```bash
|
|
170
172
|
docker rmi pyloopsage-cuda
|
|
173
|
+
docker system prune -a
|
|
171
174
|
```
|
|
172
175
|
|
|
173
176
|
**Note:** Install `nvidia-container-toolkit` in your system if you want to use the container with CUDA: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
|
@@ -193,16 +196,21 @@ region, chrom = [15550000,16850000], 'chr6'
|
|
|
193
196
|
|
|
194
197
|
# Definition of data
|
|
195
198
|
output_name='../HiChIP_Annealing_T1_MD_region'
|
|
196
|
-
|
|
199
|
+
interaction_file = '/home/skorsak/Data/HiChIP/Maps/hg00731_smc1_maps_2.bedpe'
|
|
197
200
|
|
|
198
|
-
sim = lps.StochasticSimulation(region,chrom,
|
|
201
|
+
sim = lps.StochasticSimulation(region,chrom,interaction_file,out_dir=output_name,N_beads=1000)
|
|
199
202
|
Es, Ms, Ns, Bs, Ks, Fs, ufs = sim.run_energy_minimization(N_steps,MC_step,burnin,T,T_min,mode=mode,viz=True,save=True)
|
|
200
203
|
sim.run_EM('CUDA')
|
|
201
204
|
```
|
|
202
205
|
|
|
203
|
-
|
|
206
|
+
Behind the scenes, the class still walks through the same steps as before: it sets the main simulation parameters (`N_beads, N_coh, kappa, f, b`, or sensible defaults if you'd rather not specify them, though it's worth double-checking they suit your system), along with the Monte Carlo parameters (`N_steps, MC_step, burnin, T`), before initializing `LoopSage()`. Calling `sim.run_energy_minimization()` then launches the stochastic Monte Carlo simulation, which yields a set of cohesin constraints (`Ms, Ns`) — generated in one of two modes, `Annealing` or `Metropolis`. These constraints are passed on to the molecular simulation stage, where either `EM_LE()` or `MD_LE()` turns them into a trajectory of 3D structures and an average contact heatmap. `MD_LE()` goes a step further and produces an actual trajectory together with a `.dcd` video of the simulation evolving over time, though it's memory-hungry — a bond has to be defined at every timestep, which can make it impractical for larger systems. For those cases, `EM_LE()` is the better choice, since it achieves the same goal without the heavy memory footprint.
|
|
207
|
+
|
|
208
|
+
#### Input data
|
|
209
|
+
Firstly, we need to define the input files from which LoopSage would take the information to construct the potential. We define also the specific region that we would like to model. Therefore, in the code script above we define an `interaction_file` from which information about the CTCF loops or CTCF binding sites is imported. The format is auto-detected from the file extension, and three alternatives are supported: `.bedpe`, `.bed`, and `.narrowPeak`.
|
|
210
|
+
|
|
211
|
+
1. `.bedpe` (paired loop anchors)
|
|
204
212
|
|
|
205
|
-
|
|
213
|
+
This is the richest format, since each line already describes a candidate loop between two anchors. The `.bedpe` file must be in the following format:
|
|
206
214
|
|
|
207
215
|
```
|
|
208
216
|
chr1 903917 906857 chr1 937535 939471 16 3.2197903072213415e-05 0.9431392038374097
|
|
@@ -217,31 +225,45 @@ chr1 990949 994698 chr1 1001076 1003483 34 0.5386388489931403 0.9942742844900859
|
|
|
217
225
|
chr1 991375 993240 chr1 1062647 1064919 15 1.0 0.9997541297643132
|
|
218
226
|
```
|
|
219
227
|
|
|
220
|
-
where the last two columns represent the
|
|
228
|
+
where the last two columns represent the probabilities for the left and right anchor respectively to be tandem right. If the probability is negative it means that no CTCF motif was detected in this anchor.
|
|
221
229
|
|
|
230
|
+
*Alternativelly, it is possible to import a `.bedpe` file without the last two columns (CTCF orientation). In this case, CTCF would act as an orientation independent barrier. This might affect slightly the results, but it is an easier option, if you do not want to run a CTCF motif finding script.*
|
|
222
231
|
|
|
223
|
-
|
|
232
|
+
2. `.bed` (single CTCF sites, e.g. ChIP-seq intervals)
|
|
224
233
|
|
|
225
|
-
|
|
234
|
+
If you only have unpaired CTCF binding intervals rather than loop calls, you can pass a `.bed` file instead. LoopSage will still build orientation-aware `L`/`R` binding vectors from it, but since there is no anchor-pairing information in a `.bed` file, no loop-adjacency matrix (`J`) can be constructed - CTCF sites contribute individually rather than as loop anchors. Expected columns: `chrom, start, end, name, score, strand`, optionally followed by a probability column (probability the site's best motif hit is reverse-oriented) and an orientation call (`>`, `<`, or `.`).
|
|
235
|
+
|
|
236
|
+
3. `.narrowPeak` (single CTCF peaks, e.g. MACS2/HiChIP peaks)
|
|
237
|
+
|
|
238
|
+
Similarly, a `.narrowPeak` file of individual peaks can be used in place of a `.bedpe`/`.bed` file, with the same caveat: no `J` loop matrix is built, only `L`/`R`. Expected columns: `chrom, start, end, name, score`, optionally followed by a forward-orientation probability column and an orientation call.
|
|
239
|
+
|
|
240
|
+
#### Extracting CTCF motif orientation
|
|
241
|
+
|
|
242
|
+
To generate the orientation/probability columns for any of the three formats above (`.bedpe`, `.bed`, or `.narrowPeak`), use the motif-finding scripts from [BlackPianoCat/motif_finder](https://github.com/BlackPianoCat/motif_finder):
|
|
243
|
+
|
|
244
|
+
- `motif_finder_bedpe.py` for `.bedpe` loop files
|
|
245
|
+
- `bed_motif_finder.py` for `.bed` interval files
|
|
246
|
+
- `motif_finder_peaks.py` for `.narrowPeak` peak files
|
|
226
247
|
|
|
227
|
-
|
|
248
|
+
Run the appropriate script with `--prob` to get the probability columns shown above (e.g. `python motif_finder_bedpe.py -i loops.bedpe -g genome.fa -m CTCF.pfm -o loops_with_motif.bedpe --prob`). See that repo's README for full usage details on each script.
|
|
228
249
|
|
|
229
|
-
|
|
250
|
+
You also need to download the reference genome from: ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa
|
|
230
251
|
|
|
231
252
|
### Running LoopSage from command-line
|
|
232
|
-
|
|
253
|
+
|
|
254
|
+
Running LoopSage from the command line comes down to a single command.
|
|
233
255
|
|
|
234
256
|
```bash
|
|
235
257
|
loopsage -c config.ini
|
|
236
258
|
```
|
|
237
259
|
|
|
238
|
-
|
|
260
|
+
This command runs the model using the parameters specified in a `config.ini` file. Here's an example of what that file might look like:
|
|
239
261
|
|
|
240
262
|
```txt
|
|
241
263
|
[Main]
|
|
242
264
|
|
|
243
265
|
; Input Data and Information
|
|
244
|
-
|
|
266
|
+
INTERACTION_FILE = /home/skorsak/Data/HiChIP/Maps/hg00731_smc1_maps_2.bedpe
|
|
245
267
|
REGION_START = 15550000
|
|
246
268
|
REGION_END = 16850000
|
|
247
269
|
CHROM = chr6
|
|
@@ -261,7 +283,7 @@ PLATFORM = CUDA
|
|
|
261
283
|
INITIAL_STRUCTURE_TYPE = rw
|
|
262
284
|
SIMULATION_TYPE = EM
|
|
263
285
|
TOLERANCE = 1.0
|
|
264
|
-
```
|
|
286
|
+
```
|
|
265
287
|
|
|
266
288
|
### Visualization with PyVista
|
|
267
289
|
|
|
@@ -319,39 +341,47 @@ An example, illustrated with Chimera software, simulated trajectory of structure
|
|
|
319
341
|
### Long-table of LoopSage arguments
|
|
320
342
|
|
|
321
343
|
#### General Settings
|
|
322
|
-
| Argument
|
|
323
|
-
|
|
324
|
-
| PLATFORM
|
|
325
|
-
| DEVICE
|
|
326
|
-
| OUT_PATH
|
|
327
|
-
| SAVE_MDT
|
|
344
|
+
| Argument | Description | Type | Default |
|
|
345
|
+
|---|---|---|---|
|
|
346
|
+
| PLATFORM | Simulation platform: CPU, CUDA, or OpenCL | str | CPU |
|
|
347
|
+
| DEVICE | CUDA/OpenCL device index (from 0) | str | None |
|
|
348
|
+
| OUT_PATH | Output folder path | str | ../results |
|
|
349
|
+
| SAVE_MDT | Save simulation metadata | bool | True |
|
|
328
350
|
|
|
329
351
|
#### Input Data
|
|
330
|
-
| Argument
|
|
331
|
-
|
|
332
|
-
|
|
|
333
|
-
| LEF_TRACK_FILE
|
|
334
|
-
| BW_FILES
|
|
335
|
-
|
|
|
336
|
-
|
|
|
337
|
-
|
|
|
352
|
+
| Argument | Description | Type | Default |
|
|
353
|
+
|---|---|---|---|
|
|
354
|
+
| INTERACTION_FILE | Loop/peak file (.bedpe, .bed, or .narrowPeak). Required. | str | None |
|
|
355
|
+
| LEF_TRACK_FILE | bigWig track biasing LEF loading toward enriched regions | str | None |
|
|
356
|
+
| BW_FILES | bigWig file(s) acting as extrusion barriers | list | None |
|
|
357
|
+
| SMOOTHING_INPUT | Smooth noisy/sparse loop-peak signal before use | bool | False |
|
|
358
|
+
| COMP_BW_FILE | bigWig track for A/B compartment bias | str | None |
|
|
359
|
+
| COMP_BED_FILE | BED file for A/B compartment bias (alt. to COMP_BW_FILE) | str | None |
|
|
360
|
+
| DATA_LOSS_MODE | 0 = 1D binding potentials (L/R); 1 = 2D loss interpolated from input loops | int | 0 |
|
|
361
|
+
| CONTRASTIVE_BINDING | If True, penalizes loop-free regions so extrusion is confined within TADs; if False, extrusion is uniform everywhere | bool | False |
|
|
362
|
+
| REGION_START | Region start coordinate | int | None |
|
|
363
|
+
| REGION_END | Region end coordinate | int | None |
|
|
364
|
+
| CHROM | Chromosome of the modeled region | str | None |
|
|
365
|
+
| GENOME | Reference genome for chromosome sizes (e.g. hg38) | str | hg38 |
|
|
366
|
+
| FLOAT_LIST | Extra custom numeric settings | list | None |
|
|
367
|
+
| STRING_LIST | Extra custom text settings | list | None |
|
|
338
368
|
|
|
339
369
|
#### Stochastic Simulation Parameters
|
|
340
|
-
| Argument
|
|
341
|
-
|
|
342
|
-
| N_BEADS
|
|
343
|
-
| N_STEPS
|
|
344
|
-
| MC_STEP
|
|
345
|
-
| BURNIN
|
|
346
|
-
| T_INIT
|
|
347
|
-
| T_FINAL
|
|
348
|
-
| METHOD
|
|
349
|
-
| LEF_RW
|
|
350
|
-
| LEF_DRIFT
|
|
351
|
-
| N_LEF
|
|
352
|
-
| N_LEF2
|
|
353
|
-
| CROSS_LOOP
|
|
354
|
-
| BETWEEN_FAMILIES_PENALTY |
|
|
370
|
+
| Argument | Description | Type | Default |
|
|
371
|
+
|---|---|---|---|
|
|
372
|
+
| N_BEADS | Number of simulation beads | int | None |
|
|
373
|
+
| N_STEPS | Monte Carlo steps | int | 40000 |
|
|
374
|
+
| MC_STEP | Sampling frequency (reduces autocorrelation) | int | 200 |
|
|
375
|
+
| BURNIN | Steps discarded before equilibrium | int | 1000 |
|
|
376
|
+
| T_INIT | Initial temperature | float | 2.0 |
|
|
377
|
+
| T_FINAL | Final temperature | float | 1.0 |
|
|
378
|
+
| METHOD | 'Metropolis' or 'Annealing' | str | 'Annealing' |
|
|
379
|
+
| LEF_RW | Cohesins slide as random walk (vs. one direction) | bool | True |
|
|
380
|
+
| LEF_DRIFT | LEFs bounce back off each other | bool | False |
|
|
381
|
+
| N_LEF | Number of loop extrusion factors | int | None |
|
|
382
|
+
| N_LEF2 | Number of second-family LEFs | int | 0 |
|
|
383
|
+
| CROSS_LOOP | Penalize mi<mj<ni<nj crossings (vs. only mj=ni); pair with LEF_DRIFT if False | bool | True |
|
|
384
|
+
| BETWEEN_FAMILIES_PENALTY | Penalize crossings between LEF families | bool | True |
|
|
355
385
|
|
|
356
386
|
#### Energy Coefficients
|
|
357
387
|
| Argument Name | Description | Type | Default Value |
|
|
@@ -365,7 +395,6 @@ An example, illustrated with Chimera software, simulated trajectory of structure
|
|
|
365
395
|
#### Molecular Dynamics Simulation
|
|
366
396
|
| Argument Name | Description | Type | Default Value |
|
|
367
397
|
|------------------------|-----------------------------------------------------------------------------------------------------------------|------------|---------------------|
|
|
368
|
-
| SIMULATION_TYPE | Either EM (energy minimizations) or MD (molecular dynamics). | str | None |
|
|
369
398
|
| INITIAL_STRUCTURE_TYPE | Choose from: rw, confined_rw, self_avoiding_rw, helix, circle, spiral, sphere. | str | rw |
|
|
370
399
|
| INTEGRATOR_STEP | Step of the integrator. | Quantity | 100 femtosecond |
|
|
371
400
|
| FORCEFIELD_PATH | Path to XML file with forcefield. | str | default_xml_path |
|
|
@@ -379,7 +408,7 @@ An example, illustrated with Chimera software, simulated trajectory of structure
|
|
|
379
408
|
| FRICTION | Friction coefficient of the Langevin integrator. | float | 0.1 |
|
|
380
409
|
| TOLERANCE | Stopping condition for energy minimization. | float | 0.001 |
|
|
381
410
|
| SIM_TEMP | Temperature of the 3D simulation (EM or MD). | Quantity | 310 kelvin |
|
|
382
|
-
| SIM_STEP | Amount of simulation steps for loop force adjustments. | int |
|
|
411
|
+
| SIM_STEP | Amount of simulation steps for loop force adjustments. | int | 2000 |
|
|
383
412
|
|
|
384
413
|
#### Visualization
|
|
385
414
|
| Argument Name | Description | Type | Default Value |
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# pyLoopSage
|
|
2
2
|
Updated version of the stochastic loop extrusion model: LoopSage with capability to run incredibly fast, parallelized across CPU cores. This package is even more user-friendly and it can be installed via PyPI.
|
|
3
3
|
|
|
4
|
+

|
|
5
|
+
|
|
4
6
|
## New features
|
|
5
7
|
|
|
6
8
|
- More user-friendly environment.
|
|
@@ -33,7 +35,7 @@ $K(m_{i},n_{i};m_{j},n_{j})$ which takes the value 1 when $m_{i} < m_{j} < n_{i}
|
|
|
33
35
|
|
|
34
36
|
These $L(\cdot), R(\cdot)$ functions are two functions that define the binding potential and they are orientation specific - so they are different for left and right position of cohesin (because CTCF motifs are orientation specific), therefore when we have a gap in these functions, it means presence of CTCF. These two functions are derived from data with CTCF binning and by running the script for probabilistic orientation. Moreover, by $N_{(\cdot)}$ we symbolize the normalization constants for each factor,
|
|
35
37
|
|
|
36
|
-
$$c_{\text{fold}}=-\dfrac{N_{\text{beads}}f}{N_{\text{lef}}\log(N_{\text{beads}}/N_{\text{lef}})},\quad c_{\text{bind}}=-\dfrac{
|
|
38
|
+
$$c_{\text{fold}}=-\dfrac{N_{\text{beads}}f}{N_{\text{lef}}\log(N_{\text{beads}}/N_{\text{lef}})},\quad c_{\text{bind}}=-\dfrac{2N_{\text{beads}}b}{N_{CTCF}},\quad c_{\text{cross}}=\kappa \times 10^4.$$
|
|
37
39
|
|
|
38
40
|
The parameters are defined in such a way that when $f=b=\kappa=1$, the three terms of the stochastic energy are balanced. To clarrify, this parametrization is slightly different than this of the original paper. We multiply with $N_{\text{beads}}$, so as to keep the input parameters $f,b,\kappa$ simpler close to 1. Therefore, a value $f=0.1$ leads to unfolded structures, and a value $f=2$ it leads to very fast propagating long loops.
|
|
39
41
|
|
|
@@ -121,6 +123,7 @@ You do **not** need to manually stop or clean up anything—the container is tem
|
|
|
121
123
|
|
|
122
124
|
```bash
|
|
123
125
|
docker rmi pyloopsage-cuda
|
|
126
|
+
docker system prune -a
|
|
124
127
|
```
|
|
125
128
|
|
|
126
129
|
**Note:** Install `nvidia-container-toolkit` in your system if you want to use the container with CUDA: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
|
@@ -146,16 +149,21 @@ region, chrom = [15550000,16850000], 'chr6'
|
|
|
146
149
|
|
|
147
150
|
# Definition of data
|
|
148
151
|
output_name='../HiChIP_Annealing_T1_MD_region'
|
|
149
|
-
|
|
152
|
+
interaction_file = '/home/skorsak/Data/HiChIP/Maps/hg00731_smc1_maps_2.bedpe'
|
|
150
153
|
|
|
151
|
-
sim = lps.StochasticSimulation(region,chrom,
|
|
154
|
+
sim = lps.StochasticSimulation(region,chrom,interaction_file,out_dir=output_name,N_beads=1000)
|
|
152
155
|
Es, Ms, Ns, Bs, Ks, Fs, ufs = sim.run_energy_minimization(N_steps,MC_step,burnin,T,T_min,mode=mode,viz=True,save=True)
|
|
153
156
|
sim.run_EM('CUDA')
|
|
154
157
|
```
|
|
155
158
|
|
|
156
|
-
|
|
159
|
+
Behind the scenes, the class still walks through the same steps as before: it sets the main simulation parameters (`N_beads, N_coh, kappa, f, b`, or sensible defaults if you'd rather not specify them, though it's worth double-checking they suit your system), along with the Monte Carlo parameters (`N_steps, MC_step, burnin, T`), before initializing `LoopSage()`. Calling `sim.run_energy_minimization()` then launches the stochastic Monte Carlo simulation, which yields a set of cohesin constraints (`Ms, Ns`) — generated in one of two modes, `Annealing` or `Metropolis`. These constraints are passed on to the molecular simulation stage, where either `EM_LE()` or `MD_LE()` turns them into a trajectory of 3D structures and an average contact heatmap. `MD_LE()` goes a step further and produces an actual trajectory together with a `.dcd` video of the simulation evolving over time, though it's memory-hungry — a bond has to be defined at every timestep, which can make it impractical for larger systems. For those cases, `EM_LE()` is the better choice, since it achieves the same goal without the heavy memory footprint.
|
|
160
|
+
|
|
161
|
+
#### Input data
|
|
162
|
+
Firstly, we need to define the input files from which LoopSage would take the information to construct the potential. We define also the specific region that we would like to model. Therefore, in the code script above we define an `interaction_file` from which information about the CTCF loops or CTCF binding sites is imported. The format is auto-detected from the file extension, and three alternatives are supported: `.bedpe`, `.bed`, and `.narrowPeak`.
|
|
163
|
+
|
|
164
|
+
1. `.bedpe` (paired loop anchors)
|
|
157
165
|
|
|
158
|
-
|
|
166
|
+
This is the richest format, since each line already describes a candidate loop between two anchors. The `.bedpe` file must be in the following format:
|
|
159
167
|
|
|
160
168
|
```
|
|
161
169
|
chr1 903917 906857 chr1 937535 939471 16 3.2197903072213415e-05 0.9431392038374097
|
|
@@ -170,31 +178,45 @@ chr1 990949 994698 chr1 1001076 1003483 34 0.5386388489931403 0.9942742844900859
|
|
|
170
178
|
chr1 991375 993240 chr1 1062647 1064919 15 1.0 0.9997541297643132
|
|
171
179
|
```
|
|
172
180
|
|
|
173
|
-
where the last two columns represent the
|
|
181
|
+
where the last two columns represent the probabilities for the left and right anchor respectively to be tandem right. If the probability is negative it means that no CTCF motif was detected in this anchor.
|
|
174
182
|
|
|
183
|
+
*Alternativelly, it is possible to import a `.bedpe` file without the last two columns (CTCF orientation). In this case, CTCF would act as an orientation independent barrier. This might affect slightly the results, but it is an easier option, if you do not want to run a CTCF motif finding script.*
|
|
175
184
|
|
|
176
|
-
|
|
185
|
+
2. `.bed` (single CTCF sites, e.g. ChIP-seq intervals)
|
|
177
186
|
|
|
178
|
-
|
|
187
|
+
If you only have unpaired CTCF binding intervals rather than loop calls, you can pass a `.bed` file instead. LoopSage will still build orientation-aware `L`/`R` binding vectors from it, but since there is no anchor-pairing information in a `.bed` file, no loop-adjacency matrix (`J`) can be constructed - CTCF sites contribute individually rather than as loop anchors. Expected columns: `chrom, start, end, name, score, strand`, optionally followed by a probability column (probability the site's best motif hit is reverse-oriented) and an orientation call (`>`, `<`, or `.`).
|
|
188
|
+
|
|
189
|
+
3. `.narrowPeak` (single CTCF peaks, e.g. MACS2/HiChIP peaks)
|
|
190
|
+
|
|
191
|
+
Similarly, a `.narrowPeak` file of individual peaks can be used in place of a `.bedpe`/`.bed` file, with the same caveat: no `J` loop matrix is built, only `L`/`R`. Expected columns: `chrom, start, end, name, score`, optionally followed by a forward-orientation probability column and an orientation call.
|
|
192
|
+
|
|
193
|
+
#### Extracting CTCF motif orientation
|
|
194
|
+
|
|
195
|
+
To generate the orientation/probability columns for any of the three formats above (`.bedpe`, `.bed`, or `.narrowPeak`), use the motif-finding scripts from [BlackPianoCat/motif_finder](https://github.com/BlackPianoCat/motif_finder):
|
|
196
|
+
|
|
197
|
+
- `motif_finder_bedpe.py` for `.bedpe` loop files
|
|
198
|
+
- `bed_motif_finder.py` for `.bed` interval files
|
|
199
|
+
- `motif_finder_peaks.py` for `.narrowPeak` peak files
|
|
179
200
|
|
|
180
|
-
|
|
201
|
+
Run the appropriate script with `--prob` to get the probability columns shown above (e.g. `python motif_finder_bedpe.py -i loops.bedpe -g genome.fa -m CTCF.pfm -o loops_with_motif.bedpe --prob`). See that repo's README for full usage details on each script.
|
|
181
202
|
|
|
182
|
-
|
|
203
|
+
You also need to download the reference genome from: ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/GRCh38_reference_genome/GRCh38_full_analysis_set_plus_decoy_hla.fa
|
|
183
204
|
|
|
184
205
|
### Running LoopSage from command-line
|
|
185
|
-
|
|
206
|
+
|
|
207
|
+
Running LoopSage from the command line comes down to a single command.
|
|
186
208
|
|
|
187
209
|
```bash
|
|
188
210
|
loopsage -c config.ini
|
|
189
211
|
```
|
|
190
212
|
|
|
191
|
-
|
|
213
|
+
This command runs the model using the parameters specified in a `config.ini` file. Here's an example of what that file might look like:
|
|
192
214
|
|
|
193
215
|
```txt
|
|
194
216
|
[Main]
|
|
195
217
|
|
|
196
218
|
; Input Data and Information
|
|
197
|
-
|
|
219
|
+
INTERACTION_FILE = /home/skorsak/Data/HiChIP/Maps/hg00731_smc1_maps_2.bedpe
|
|
198
220
|
REGION_START = 15550000
|
|
199
221
|
REGION_END = 16850000
|
|
200
222
|
CHROM = chr6
|
|
@@ -214,7 +236,7 @@ PLATFORM = CUDA
|
|
|
214
236
|
INITIAL_STRUCTURE_TYPE = rw
|
|
215
237
|
SIMULATION_TYPE = EM
|
|
216
238
|
TOLERANCE = 1.0
|
|
217
|
-
```
|
|
239
|
+
```
|
|
218
240
|
|
|
219
241
|
### Visualization with PyVista
|
|
220
242
|
|
|
@@ -272,39 +294,47 @@ An example, illustrated with Chimera software, simulated trajectory of structure
|
|
|
272
294
|
### Long-table of LoopSage arguments
|
|
273
295
|
|
|
274
296
|
#### General Settings
|
|
275
|
-
| Argument
|
|
276
|
-
|
|
277
|
-
| PLATFORM
|
|
278
|
-
| DEVICE
|
|
279
|
-
| OUT_PATH
|
|
280
|
-
| SAVE_MDT
|
|
297
|
+
| Argument | Description | Type | Default |
|
|
298
|
+
|---|---|---|---|
|
|
299
|
+
| PLATFORM | Simulation platform: CPU, CUDA, or OpenCL | str | CPU |
|
|
300
|
+
| DEVICE | CUDA/OpenCL device index (from 0) | str | None |
|
|
301
|
+
| OUT_PATH | Output folder path | str | ../results |
|
|
302
|
+
| SAVE_MDT | Save simulation metadata | bool | True |
|
|
281
303
|
|
|
282
304
|
#### Input Data
|
|
283
|
-
| Argument
|
|
284
|
-
|
|
285
|
-
|
|
|
286
|
-
| LEF_TRACK_FILE
|
|
287
|
-
| BW_FILES
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
305
|
+
| Argument | Description | Type | Default |
|
|
306
|
+
|---|---|---|---|
|
|
307
|
+
| INTERACTION_FILE | Loop/peak file (.bedpe, .bed, or .narrowPeak). Required. | str | None |
|
|
308
|
+
| LEF_TRACK_FILE | bigWig track biasing LEF loading toward enriched regions | str | None |
|
|
309
|
+
| BW_FILES | bigWig file(s) acting as extrusion barriers | list | None |
|
|
310
|
+
| SMOOTHING_INPUT | Smooth noisy/sparse loop-peak signal before use | bool | False |
|
|
311
|
+
| COMP_BW_FILE | bigWig track for A/B compartment bias | str | None |
|
|
312
|
+
| COMP_BED_FILE | BED file for A/B compartment bias (alt. to COMP_BW_FILE) | str | None |
|
|
313
|
+
| DATA_LOSS_MODE | 0 = 1D binding potentials (L/R); 1 = 2D loss interpolated from input loops | int | 0 |
|
|
314
|
+
| CONTRASTIVE_BINDING | If True, penalizes loop-free regions so extrusion is confined within TADs; if False, extrusion is uniform everywhere | bool | False |
|
|
315
|
+
| REGION_START | Region start coordinate | int | None |
|
|
316
|
+
| REGION_END | Region end coordinate | int | None |
|
|
317
|
+
| CHROM | Chromosome of the modeled region | str | None |
|
|
318
|
+
| GENOME | Reference genome for chromosome sizes (e.g. hg38) | str | hg38 |
|
|
319
|
+
| FLOAT_LIST | Extra custom numeric settings | list | None |
|
|
320
|
+
| STRING_LIST | Extra custom text settings | list | None |
|
|
291
321
|
|
|
292
322
|
#### Stochastic Simulation Parameters
|
|
293
|
-
| Argument
|
|
294
|
-
|
|
295
|
-
| N_BEADS
|
|
296
|
-
| N_STEPS
|
|
297
|
-
| MC_STEP
|
|
298
|
-
| BURNIN
|
|
299
|
-
| T_INIT
|
|
300
|
-
| T_FINAL
|
|
301
|
-
| METHOD
|
|
302
|
-
| LEF_RW
|
|
303
|
-
| LEF_DRIFT
|
|
304
|
-
| N_LEF
|
|
305
|
-
| N_LEF2
|
|
306
|
-
| CROSS_LOOP
|
|
307
|
-
| BETWEEN_FAMILIES_PENALTY |
|
|
323
|
+
| Argument | Description | Type | Default |
|
|
324
|
+
|---|---|---|---|
|
|
325
|
+
| N_BEADS | Number of simulation beads | int | None |
|
|
326
|
+
| N_STEPS | Monte Carlo steps | int | 40000 |
|
|
327
|
+
| MC_STEP | Sampling frequency (reduces autocorrelation) | int | 200 |
|
|
328
|
+
| BURNIN | Steps discarded before equilibrium | int | 1000 |
|
|
329
|
+
| T_INIT | Initial temperature | float | 2.0 |
|
|
330
|
+
| T_FINAL | Final temperature | float | 1.0 |
|
|
331
|
+
| METHOD | 'Metropolis' or 'Annealing' | str | 'Annealing' |
|
|
332
|
+
| LEF_RW | Cohesins slide as random walk (vs. one direction) | bool | True |
|
|
333
|
+
| LEF_DRIFT | LEFs bounce back off each other | bool | False |
|
|
334
|
+
| N_LEF | Number of loop extrusion factors | int | None |
|
|
335
|
+
| N_LEF2 | Number of second-family LEFs | int | 0 |
|
|
336
|
+
| CROSS_LOOP | Penalize mi<mj<ni<nj crossings (vs. only mj=ni); pair with LEF_DRIFT if False | bool | True |
|
|
337
|
+
| BETWEEN_FAMILIES_PENALTY | Penalize crossings between LEF families | bool | True |
|
|
308
338
|
|
|
309
339
|
#### Energy Coefficients
|
|
310
340
|
| Argument Name | Description | Type | Default Value |
|
|
@@ -318,7 +348,6 @@ An example, illustrated with Chimera software, simulated trajectory of structure
|
|
|
318
348
|
#### Molecular Dynamics Simulation
|
|
319
349
|
| Argument Name | Description | Type | Default Value |
|
|
320
350
|
|------------------------|-----------------------------------------------------------------------------------------------------------------|------------|---------------------|
|
|
321
|
-
| SIMULATION_TYPE | Either EM (energy minimizations) or MD (molecular dynamics). | str | None |
|
|
322
351
|
| INITIAL_STRUCTURE_TYPE | Choose from: rw, confined_rw, self_avoiding_rw, helix, circle, spiral, sphere. | str | rw |
|
|
323
352
|
| INTEGRATOR_STEP | Step of the integrator. | Quantity | 100 femtosecond |
|
|
324
353
|
| FORCEFIELD_PATH | Path to XML file with forcefield. | str | default_xml_path |
|
|
@@ -332,7 +361,7 @@ An example, illustrated with Chimera software, simulated trajectory of structure
|
|
|
332
361
|
| FRICTION | Friction coefficient of the Langevin integrator. | float | 0.1 |
|
|
333
362
|
| TOLERANCE | Stopping condition for energy minimization. | float | 0.001 |
|
|
334
363
|
| SIM_TEMP | Temperature of the 3D simulation (EM or MD). | Quantity | 310 kelvin |
|
|
335
|
-
| SIM_STEP | Amount of simulation steps for loop force adjustments. | int |
|
|
364
|
+
| SIM_STEP | Amount of simulation steps for loop force adjustments. | int | 2000 |
|
|
336
365
|
|
|
337
366
|
#### Visualization
|
|
338
367
|
| Argument Name | Description | Type | Default Value |
|
|
@@ -7,6 +7,9 @@ import argparse
|
|
|
7
7
|
import openmm as mm
|
|
8
8
|
import importlib.resources
|
|
9
9
|
from openmm.unit import Quantity
|
|
10
|
+
from .logger import get_logger
|
|
11
|
+
|
|
12
|
+
log = get_logger(__name__)
|
|
10
13
|
|
|
11
14
|
# Dynamically set the default path to the XML file in the package
|
|
12
15
|
try:
|
|
@@ -166,12 +169,16 @@ args = ListOfArgs([
|
|
|
166
169
|
|
|
167
170
|
# Input data
|
|
168
171
|
Arg('N_BEADS', help="Number of Simulation Beads.", type=int, default='', val=''),
|
|
169
|
-
Arg('
|
|
172
|
+
Arg('INTERACTION_FILE', help="A .bedpe, .bed, or .narrowPeak file path with loops. It is required.", type=str, default='', val=''),
|
|
170
173
|
Arg('LEF_TRACK_FILE', help="An optional track file for cohesin or condensin in bw format. If this file is specified LEF preferentially binds were the signal is enriched.", type=str, default='', val=''),
|
|
171
174
|
Arg('BW_FILES', help="List of bigWig file paths for feature extraction.", type=list, nargs='+', default=[], val=[]),
|
|
175
|
+
Arg('SMOOTHING_INPUT',help="Determines if the input signal from peaks or anchros, will be smoothed.", type=bool, default='False', val='False'),
|
|
176
|
+
Arg('COMP_BW_FILE', help="A bw file for compartmentalization. ", type=str, default='', val=''),
|
|
177
|
+
Arg('COMP_BED_FILE', help="A bed file for compartmentalization. ", type=str, default='', val=''),
|
|
172
178
|
Arg('OUT_PATH', help="Output folder name.", type=str, default='../results', val='../results'),
|
|
173
179
|
Arg('REGION_START', help="Starting region coordinate.", type=int, default='', val=''),
|
|
174
180
|
Arg('REGION_END', help="Ending region coordinate.", type=int, default='', val=''),
|
|
181
|
+
Arg('GENOME',help='Reference genome assembly (e.g. "hg38" or "hg19"). Used to determine chromosome lengths and genomic coordinates.',type=str,default='hg38',val='hg38'),
|
|
175
182
|
Arg('CHROM', help="Chromosome that corresponds the the modelling region of interest (in case that you do not want to model the whole genome).", type=str, default='', val=''),
|
|
176
183
|
Arg('FLOAT_LIST', help="List of floating-point numbers.", type=list, nargs='+', default=[], val=[]),
|
|
177
184
|
Arg('STRING_LIST', help="List of strings.", type=list, nargs='+', default=[], val=[]),
|
|
@@ -179,6 +186,7 @@ args = ListOfArgs([
|
|
|
179
186
|
# Stochastic Simulation parameters
|
|
180
187
|
Arg('LEF_RW', help="True in case that you would like to make cohesins slide as random walk, instead of sliding only in one direction.", type=bool, default='True', val='True'),
|
|
181
188
|
Arg('LEF_DRIFT', help="True in case that LEFs are pushed back when they encounter other LEFs.", type=bool, default='False', val='False'),
|
|
189
|
+
Arg('VARIABLE_SLIDING_STEP', help="If True, the sliding step is uniformly sampled from [1, L_min] based on experimental loop lengths; if False, a fixed unit step is used.", type=bool, default="False", val='False'),
|
|
182
190
|
Arg('N_STEPS', help="Number of Monte Carlo steps.", type=int, default='40000', val='40000'),
|
|
183
191
|
Arg('N_LEF', help="Number of loop extrusion factors (condensins and cohesins). If you leave it empty it would add for LEFs twice the number of CTCFs.", type=int, default='', val=''),
|
|
184
192
|
Arg('N_LEF2', help="Number of second family loop extrusion factors, in case that you would like to simulate a second group with different speed.", type=int, default='0', val='0'),
|
|
@@ -190,9 +198,14 @@ args = ListOfArgs([
|
|
|
190
198
|
Arg('FOLDING_COEFF', help="Folding coefficient.", type=float, default='1.0', val='1.0'),
|
|
191
199
|
Arg('FOLDING_COEFF2', help="Folding coefficient for the second family of LEFs.", type=float, default='0.0', val='0.0'),
|
|
192
200
|
Arg('CROSS_COEFF', help="LEF crossing coefficient.", type=float, default='1.0', val='1.0'),
|
|
201
|
+
Arg('EPI_COEFF', help="Coefficient of Epigenetic Mark Spreading Model (experimental).", type=float, default='0.0', val='0.0'),
|
|
202
|
+
Arg('N_EPI_STATES', help="Number of epigenetic states in the Potts model (by default 3: -1,0,1)", type=int, default='3', val='3'),
|
|
203
|
+
Arg('P_SPIN', help="Probability that it would be proposed a node state move, instead of a LEF move.", type=float, default='0.5', val='0.5'),
|
|
193
204
|
Arg('BW_STRENGTHS', help="List of strengths of the energy (floats) corresponding to each BW file. This equivalent to the `r` parameter in the LoopSage paper.", type=list, nargs='+', default=[], val=[]),
|
|
194
205
|
Arg('CROSS_LOOP', help="It true if the penalty is applied for situations mi<mj<ni<nj and mi=nj, and false if it is applied only for mi=nj.", type=bool, default='True', val='True'),
|
|
195
206
|
Arg('BETWEEN_FAMILIES_PENALTY', help="Penalty for LEF2s that are crossing LEFs.", type=bool, default='True', val='True'),
|
|
207
|
+
Arg('DATA_LOSS_MODE', help="If it is 0 means 1D, and thus we use L and R potentuals. If it is equal to 1, then it uses a 2D loss function interpolated from the input loops.", type=int, default='0', val='0'),
|
|
208
|
+
Arg('CONTRASTIVE_BINDING', help="If it will be True, loop free regions in the heatmap would be penalized, and loop extrusion can occur only within TADs. Otherwise, if False loop extrusion is homogeneous.", type=bool, default='False', val='False'),
|
|
196
209
|
Arg('BIND_COEFF', help="CTCF binding coefficient.", type=float, default='1.0', val='1.0'),
|
|
197
210
|
Arg('SAVE_PLOTS', help="It should be true in case that you would like to save diagnostic plots. In case that you use small MC_STEP or large N_STEPS is better to mark it as False.", type=bool, default='True', val='True'),
|
|
198
211
|
Arg('SAVE_MDT', help="In case that you would liketo save metadata of the stochastic simulation.", type=bool, default='True', val='True'),
|
|
@@ -200,12 +213,12 @@ args = ListOfArgs([
|
|
|
200
213
|
|
|
201
214
|
# Molecular Dynamic Properties
|
|
202
215
|
Arg('INITIAL_STRUCTURE_TYPE', help="you can choose between: rw, confined_rw, self_avoiding_rw, helix, circle, spiral, sphere.", type=str, default='rw', val='rw'),
|
|
203
|
-
Arg('
|
|
204
|
-
Arg('INTEGRATOR_STEP', help="The step of the integrator.", type=Quantity, default='100 femtosecond', val='100 femtosecond'),
|
|
216
|
+
Arg('INTEGRATOR_STEP', help="The step of the integrator.", type=Quantity, default='`100 femtosecond', val='100 femtosecond'),
|
|
205
217
|
Arg('FORCEFIELD_PATH', help="Path to XML file with forcefield.", type=str, default=default_xml_path, val=default_xml_path),
|
|
206
|
-
Arg('ANGLE_FF_STRENGTH', help="Angle force strength.", type=float, default='
|
|
218
|
+
Arg('ANGLE_FF_STRENGTH', help="Angle force strength.", type=float, default='100.0', val='100.0'),
|
|
207
219
|
Arg('LE_FF_LENGTH', help="Equillibrium distance of loop forces.", type=float, default='0.1', val='0.1'),
|
|
208
|
-
Arg('LE_FF_STRENGTH', help="Interaction Strength of loop forces.", type=float, default='
|
|
220
|
+
Arg('LE_FF_STRENGTH', help="Interaction Strength of loop forces.", type=float, default='60000.0', val='60000.0'),
|
|
221
|
+
Arg('DO_COMPARTMENTS', help="True to enable block-copolymer force in 3D.", type=bool, default='False', val='False'),
|
|
209
222
|
Arg('CONTINUOUS_TOP', help="True if topoisomerase disables EV in a continuous region rather than a discrete set of points.", type=bool, default='False', val='False'),
|
|
210
223
|
Arg('EV_P', help="Probability that randomly excluded volume may be disabled.", type=float, default='0.0', val='0.0'),
|
|
211
224
|
Arg('EV_FF_STRENGTH', help="Excluded-volume strength.", type=float, default='100.0', val='100.0'),
|
|
@@ -214,5 +227,5 @@ args = ListOfArgs([
|
|
|
214
227
|
Arg('TOLERANCE', help="Tolerance that works as stopping condition for energy minimization.", type=float, default='0.001', val='0.001'),
|
|
215
228
|
Arg('VIZ_HEATS', help="Visualize the output average heatmap.", type=bool, default='True', val='True'),
|
|
216
229
|
Arg('SIM_TEMP', help="The temperature of the 3D simulation (EM or MD).", type=Quantity, default='310 kelvin', val='310 kelvin'),
|
|
217
|
-
Arg('SIM_STEP', help="This is the amount of simulation steps that are perform each time that we change the loop forces. If this number is too high, the simulation is slow, if is too low it may not have enough time to adapt the structure to the new constraints.", type=int, default='
|
|
230
|
+
Arg('SIM_STEP', help="This is the amount of simulation steps that are perform each time that we change the loop forces. If this number is too high, the simulation is slow, if is too low it may not have enough time to adapt the structure to the new constraints.", type=int, default='2000', val='2000'),
|
|
218
231
|
])
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
from tqdm import tqdm
|
|
3
|
+
from .logger import get_logger
|
|
4
|
+
|
|
5
|
+
log = get_logger(__name__)
|
|
3
6
|
|
|
4
7
|
def dist(p1: np.ndarray, p2: np.ndarray) -> float:
|
|
5
8
|
"""Mierzy dystans w przestrzeni R^3"""
|
|
@@ -117,21 +120,38 @@ def random_walk_structure(N_beads, step_size=1):
|
|
|
117
120
|
|
|
118
121
|
return V
|
|
119
122
|
|
|
120
|
-
def compute_init_struct(N_beads,mode='rw'):
|
|
123
|
+
def compute_init_struct(N_beads, mode='rw'):
|
|
124
|
+
log.info(f"Initializing polymer structure: mode='{mode}', N_beads={N_beads}")
|
|
125
|
+
|
|
121
126
|
match mode:
|
|
122
127
|
case 'rw':
|
|
128
|
+
log.debug("Using random walk initialization")
|
|
123
129
|
return random_walk_structure(N_beads)
|
|
130
|
+
|
|
124
131
|
case 'confined_rw':
|
|
132
|
+
log.debug("Using confined random walk initialization")
|
|
125
133
|
return confined_random_walk(N_beads)
|
|
134
|
+
|
|
126
135
|
case 'self_avoiding_rw':
|
|
136
|
+
log.debug("Using self-avoiding random walk initialization")
|
|
127
137
|
return self_avoiding_random_walk(N_beads)
|
|
138
|
+
|
|
128
139
|
case 'circle':
|
|
140
|
+
log.debug("Using circular polymer initialization")
|
|
129
141
|
return polymer_circle(N_beads)
|
|
142
|
+
|
|
130
143
|
case 'helix':
|
|
144
|
+
log.debug("Using helical polymer initialization")
|
|
131
145
|
return helix_structure(N_beads)
|
|
146
|
+
|
|
132
147
|
case 'spiral':
|
|
148
|
+
log.debug("Using spiral polymer initialization")
|
|
133
149
|
return spiral_structure(N_beads)
|
|
150
|
+
|
|
134
151
|
case 'sphere':
|
|
152
|
+
log.debug("Using spherical surface initialization")
|
|
135
153
|
return sphere_surface_structure(N_beads)
|
|
154
|
+
|
|
136
155
|
case _:
|
|
137
|
-
|
|
156
|
+
log.error(f"Invalid initialization mode: '{mode}'")
|
|
157
|
+
raise ValueError(f"Invalid option for initial structure: {mode}")
|