pycurves-dna 0.5.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 (64) hide show
  1. pycurves_dna-0.5.0/CHANGELOG.md +64 -0
  2. pycurves_dna-0.5.0/LICENSE +28 -0
  3. pycurves_dna-0.5.0/MANIFEST.in +2 -0
  4. pycurves_dna-0.5.0/PKG-INFO +464 -0
  5. pycurves_dna-0.5.0/README.md +414 -0
  6. pycurves_dna-0.5.0/pycurves.py +14 -0
  7. pycurves_dna-0.5.0/pycurves_dna.egg-info/PKG-INFO +464 -0
  8. pycurves_dna-0.5.0/pycurves_dna.egg-info/SOURCES.txt +62 -0
  9. pycurves_dna-0.5.0/pycurves_dna.egg-info/dependency_links.txt +1 -0
  10. pycurves_dna-0.5.0/pycurves_dna.egg-info/entry_points.txt +7 -0
  11. pycurves_dna-0.5.0/pycurves_dna.egg-info/requires.txt +24 -0
  12. pycurves_dna-0.5.0/pycurves_dna.egg-info/top_level.txt +7 -0
  13. pycurves_dna-0.5.0/pycurves_lib/__init__.py +5 -0
  14. pycurves_dna-0.5.0/pycurves_lib/cli/__init__.py +2 -0
  15. pycurves_dna-0.5.0/pycurves_lib/cli/pycurves_cli_options.py +49 -0
  16. pycurves_dna-0.5.0/pycurves_lib/cli/pycurves_cli_options_core.py +88 -0
  17. pycurves_dna-0.5.0/pycurves_lib/cli/pycurves_main.py +183 -0
  18. pycurves_dna-0.5.0/pycurves_lib/core/__init__.py +2 -0
  19. pycurves_dna-0.5.0/pycurves_lib/core/axis_support.py +56 -0
  20. pycurves_dna-0.5.0/pycurves_lib/core/curves_analyzer.py +1056 -0
  21. pycurves_dna-0.5.0/pycurves_lib/core/curves_calculator.py +1312 -0
  22. pycurves_dna-0.5.0/pycurves_lib/core/curves_dataclasses.py +866 -0
  23. pycurves_dna-0.5.0/pycurves_lib/core/curves_groove.py +886 -0
  24. pycurves_dna-0.5.0/pycurves_lib/core/curves_optimizer_jax.py +466 -0
  25. pycurves_dna-0.5.0/pycurves_lib/core/curvesplus_axis.py +316 -0
  26. pycurves_dna-0.5.0/pycurves_lib/core/parameter_conventions.py +1937 -0
  27. pycurves_dna-0.5.0/pycurves_lib/curves_wrapper.py +34 -0
  28. pycurves_dna-0.5.0/pycurves_lib/curves_wrapper_core.py +430 -0
  29. pycurves_dna-0.5.0/pycurves_lib/curves_wrapper_dssr.py +178 -0
  30. pycurves_dna-0.5.0/pycurves_lib/data/__init__.py +2 -0
  31. pycurves_dna-0.5.0/pycurves_lib/data/modified_bases.py +98 -0
  32. pycurves_dna-0.5.0/pycurves_lib/data/modified_to_change_data.json +1 -0
  33. pycurves_dna-0.5.0/pycurves_lib/data/reference/lw_exemplars.LICENSE.txt +7 -0
  34. pycurves_dna-0.5.0/pycurves_lib/data/reference/lw_exemplars.json +3317 -0
  35. pycurves_dna-0.5.0/pycurves_lib/data/reference/standard_b.lib +91 -0
  36. pycurves_dna-0.5.0/pycurves_lib/io/__init__.py +2 -0
  37. pycurves_dna-0.5.0/pycurves_lib/io/base_reference.py +467 -0
  38. pycurves_dna-0.5.0/pycurves_lib/io/curves_config_loader.py +457 -0
  39. pycurves_dna-0.5.0/pycurves_lib/io/curves_mol_loader.py +1823 -0
  40. pycurves_dna-0.5.0/pycurves_lib/io/curves_output.py +39 -0
  41. pycurves_dna-0.5.0/pycurves_lib/io/curves_output_core.py +983 -0
  42. pycurves_dna-0.5.0/pycurves_lib/io/curves_visualization_payload.py +473 -0
  43. pycurves_dna-0.5.0/pycurves_lib/io/dssr_json.py +391 -0
  44. pycurves_dna-0.5.0/pycurves_lib/md/__init__.py +2 -0
  45. pycurves_dna-0.5.0/pycurves_lib/md/batch_curvesplus.py +1869 -0
  46. pycurves_dna-0.5.0/pycurves_lib/md/batch_groove.py +1358 -0
  47. pycurves_dna-0.5.0/pycurves_lib/md/trajectory_cli.py +866 -0
  48. pycurves_dna-0.5.0/pycurves_lib/md/trajectory_loader.py +255 -0
  49. pycurves_dna-0.5.0/pycurves_lib/md/trajectory_statistics.py +494 -0
  50. pycurves_dna-0.5.0/pycurves_lib/topology/__init__.py +2 -0
  51. pycurves_dna-0.5.0/pycurves_lib/topology/base_annotations.py +1972 -0
  52. pycurves_dna-0.5.0/pycurves_lib/topology/dssr_topology.py +86 -0
  53. pycurves_dna-0.5.0/pycurves_lib/topology/dssr_topology_core.py +898 -0
  54. pycurves_dna-0.5.0/pycurves_lib/topology/dssr_topology_linear.py +16 -0
  55. pycurves_dna-0.5.0/pycurves_lib/topology/frame_annotations.py +246 -0
  56. pycurves_dna-0.5.0/pycurves_lib/topology/lw_exemplars.py +397 -0
  57. pycurves_dna-0.5.0/pycurves_lib/topology/topology_inferrer.py +2814 -0
  58. pycurves_dna-0.5.0/pycurves_md.py +205 -0
  59. pycurves_dna-0.5.0/pycurves_md_batch.py +455 -0
  60. pycurves_dna-0.5.0/pycurves_md_plot.py +733 -0
  61. pycurves_dna-0.5.0/pycurves_pymol.py +576 -0
  62. pycurves_dna-0.5.0/pycurves_viewer.py +1993 -0
  63. pycurves_dna-0.5.0/pyproject.toml +98 -0
  64. pycurves_dna-0.5.0/setup.cfg +4 -0
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ All notable changes to pyCurves are documented in this file. The format is
4
+ based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the
5
+ project uses [Semantic Versioning](https://semver.org/). While the version is
6
+ below 1.0, interfaces and output details may still change between minor
7
+ releases.
8
+
9
+ ## [0.5.0] - 2026-11-04
10
+
11
+ First packaged release, published on PyPI as `pycurves-dna` and on GitHub
12
+ Releases. The version number reflects the development work since the initial
13
+ upload in June 2026.
14
+
15
+ ### Static structure analysis (`pycurves`)
16
+
17
+ - PDB and mmCIF input (plain or gzipped) through gemmi, including handling of
18
+ alternate conformations and symmetry mates.
19
+ - Automatic DNA/RNA topology inference and Curves `.inp` generation
20
+ (`--generate-inp-only`).
21
+ - Global (Curves) and local (Curves+) helical axes, selected with
22
+ `--axis-convention global|local`.
23
+ - Base, base-pair and step parameters, groove measurements, backbone torsions
24
+ and curvature summaries, written as Curves-style text, JSON or CSV.
25
+ - Standard (Tsukuba) reference frames by default (`--frame-convention`).
26
+ - Support for three- and four-stranded DNA, with automatic multiplet inference.
27
+ - DSSR JSON as an alternative topology source, including multiplets.
28
+ - Non-canonical base-pair annotation with Leontis–Westhof (FR3D-based)
29
+ classification, and detection of left-handed / Z-DNA pairs.
30
+ - `--duplex-only` to restrict analysis to duplex regions.
31
+ - Experimental `--axis-weighting` option.
32
+
33
+ ### MD trajectories
34
+
35
+ - `pycurves-md`: per-frame and summary analysis of MD trajectories, with
36
+ multiprocessing (`--workers`), a Numba-accelerated groove mode, circular
37
+ statistics for angles and backbone conformer population summaries.
38
+ - `pycurves-md-batch`: vectorized Curves+ (local-axis, standard-frame) batch
39
+ engine with multiprocessing and fast msgspec JSON output.
40
+ - `pycurves-md-plot`: extract CSV tables and plots from trajectory JSON.
41
+
42
+ ### Visualization
43
+
44
+ - `pycurves-viewer`: interactive HTML viewer for pyCurves JSON output.
45
+ - `pycurves-pymol`: PyMOL `.pml` overlay from the JSON visualization payload.
46
+
47
+ ### Behavior changes to note when comparing with earlier development builds
48
+
49
+ - In standard mode, alpha and beta backbone torsions are now assigned
50
+ following the IUPAC definition.
51
+ - Missing values are reported as NaN instead of `999`.
52
+ - The axis convention values are now named `local` and `global`.
53
+ - The `--no-annotation` option and the `[syn]` annotation tag were removed.
54
+
55
+ ### Packaging and documentation
56
+
57
+ - All commands accept `--version`. The version is defined once, in
58
+ `pycurves_lib.__version__`.
59
+ - PyPI metadata: BSD-3-Clause license, classifiers and project URLs.
60
+ - Release workflow that builds, checks and publishes the package from a
61
+ version tag.
62
+ - Sphinx documentation site published on GitHub Pages.
63
+
64
+ [0.5.0]: https://github.com/JinsenLi/pyCurves/releases/tag/v0.5.0
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, JinsenLi
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,2 @@
1
+ include CHANGELOG.md
2
+ prune tests
@@ -0,0 +1,464 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycurves-dna
3
+ Version: 0.5.0
4
+ Summary: Python implementation and extension of Curves-style DNA/RNA helical analysis.
5
+ Author: pyCurves contributors
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/JinsenLi/pyCurves
8
+ Project-URL: Documentation, https://jinsenli.github.io/pyCurves/
9
+ Project-URL: Repository, https://github.com/JinsenLi/pyCurves
10
+ Project-URL: Issues, https://github.com/JinsenLi/pyCurves/issues
11
+ Project-URL: Changelog, https://github.com/JinsenLi/pyCurves/blob/main/CHANGELOG.md
12
+ Keywords: DNA,RNA,helical parameters,Curves,Curves+,3DNA
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
23
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ License-File: pycurves_lib/data/reference/lw_exemplars.LICENSE.txt
28
+ Requires-Dist: gemmi>=0.6
29
+ Requires-Dist: jax>=0.4
30
+ Requires-Dist: networkx>=3.0
31
+ Requires-Dist: numpy>=1.24
32
+ Requires-Dist: pandas>=2.0
33
+ Requires-Dist: scipy>=1.10
34
+ Requires-Dist: tqdm>=4.65
35
+ Provides-Extra: all
36
+ Requires-Dist: MDAnalysis>=2.6; extra == "all"
37
+ Requires-Dist: mdtraj>=1.9; extra == "all"
38
+ Requires-Dist: numba>=0.59; extra == "all"
39
+ Requires-Dist: ijson>=3.2; extra == "all"
40
+ Requires-Dist: msgspec>=0.18; extra == "all"
41
+ Requires-Dist: matplotlib>=3.7; extra == "all"
42
+ Requires-Dist: python-dateutil>=2.8; extra == "all"
43
+ Provides-Extra: dev
44
+ Requires-Dist: build>=1.0; extra == "dev"
45
+ Requires-Dist: pytest>=8.0; extra == "dev"
46
+ Requires-Dist: twine>=5.0; extra == "dev"
47
+ Provides-Extra: docs
48
+ Requires-Dist: sphinx>=8; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ # pyCurves
52
+
53
+ pyCurves is a Python implementation and extension of Curves-style nucleic acid
54
+ helical analysis. It reads PDB/mmCIF structures, infers DNA/RNA topology, and
55
+ calculates global (Curves) or local (Curves+) helical axes, base/base-pair parameters, groove measurements,
56
+ backbone torsions, curvature summaries, and machine-readable tables.
57
+
58
+ This project is under active development. Interfaces and output details may
59
+ change before publication. If you use it before publication, please cite this
60
+ GitHub repository.
61
+
62
+ ## Installation
63
+
64
+ Use Python 3.10 or newer. Python 3.12 is recommended.
65
+
66
+ pyCurves is published on PyPI as `pycurves-dna`:
67
+
68
+ ```bash
69
+ conda create -n pycurves python=3.12
70
+ conda activate pycurves
71
+
72
+ pip install pycurves-dna
73
+ ```
74
+
75
+ That is enough for static PDB/mmCIF analysis and `.inp` generation.
76
+
77
+ For trajectory readers, plotting, the batch MD path, and legacy
78
+ compatibility helpers, install the single full optional set:
79
+
80
+ ```bash
81
+ pip install "pycurves-dna[all]"
82
+ ```
83
+
84
+ To install the latest development version from source instead:
85
+
86
+ ```bash
87
+ git clone https://github.com/JinsenLi/pyCurves
88
+ cd pyCurves
89
+ pip install ".[all]"
90
+ ```
91
+
92
+ Check the installed version with `pycurves --version`. Release notes are in
93
+ [`CHANGELOG.md`](https://github.com/JinsenLi/pyCurves/blob/main/CHANGELOG.md).
94
+
95
+ CPU JAX is installed by default. On GPU clusters, install the matching JAX build
96
+ for your CUDA environment before installing pyCurves.
97
+
98
+ ## Quick Start
99
+
100
+ Run a structure directly to get Curves-like text output:
101
+
102
+ ```bash
103
+ pycurves test_data/1A1F_b_c.pdb
104
+ pycurves test_data/1A6Y.cif
105
+ ```
106
+
107
+ Write JSON or CSV tables:
108
+
109
+ ```bash
110
+ pycurves test_data/1A1F_b_c.pdb --format json --output-file 1a1f.json
111
+ pycurves test_data/1A1F_b_c.pdb --format csv --output-file 1a1f_tables
112
+ ```
113
+
114
+ Generate inferred Curves `.inp` files without running analysis:
115
+
116
+ ```bash
117
+ pycurves --generate-inp-only test_data/1OH6.cif test_data/1QNB.cif --output-dir inp
118
+ pycurves --inp-only "test_data/*.cif" --output-dir inp
119
+ ```
120
+
121
+ Analyze an existing Curves `.inp` file:
122
+
123
+ ```bash
124
+ pycurves your_input.inp --pdb your_structure.pdb
125
+ ```
126
+
127
+ ## Main Commands
128
+
129
+ ```bash
130
+ pycurves --help
131
+ pycurves-md --help
132
+ pycurves-md-batch --help
133
+ pycurves-md-plot --help
134
+ pycurves-viewer --help
135
+ ```
136
+
137
+ Most users start with `pycurves`. The MD, batch, plot, and viewer commands are
138
+ available when those workflows are needed.
139
+
140
+ ## What pyCurves Adds
141
+
142
+ - Gemmi-backed PDB/mmCIF loading with automatic topology inference for DNA/RNA
143
+ duplexes, triplexes, and quadruplexes.
144
+ - Global Curves 5.3-style curvilinear-axis minimization in JAX autograd.
145
+ - Tsukuba/Standard reference frame by default.
146
+ - Curves-like editable `.inp` input files.
147
+ - Non-canonical base pairs use contact-geometry reference frame.
148
+ - Curves-like text output, or JSON, and CSV outputs.
149
+ - Regular MD trajectory analysis and a superfast vectorized Curves+ batch path.
150
+ - Optional HTML viewer/pyMOL payload generation.
151
+ - ...
152
+
153
+ ## Important CLI Options
154
+
155
+ ```bash
156
+ pycurves [input.pdb|input.cif|input.inp] [options]
157
+ pycurves --generate-inp-only [structure ...] [options]
158
+ ```
159
+
160
+ Common options:
161
+
162
+ - `--format {curves,json,csv}`: choose Curves-style text, JSON, or CSV output.
163
+ - `--output-file PATH`: write output to a file or CSV prefix.
164
+ - `--altloc CODE`: retain blank/shared atoms plus the requested one-character
165
+ alternate-conformation code. If omitted, retain the first listed conformer.
166
+ - `--frame-convention standard|legacy`: use Curves+/3DNA-style standard
167
+ frames by default, or choose legacy Curves 5.3-compatible frames.
168
+ - `--axis-convention global|local`: choose the global Curves minimization axis
169
+ (the default) or the local Curves+ smooth-axis path.
170
+ - `--axis-weighting` / `--no-axis-weighting`: opt in to smoothly downweighting
171
+ requested pairs whose fitted Curves base origins separate by 4--8 A during
172
+ axis construction. The default is the unweighted axis.
173
+ - `--generate-inp-only` / `--inp-only`: infer `.inp` files and exit before
174
+ fitting, minimization, or parameter calculation.
175
+ - `--continuous-strands`: treat connected split-chain helices as one biological
176
+ helix when possible.
177
+ - `--duplex-only`: skip triplex and quadruplex inference and use one-to-one
178
+ duplex inference.
179
+ - `--visualization`: include geometry needed by `pycurves-viewer` in JSON.
180
+
181
+ ## Non-Canonical Pairing
182
+
183
+ pyCurves reports base-pair identity, interacting edges, and cis/trans
184
+ orientation separately from the geometry used for shape calculations. Canonical
185
+ Watson-Crick pairs keep the selected canonical frame convention; by default this
186
+ is the standard reference frame. Explicit `.inp` LW tags and
187
+ authoritative reference annotations may select non-canonical calculation
188
+ frames.
189
+
190
+ Generated `.inp` files can carry editable geometry tags such as `[cWW]`,
191
+ `[tWW]`, `[cWH]`, `[tWH]`, `[cWS]`, `[tSS]` or `[unresolved]`. Pair geometry in
192
+ `.inp` files is represented exclusively by explicit three-character LW tags.
193
+
194
+ The annotation report is part of the Curves text output, and annotation records
195
+ are always included in JSON/CSV results. Pair presence is `present`, `absent`,
196
+ or `uncertain`. `pairing_mode` uses controlled values: `watson_crick`,
197
+ `reverse_watson_crick`, `hoogsteen`, `reverse_hoogsteen`, `wobble`, or
198
+ `other_noncanonical`. A confident `tWW` observation is named
199
+ `reverse_watson_crick`. Uncertain calls
200
+ do not enter that field: for example, Section M renders
201
+ `candidate_mode=hoogsteen` with `classification_status=possible` as “possible
202
+ Hoogsteen.” Records keep `observed_lw_family` separate from
203
+ `reference_lw_family`, and retain diagnostic flags.
204
+
205
+ Coordinate-confirmed left-handed cWW pairs use
206
+ `helical_context="left_handed_cww"`. Other pairs use an empty string. This is
207
+ structural context for the pair; the internal normal-frame branch and sign are
208
+ not exposed in the slim report.
209
+
210
+ ## MD Trajectories
211
+
212
+ Install the full optional set first:
213
+
214
+ ```bash
215
+ pip install "pycurves-dna[all]"
216
+ ```
217
+
218
+ Run trajectory summaries:
219
+
220
+ ```bash
221
+ pycurves-md topology.pdb trajectory.xtc --mode summary --frames 1000:5000:10 --output-file dynamics.json
222
+ ```
223
+
224
+ To annotate transient pairing independently in every analyzed frame, use:
225
+
226
+ ```bash
227
+ pycurves-md topology.pdb trajectory.xtc --topology-mode annotate --mode both --output-file pairing_dynamics.json
228
+ ```
229
+
230
+ `--topology-mode reference` is the default and keeps the reference pair map.
231
+ `annotate` reruns coordinate-only pair detection after parameter calculation,
232
+ reports missing reference pairs as absent, and adds newly detected pairs with
233
+ `reference_pair=false`. The authoritative `base_pair_observations` table
234
+ contains pair presence, observed/reference LW family, named pairing mode,
235
+ classification status, helical context, and diagnostic flags. Calculation-frame, contact, and
236
+ glycosidic details remain internal rather than being repeated per pair. In
237
+ JSON, `frame` and `time` belong to the containing frame object; flattened CSV
238
+ rows include them as columns.
239
+
240
+ Axis weighting is independent of topology annotation: it never changes the
241
+ requested residue map or assigns a pairing family. It affects both global-axis optimization and Curves+ local smoothing; local base, base-pair,
242
+ step, and backbone parameters remain calculated from the fixed input topology.
243
+ Axis-dependent rows report `axis_weight`, and geometrically unsupported
244
+ base-pair-axis values are null.
245
+
246
+ Each per-frame `base_pair_observations` row contains exactly these keys:
247
+
248
+ | Key | What users should expect |
249
+ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
250
+ | `pair_id` | Stable pair identifier made from the two sorted molecular subunit IDs, for example `2:129`. |
251
+ | `reference_pair` | `true` for a pair from the reference map; `false` for a pair newly detected in this frame. |
252
+ | `level` | Curves reference level, or `null` for a newly detected pair that has no reference level. |
253
+ | `residue_1`, `residue_2` | Human-readable chain, residue name, and residue number, for example `B:DT2`. |
254
+ | `pair_status` | `present`, `absent`, or `uncertain` from current-frame coordinate evidence. |
255
+ | `pairing_mode` | Definitive named mode: `watson_crick`, `reverse_watson_crick`, `hoogsteen`, `reverse_hoogsteen`, `wobble`, or `other_noncanonical`; otherwise an empty string. |
256
+ | `observed_lw_family` | Confident current-frame LW family such as `cWW`, `tWW`, `cHW`, or `tWH`; otherwise an empty string. |
257
+ | `reference_lw_family` | LW family supplied by the reference/input topology; may be populated when `observed_lw_family` is empty. |
258
+ | `candidate_mode` | Tentative named mode when the evidence supports a possibility but not a definitive assignment; otherwise an empty string. |
259
+ | `classification_status` | `assigned`, `possible`, `unassigned`, or `conflict`. |
260
+ | `helical_context` | `left_handed_cww` when the pair belongs to a coordinate-confirmed left-handed cWW run; otherwise an empty string. |
261
+ | `diagnostic_flags` | Machine-readable reasons requiring review; normally an empty list. |
262
+
263
+ Empty `pairing_mode` and `observed_lw_family` values mean **unclassified**, not
264
+ noncanonical. For example, `pair_status="present"`,
265
+ `reference_lw_family="cWW"`, and `observed_lw_family=""` means that the
266
+ reference pair is present but the current coordinates did not support a
267
+ definitive observed LW assignment.
268
+
269
+ The separate `annotations` table does not repeat base-pair rows. A
270
+ `modified_base` row contains `annotation_type`, `severity`, `level`,
271
+ `location`, `code`, `message`, `residue`, and `parent_base`. A `backbone_link`
272
+ row contains `annotation_type`, `severity`, `level`, `location`, `code`,
273
+ `message`, `source_subunit`, `target_subunit`, `bond_source`, and `distance`.
274
+ The table is empty when neither event type occurs.
275
+
276
+ In `summary` mode `base_pair_observations` becomes a categorical state profile:
277
+ each row reports one pair/status/mode/LW/helical-context combination with
278
+ `frame_count` and `frame_fraction`. Identifiers and diagnostic fields are not
279
+ numerically averaged. The separate `annotations` table is reserved for modified-base and
280
+ backbone-connectivity events. This mode is currently implemented only in
281
+ `pycurves-md`, not `pycurves-md-batch`.
282
+
283
+ Summary tables report numeric columns as `*_mean` and `*_stddev`. Angular columns
284
+ use a circular mean and the resultant-length standard deviation
285
+ `sqrt(-2 log(R))`, where `R` is the mean resultant length, reported in degrees.
286
+
287
+ Store both per-frame rows and summary statistics:
288
+
289
+ ```bash
290
+ pycurves-md topology.pdb trajectory.dcd --mode both --format json --output-file dynamics_full.json
291
+ ```
292
+
293
+ Independent frames can run in separate processes. Because warm-starting and
294
+ axis-sign continuity depend on the preceding frame, disable both when using
295
+ more than one worker:
296
+
297
+ ```bash
298
+ pycurves-md topology.pdb trajectory.dcd --no-warm-start --no-axis-continuity --workers 2 --mode summary --output-file dynamics.json
299
+ ```
300
+
301
+ The default remains one worker and preserves the sequential trajectory
302
+ semantics. Benchmark the worker count for long trajectories; process startup
303
+ can outweigh the gain on short runs.
304
+
305
+ For canonical two-strand local-axis (Curves+)/standard-frame trajectories, the
306
+ vectorized batch path can be much faster:
307
+
308
+ ```bash
309
+ pycurves-md-batch topology.pdb trajectory.xtc --axis-convention local --frame-convention standard --batch-size 256 --workers 4 --mode summary --output-file dynamics_batch.json
310
+ ```
311
+
312
+ `--workers` processes independent coordinate batches concurrently while keeping
313
+ trajectory reading and output ordering in the parent process. The default is 1;
314
+ benchmark 2--4 workers for long trajectories because short runs, slow storage,
315
+ and already-parallel groove calculations may not benefit.
316
+
317
+ Use `pycurves-md` for global-axis minimization, non-canonical contact-geometry
318
+ frames, `--no-comb`, or `--ends`.
319
+
320
+ ## MD Analysis In Notebooks
321
+
322
+ For exploratory MD work, use the Python helpers directly instead of writing JSON
323
+ and calling `pycurves-md-plot`. Use `mode="per-frame"` or `mode="both"` when
324
+ you want to slice levels, strands, time windows, or individual parameters in a
325
+ notebook. `mode="summary"` is compact, but it does not keep per-frame rows.
326
+
327
+ ```python
328
+ from pycurves_md import analyze_trajectory
329
+ from pycurves_md_plot import (
330
+ add_time_axis,
331
+ extract_block,
332
+ extract_summary_block,
333
+ filter_rows,
334
+ parameter_timeseries,
335
+ pivot_parameter_matrix,
336
+ wrap_degrees,
337
+ )
338
+
339
+ payload = analyze_trajectory(
340
+ "topology.pdb",
341
+ "trajectory.xtc",
342
+ frames="1000:5000:10",
343
+ mode="both",
344
+ frame_convention="standard",
345
+ axis_convention="local",
346
+ )
347
+
348
+ # Long-form DataFrames from the in-memory payload.
349
+ steps = extract_block(payload, "step")
350
+ base_pairs = extract_block(payload, "base_pair")
351
+ grooves = extract_block(payload, "groove")
352
+
353
+ # Work on a subsection, then build custom plots/tables.
354
+ mid_steps = filter_rows(steps, level=range(5, 16), drop_terminal=1)
355
+ mid_steps = add_time_axis(mid_steps, time_scale=0.001, time_label="time (ns)")
356
+ mid_steps["twist"] = wrap_degrees(mid_steps["twist"])
357
+
358
+ twist_series = parameter_timeseries(
359
+ mid_steps,
360
+ "twist",
361
+ time_column="plot_time",
362
+ aggregate=True,
363
+ )
364
+ twist_heatmap = pivot_parameter_matrix(
365
+ mid_steps,
366
+ "twist",
367
+ index_column="plot_time",
368
+ column="level",
369
+ )
370
+
371
+ # Summary tables are available when mode="summary" or mode="both".
372
+ bp_summary = extract_summary_block(payload, "base_pair")
373
+ ```
374
+
375
+ For canonical two-strand standard-frame analyses, the vectorized batch path has
376
+ a matching notebook helper:
377
+
378
+ ```python
379
+ from pycurves_md_batch import analyze_trajectory_batch
380
+ from pycurves_md_plot import extract_block
381
+
382
+ payload = analyze_trajectory_batch(
383
+ "topology.pdb",
384
+ "trajectory.xtc",
385
+ frames="0:10000:10",
386
+ batch_size=256,
387
+ mode="per-frame",
388
+ )
389
+ steps = extract_block(payload, "step")
390
+ ```
391
+
392
+ Use `analyze_trajectory` rather than the batch helper when you need global-axis
393
+ minimization, non-canonical contact-geometry frames, `comb=False`, or terminal
394
+ end-level handling.
395
+
396
+ ## Plotting And Viewer
397
+
398
+ After `pip install "pycurves-dna[all]"`, plot MD JSON output:
399
+
400
+ ```bash
401
+ pycurves-md-plot dynamics.json --outdir md_plots
402
+ pycurves-md-plot dynamics.json --export-csv --no-plots --outdir raw_csvs
403
+ ```
404
+
405
+ Generate a self-contained HTML viewer from visualization JSON:
406
+
407
+ ```bash
408
+ pycurves structure.pdb --format json --visualization --output-file viewer.json
409
+ pycurves-viewer viewer.json --output viewer.html
410
+ ```
411
+
412
+ Generate a PyMOL inspection scene from the same visualization JSON:
413
+
414
+ ```bash
415
+ pycurves-pymol viewer.json --output viewer.pml
416
+ ```
417
+
418
+ Open the scene in PyMOL with `@viewer.pml`. The PML is a structure-free
419
+ overlay containing only the helical axis, backbone splines, base-pair color
420
+ blocks, and groove width connector lines. The PyMOL object panel exposes
421
+ individual axis points, backbone strands, base-pair blocks, and groove lines
422
+ under grouped dropdowns, so they can be toggled one by one. Load the source
423
+ PDB/mmCIF separately if you want to inspect coordinates underneath the
424
+ pyCurves geometry.
425
+
426
+ ## Python API
427
+
428
+ ```python
429
+ from pycurves_lib.curves_wrapper import CurvesWrapper
430
+
431
+ runner = CurvesWrapper.from_file("test_data/1A1F_b_c.pdb")
432
+ runner.analyze()
433
+ json_text = runner.output(fmt="json")
434
+ ```
435
+
436
+ Generate `.inp` files programmatically without analysis:
437
+
438
+ ```python
439
+ from pycurves_lib.curves_wrapper import CurvesWrapper
440
+
441
+ runner = CurvesWrapper(
442
+ pdbfile="test_data/1QNB.cif",
443
+ output_dir="inferred_inputs",
444
+ auto_generate_inp=False,
445
+ )
446
+ inp_files = runner.generate_inp(prefix="1QNB_auto")
447
+ ```
448
+
449
+ ## Output
450
+
451
+ JSON output uses the `pycurves-slim-v2` schema. It contains metadata plus flat
452
+ `dataframes` records for local/global parameters, backbone, groove, curvature,
453
+ and annotations. Gapped or uncomputed backbone positions are kept with `null`
454
+ values so sequence-indexed tables stay aligned; each row also reports `valid`,
455
+ `status`, `warnings`, and `missing_parameters`. Residue names and chain IDs are
456
+ stored separately. CSV output writes one file per dataframe using the
457
+ `--output-file` value as the prefix.
458
+
459
+ ## Code Guides
460
+
461
+ For a file-by-file map of the top-level commands, see
462
+ [`SCRIPT_REFERENCE.md`](https://github.com/JinsenLi/pyCurves/blob/main/SCRIPT_REFERENCE.md). Each Python package directory has
463
+ the same two-level documentation pattern: a short `README.md` and a detailed
464
+ `SCRIPT_REFERENCE.md`.