volgrids 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. volgrids-0.1.0/LICENSE.md +22 -0
  2. volgrids-0.1.0/PKG-INFO +303 -0
  3. volgrids-0.1.0/README.md +276 -0
  4. volgrids-0.1.0/pyproject.toml +3 -0
  5. volgrids-0.1.0/setup.cfg +4 -0
  6. volgrids-0.1.0/setup.py +23 -0
  7. volgrids-0.1.0/volgrids/__init__.py +54 -0
  8. volgrids-0.1.0/volgrids/_core/__init__.py +0 -0
  9. volgrids-0.1.0/volgrids/_core/grid.py +148 -0
  10. volgrids-0.1.0/volgrids/_core/mol_system.py +137 -0
  11. volgrids-0.1.0/volgrids/_kernels/__init__.py +0 -0
  12. volgrids-0.1.0/volgrids/_kernels/boolean.py +41 -0
  13. volgrids-0.1.0/volgrids/_kernels/gaussian.py +40 -0
  14. volgrids-0.1.0/volgrids/_kernels/kernel.py +92 -0
  15. volgrids-0.1.0/volgrids/_misc/__init__.py +0 -0
  16. volgrids-0.1.0/volgrids/_misc/math.py +154 -0
  17. volgrids-0.1.0/volgrids/_misc/params_gaussian.py +42 -0
  18. volgrids-0.1.0/volgrids/_misc/timer.py +19 -0
  19. volgrids-0.1.0/volgrids/_misc/utils.py +17 -0
  20. volgrids-0.1.0/volgrids/_parsers/__init__.py +0 -0
  21. volgrids-0.1.0/volgrids/_parsers/grid_io.py +305 -0
  22. volgrids-0.1.0/volgrids/_parsers/parser_config.py +70 -0
  23. volgrids-0.1.0/volgrids/_parsers/parser_ini.py +92 -0
  24. volgrids-0.1.0/volgrids/_tables/ligand_example-explained.chem +79 -0
  25. volgrids-0.1.0/volgrids/_tables/ligand_example.chem +33 -0
  26. volgrids-0.1.0/volgrids/_tables/prot.chem +78 -0
  27. volgrids-0.1.0/volgrids/_tables/rna.chem +75 -0
  28. volgrids-0.1.0/volgrids/_ui/__init__.py +0 -0
  29. volgrids-0.1.0/volgrids/_ui/app.py +87 -0
  30. volgrids-0.1.0/volgrids/_ui/param_handler.py +190 -0
  31. volgrids-0.1.0/volgrids/smiffer/__init__.py +108 -0
  32. volgrids-0.1.0/volgrids/smiffer/_core/__init__.py +0 -0
  33. volgrids-0.1.0/volgrids/smiffer/_core/mol_system.py +80 -0
  34. volgrids-0.1.0/volgrids/smiffer/_core/trimmer.py +176 -0
  35. volgrids-0.1.0/volgrids/smiffer/_parsers/__init__.py +0 -0
  36. volgrids-0.1.0/volgrids/smiffer/_parsers/parser_chem_table.py +110 -0
  37. volgrids-0.1.0/volgrids/smiffer/_smifs/__init__.py +0 -0
  38. volgrids-0.1.0/volgrids/smiffer/_smifs/_hbonds/__init__.py +0 -0
  39. volgrids-0.1.0/volgrids/smiffer/_smifs/_hbonds/hb.py +61 -0
  40. volgrids-0.1.0/volgrids/smiffer/_smifs/_hbonds/hbaccepts.py +38 -0
  41. volgrids-0.1.0/volgrids/smiffer/_smifs/_hbonds/hbdonors.py +127 -0
  42. volgrids-0.1.0/volgrids/smiffer/_smifs/_hbonds/triplet.py +90 -0
  43. volgrids-0.1.0/volgrids/smiffer/_smifs/_hydro/__init__.py +0 -0
  44. volgrids-0.1.0/volgrids/smiffer/_smifs/_hydro/hydro.py +21 -0
  45. volgrids-0.1.0/volgrids/smiffer/_smifs/_hydro/hydrophilic.py +20 -0
  46. volgrids-0.1.0/volgrids/smiffer/_smifs/_hydro/hydrophobic.py +20 -0
  47. volgrids-0.1.0/volgrids/smiffer/_smifs/apbs.py +47 -0
  48. volgrids-0.1.0/volgrids/smiffer/_smifs/smif.py +13 -0
  49. volgrids-0.1.0/volgrids/smiffer/_smifs/stacking.py +47 -0
  50. volgrids-0.1.0/volgrids/smiffer/_ui/__init__.py +0 -0
  51. volgrids-0.1.0/volgrids/smiffer/_ui/app.py +138 -0
  52. volgrids-0.1.0/volgrids/smiffer/_ui/param_handler.py +79 -0
  53. volgrids-0.1.0/volgrids/veins/__init__.py +21 -0
  54. volgrids-0.1.0/volgrids/veins/_core/__init__.py +0 -0
  55. volgrids-0.1.0/volgrids/veins/_core/grid_ve.py +111 -0
  56. volgrids-0.1.0/volgrids/veins/_ui/__init__.py +0 -0
  57. volgrids-0.1.0/volgrids/veins/_ui/app.py +85 -0
  58. volgrids-0.1.0/volgrids/veins/_ui/param_handler.py +71 -0
  59. volgrids-0.1.0/volgrids/vgtools/__init__.py +46 -0
  60. volgrids-0.1.0/volgrids/vgtools/_core/__init__.py +0 -0
  61. volgrids-0.1.0/volgrids/vgtools/_core/operations.py +142 -0
  62. volgrids-0.1.0/volgrids/vgtools/_misc/__init__.py +0 -0
  63. volgrids-0.1.0/volgrids/vgtools/_misc/comparison_result.py +13 -0
  64. volgrids-0.1.0/volgrids/vgtools/_ui/__init__.py +0 -0
  65. volgrids-0.1.0/volgrids/vgtools/_ui/app.py +73 -0
  66. volgrids-0.1.0/volgrids/vgtools/_ui/param_handler.py +166 -0
  67. volgrids-0.1.0/volgrids.egg-info/PKG-INFO +303 -0
  68. volgrids-0.1.0/volgrids.egg-info/SOURCES.txt +68 -0
  69. volgrids-0.1.0/volgrids.egg-info/dependency_links.txt +1 -0
  70. volgrids-0.1.0/volgrids.egg-info/top_level.txt +1 -0
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2026 Diego Barquero Morera
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: volgrids
3
+ Version: 0.1.0
4
+ Summary: Framework for volumetric calculations, with emphasis in biological molecular systems.
5
+ Home-page: https://github.com/diegobarmor/volgrids
6
+ Author: DiegoBarMor
7
+ Author-email: diegobarmor42@gmail.com
8
+ License: MIT
9
+ Keywords: grid mif smif volumetric molecular structural biology interaction field
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE.md
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: classifier
19
+ Dynamic: description
20
+ Dynamic: description-content-type
21
+ Dynamic: home-page
22
+ Dynamic: keywords
23
+ Dynamic: license
24
+ Dynamic: license-file
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # Volumetric Grids (VolGrids)
29
+ This is a framework for volumetric calculations, with emphasis in biological molecular systems. Three tools are also provided: **SMIF Calculator** (`./smiffer.py`), **Volumetric Energy INSpector (VEINS)** (`./veins.py`) and **Volgrid Tools** (`./vgtools.py`). You can read more in their respective sections.
30
+
31
+ ## QuickStart
32
+ ```
33
+ pip install -r environment/requirements.txt
34
+ python3 smiffer.py --help
35
+ ```
36
+
37
+
38
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
39
+ <!-- -------------------------------- SETUP -------------------------------- -->
40
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
41
+ # Setup
42
+ ## Requirements
43
+ This framework only has 2 Python dependencies:
44
+ - **MDAnalysis** for parsing structure and trajectories data. Installing this should also install **NumPy**, also needed by volgrids.
45
+ - **h5py** for parsing CMAP files.
46
+
47
+
48
+ <!-- ----------------------------------------------------------------------- -->
49
+ ### Option 1: Setting up a Conda environment
50
+ #### Automatic
51
+ ```
52
+ conda env create -f environment/conda.yml
53
+ conda activate volgrids
54
+ ```
55
+
56
+ #### Manual
57
+ ```
58
+ conda create --name volgrids -y
59
+ conda activate volgrids
60
+ conda install python -y
61
+ conda install -c conda-forge mdanalysis -y
62
+ ```
63
+
64
+
65
+ <!-- ----------------------------------------------------------------------- -->
66
+ ### Option 2: Simple setup with PIP
67
+ #### Automatic
68
+ ```
69
+ pip install -r environment/requirements.txt
70
+ ```
71
+
72
+ #### Manual
73
+ ```
74
+ pip install mdanalysis h5py
75
+ ```
76
+
77
+
78
+ <!-- ----------------------------------------------------------------------- -->
79
+ ### APBS (optional)
80
+ ```
81
+ sudo apt-get install apbs
82
+ sudo apt install pdb2pqr
83
+ ```
84
+
85
+
86
+ <!-- ----------------------------------------------------------------------- -->
87
+ ## Usage
88
+ ### Without installing VolGrids
89
+ You can use the tools provided by VolGrids without installing it, by calling any of the scripts in the root directory of this repository (it doesn't have to be the current directory, you can call them from anywhere). Leave `[options...]` empty to read more about the available options.
90
+
91
+ - **SMIF Calculator:**
92
+ ```
93
+ python3 smiffer.py [options...]
94
+ ```
95
+
96
+ - **Volumetric Energy INSpector (VEINS):**
97
+ ```
98
+ python3 veins.py [options...]
99
+ ```
100
+
101
+ - **Volgrid Tools:**
102
+ ```
103
+ python3 vgtools.py [options...]
104
+ ```
105
+
106
+
107
+ <!-- ----------------------------------------------------------------------- -->
108
+ ### Using VolGrids as a package
109
+ You can install VolGrids as a package and import it from your own scripts. For installing with pip:
110
+ ```
111
+ # your current directory should be the root folder of this repository
112
+ pip install .
113
+ rm -rf build volgrids.egg-info # optional cleanup
114
+ ```
115
+
116
+
117
+ <!-- ----------------------------------------------------------------------- -->
118
+ ### Running the tests
119
+ Follow the instructions at the [test data repo](https://github.com/DiegoBarMor/volgrids-testdata).
120
+
121
+
122
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
123
+ <!-- ------------------------------- SMIFFER ------------------------------- -->
124
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
125
+ # Statistical Molecular Interaction Fields (SMIF) Calculator
126
+ This is a custom implementation of the [Statistical Molecular Interaction Fields (SMIF)](https://www.biorxiv.org/content/10.1101/2025.04.16.649117v1) method.
127
+
128
+ ## Usage
129
+ Run `python3 smiffer.py [mode] [path_structure] [options...]` and provide the parameters of the calculation via arguments:
130
+ - replace `[mode]` with `prot`, `rna` or `ligand` according to the structure of interest.
131
+ - replace `[path_structure]` with the path to the structure file (e.g. PDB). Mandatory positional argument.
132
+ - Optionally, replace `[options...]` with any combination of the following:
133
+ - `-o [folder_out]` where `[folder_out]` is the folder where the output SMIFs should be stored. if not provided, the parent folder of the input file will be used.
134
+ - `-t [path_traj]` where `[path_traj]` is the path to a trajectory file (e.g. XTC) supported by MDAnalysis. This activates "traj" mode, where SMIFs are calculated for all the frames of the trajectory and saved in a CMAP-series file.
135
+ - `-a [path_apbs]` where `[path_apbs]` is the path to the output of APBS. An *OpenDX* file is expected. This grid will be interpolated into the shape of the other grids.
136
+ - `-s [x] [y] [z] [r]` where `[x]`, `[y]`, `[z]` and `[r]` are the float values for the X,Y,Z coordinates and the radius of a sphere in space, respectively. This activates "pocket sphere" mode, where the SMIFs will only be calculated inside the sphere provided.
137
+ - `-b [path_table]` where `[path_table]` is the path to a *.chem* table file to use for ligand mode, or to override the default macromolecules' tables. This flag is mandatory for "ligand" mode.
138
+ - `-c [path_config]` where `[path_config]` is the path to a configuration file with global settings, to override the default settings (e.g. `config_volgrids.ini`).
139
+
140
+
141
+ <!-- ----------------------------------------------------------------------- -->
142
+ ## Commands examples
143
+ - Sample commands to obtain the electrostatic grids from [pdb2pqr](https://pdb2pqr.readthedocs.io/en/latest/) and [APBS](https://apbs.readthedocs.io/en/latest/)
144
+ ```
145
+ pdb2pqr --ff=AMBER testdata/smiffer/pdb-nosolv/1iqj.pdb testdata/smiffer/pqr/1iqj.pqr --apbs-input testdata/smiffer/1iqj.in
146
+ apbs testdata/smiffer/1iqj.in
147
+ ```
148
+
149
+ - Calculate SMIFs for a protein system (`prot`) considering only the space inside a pocket sphere (`-s`).
150
+ ```
151
+ python3 smiffer.py prot testdata/smiffer/pdb-nosolv/1iqj.pdb -s 4.682 21.475 7.161 14.675
152
+ ```
153
+
154
+ - Calculate SMIFs for a whole RNA system (`rna`) considering APBS data (`-a`).
155
+ ```
156
+ python3 smiffer.py rna testdata/smiffer/pdb-nosolv/5bjo.pdb -a testdata/smiffer/apbs/5bjo.pqr.dx
157
+ ```
158
+
159
+ - Calculate SMIFs for an RNA system (`rna`) along a trajectory (`-t`). Note that for "pocket sphere" mode, the same coordinates/radius are used for the whole trajectory.
160
+ ```
161
+ python3 smiffer.py rna testdata/smiffer/traj/7vki.pdb -t testdata/smiffer/traj/7vki.xtc
162
+ ```
163
+
164
+
165
+ <!-- ----------------------------------------------------------------------- -->
166
+ ## Visualization
167
+ ### Color standard
168
+ | Potential | Color | RGB 0-1 | RGB 0-255 | HEX |
169
+ |-----------------|------------|------------|------------|--------|
170
+ | APBS - | Red | 1,0,0 | 255,0,0 | FF0000 |
171
+ | APBS + | Blue | 0,0,1 | 0,0,255 | 0000FF |
172
+ | HB Acceptors | Violet | 0.7,0,1 | 179,0,255 | B300FF |
173
+ | HB Donors | Orange | 1,0.5,0 | 255,128,0 | FF8000 |
174
+ | Hydrophilic (-) | Light Blue | 0.3,0.85,1 | 77,217,255 | 4DD9FF |
175
+ | Hydrophobic (+) | Yellow | 1,1,0 | 255,255,0 | FFFF00 |
176
+ | Stacking | Green | 0,1,0 | 0,255,0 | 00FF00 |
177
+
178
+
179
+ ### MRC/CCP4 data in Chimera
180
+ Use this command when visualizing MRC/CCP4 data with negative values in Chimera (replace `1` with the actual number of the model).
181
+ ```
182
+ volume #1 capFaces false
183
+ ```
184
+
185
+
186
+ ### CMAP trajectories in Chimera
187
+ Follow these instructions to visualize the atomic and SMIF trajectories simultaneously in Chimera. ChimeraX is recommended.
188
+ 1) Open the PDB and load the atom trajectory into it (in ChimeraX, simply drag the files into the window).
189
+ 2) Open the CMAP file in a similar way.
190
+ 3) Start the playback by using this Chimera command. The numbers specified would change if dealing with multiple structures/cmaps. Examples:
191
+ ```
192
+ coordset #1; vseries play #2
193
+ coordset #1 pauseFrames 5; vseries play #2 pauseFrames 5
194
+ coordset #1 pauseFrames 5; vseries play #2 pauseFrames 5; vseries play #3 pauseFrames 5
195
+ ```
196
+ 4) Use this Chimera command to stop the playback. The ids used must match the previous command.
197
+ ```
198
+ coordset stop #1; vseries stop #2
199
+ ```
200
+
201
+
202
+ #### Smooth Trajectories
203
+ 1) Load the PDB and the trajectory files into it Chimera (in ChimeraX, simply drag the files into the window).
204
+ 2) Load the CMAP file in a similar way.
205
+ 3) (Optional) Load the `smooth_md.py` script (again, can be done by dragging it into ChimeraX).
206
+ 4) Start the playback by using this Chimera command. The numbers specified would change if dealing with multiple structures/cmaps. Examples:
207
+ ```
208
+ coordset #1 pauseFrames 10; vop morph #2 playStep 0.0005 frames 2000 modelId 3
209
+ coordset #1 pauseFrames 20; vop morph #2 playStep 0.00025 frames 4000 modelId 3
210
+ coordset #1 pauseFrames 20; vop morph #2 playStep 0.00025 frames 4000 modelId 4; vop morph #3 playStep 0.00025 frames 4000 modelId 5
211
+ ```
212
+ 4) Use this Chimera command to stop the playback. The ids used must match the previous command.
213
+ ```
214
+ coordset stop #1; vseries stop #2
215
+ ```
216
+ Note that this time, the morph can be paused manually with the slider button (is there a command equivalent?)
217
+
218
+ #### Other useful Chimera commands
219
+ ```
220
+ volume level 0.5
221
+ volume transparency 0.5
222
+ volume showOutlineBox true
223
+ ```
224
+
225
+
226
+
227
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
228
+ <!-- -------------------------------- VEINS -------------------------------- -->
229
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
230
+ # Volumetric Energy INSpector (VEINS)
231
+ This tool allows to visualize interaction energies in space by portraying them as a volumetric grid. Apart from the usual structure/trajectory files (PDB, XTC...), a CSV with energy values and the indices of the atoms/residues involved must be given. Interactions between 2, 3 and 4 particles are supported and represented accordingly
232
+
233
+ ## Usage
234
+ Run `python3 veins.py [mode] [path_structure] [path_csv] [options...]` and provide the parameters of the calculation via arguments:
235
+ - replace `[mode]` with `energies`.
236
+ - replace `[path_structure]` with the path to the structure file (e.g. PDB). Mandatory positional argument.
237
+ - replace `[path_csv]` with the path to the energies CSV file. Mandatory positional argument. It must contain the following rows:
238
+ - **kind**: Name of the interaction kind. All rows with the same *kind* will be used to calculate a single grid with its name.
239
+ - **npoints**: Number of particles involved in the interaction.
240
+ - **idxs**: Group of 0-based indices joined by `-`. These are the indices of the particles involved in the interaction. This group must contain *npoints* indices.
241
+ - **idxs_are_residues**: Whether the indices correspond to the molecule's residues (`true`) or atoms (`false`).
242
+ - **energy**: Value of the interaction's energy.
243
+ - Optionally, replace `[options...]` with any combination of the following:
244
+ - `-o [folder_out]` where `[folder_out]` is the folder where the output SMIFs should be stored. if not provided, the parent folder of the input file will be used.
245
+ `-c [cutoff]` where `[cutoff]` is a float number. Energies below this cutoff will be ignored. Default value: 1e-3.
246
+
247
+
248
+
249
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
250
+ <!-- ---------------------------- VOLGRID TOOLS ---------------------------- -->
251
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
252
+ # Volgrid Tools
253
+ Collection of utilities for manipulating DX, MRC, CCP4 and CMAP grids.
254
+
255
+ ## Usage
256
+ Run `python3 vgtools.py [mode] [options...]` and provide the parameters of the calculation via arguments.
257
+ - Replace `[mode]` with one of the following available modes:
258
+ - `convert`: Convert grid files between formats.
259
+ - `pack`: Pack multiple grid files into a single CMAP series-file.
260
+ - `unpack`: Unpack a CMAP series-file into multiple grid files.
261
+ - `fix_cmap`: Ensure that all grids in a CMAP series-file have the same resolution, interpolating them if necessary.
262
+ - `compare`: Compare two grid files by printing the number of differing points and their accumulated difference.
263
+ - `[options...]` will depend on the mode, check the respective help string for more information (run `python3 vgtools.py [mode] -h`).
264
+
265
+
266
+
267
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
268
+ <!-- --------------------------------- TODO -------------------------------- -->
269
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
270
+ # TODO
271
+ * improve help strings
272
+ * add annotations, docstrings and overall cleaning
273
+ * try out cavities-finder ideas
274
+
275
+ ## VGrids
276
+ * implement: raise an error if a format file is opened with the wrong function
277
+ * add tests for parameters being directly passed to the App classes (instead of parsing the CLI arguments)
278
+ * standard ini files use ; instead of # for comments
279
+
280
+ ## SMIFFER
281
+ * maybe: replace the RNDS trimming with a faster method
282
+ * change the ligand example to one that uses both NAMES_HBACCEPTORS, NAMES_HBDONORS and NAMES_HBD_FIXED
283
+ * document the .chem tables
284
+ * check if there's a bug in the peptide bond N of the test toy system peptide_no_h
285
+ * add safeguard when there's no atoms for the specified molecule type
286
+
287
+ ## VEINS
288
+ * finish/rework "energies" mode implementation
289
+ * implement "forces" mode
290
+ * move Grid's static fields into config_volgrids.ini
291
+ * add tests
292
+
293
+ ## VGTools
294
+ * check what happens if performing "fix_cmap" operation when cmap input and output are the same file
295
+ * implement the fixing operation directy on "packing", to ensure that packed frames have the same resolution (add flag to override this behavior)
296
+ * mode to describe grids
297
+ * mode to perform operations on grids: abs, sum, diff, mask...
298
+ * when editing a CMAP file (be it converting it or performing an operation on it), one should be able to specify the key of the relevant grid (instead of GridIO.read_auto arbitrarily deciding to take the first key it finds in the CMAP header)
299
+ * bypass the "large grid" warning when processing an existing large grid with VGTools.
300
+ * add tests for the "average" operation.
301
+
302
+
303
+ <!-- ----------------------------------------------------------------------- -->
@@ -0,0 +1,276 @@
1
+ # Volumetric Grids (VolGrids)
2
+ This is a framework for volumetric calculations, with emphasis in biological molecular systems. Three tools are also provided: **SMIF Calculator** (`./smiffer.py`), **Volumetric Energy INSpector (VEINS)** (`./veins.py`) and **Volgrid Tools** (`./vgtools.py`). You can read more in their respective sections.
3
+
4
+ ## QuickStart
5
+ ```
6
+ pip install -r environment/requirements.txt
7
+ python3 smiffer.py --help
8
+ ```
9
+
10
+
11
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
12
+ <!-- -------------------------------- SETUP -------------------------------- -->
13
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
14
+ # Setup
15
+ ## Requirements
16
+ This framework only has 2 Python dependencies:
17
+ - **MDAnalysis** for parsing structure and trajectories data. Installing this should also install **NumPy**, also needed by volgrids.
18
+ - **h5py** for parsing CMAP files.
19
+
20
+
21
+ <!-- ----------------------------------------------------------------------- -->
22
+ ### Option 1: Setting up a Conda environment
23
+ #### Automatic
24
+ ```
25
+ conda env create -f environment/conda.yml
26
+ conda activate volgrids
27
+ ```
28
+
29
+ #### Manual
30
+ ```
31
+ conda create --name volgrids -y
32
+ conda activate volgrids
33
+ conda install python -y
34
+ conda install -c conda-forge mdanalysis -y
35
+ ```
36
+
37
+
38
+ <!-- ----------------------------------------------------------------------- -->
39
+ ### Option 2: Simple setup with PIP
40
+ #### Automatic
41
+ ```
42
+ pip install -r environment/requirements.txt
43
+ ```
44
+
45
+ #### Manual
46
+ ```
47
+ pip install mdanalysis h5py
48
+ ```
49
+
50
+
51
+ <!-- ----------------------------------------------------------------------- -->
52
+ ### APBS (optional)
53
+ ```
54
+ sudo apt-get install apbs
55
+ sudo apt install pdb2pqr
56
+ ```
57
+
58
+
59
+ <!-- ----------------------------------------------------------------------- -->
60
+ ## Usage
61
+ ### Without installing VolGrids
62
+ You can use the tools provided by VolGrids without installing it, by calling any of the scripts in the root directory of this repository (it doesn't have to be the current directory, you can call them from anywhere). Leave `[options...]` empty to read more about the available options.
63
+
64
+ - **SMIF Calculator:**
65
+ ```
66
+ python3 smiffer.py [options...]
67
+ ```
68
+
69
+ - **Volumetric Energy INSpector (VEINS):**
70
+ ```
71
+ python3 veins.py [options...]
72
+ ```
73
+
74
+ - **Volgrid Tools:**
75
+ ```
76
+ python3 vgtools.py [options...]
77
+ ```
78
+
79
+
80
+ <!-- ----------------------------------------------------------------------- -->
81
+ ### Using VolGrids as a package
82
+ You can install VolGrids as a package and import it from your own scripts. For installing with pip:
83
+ ```
84
+ # your current directory should be the root folder of this repository
85
+ pip install .
86
+ rm -rf build volgrids.egg-info # optional cleanup
87
+ ```
88
+
89
+
90
+ <!-- ----------------------------------------------------------------------- -->
91
+ ### Running the tests
92
+ Follow the instructions at the [test data repo](https://github.com/DiegoBarMor/volgrids-testdata).
93
+
94
+
95
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
96
+ <!-- ------------------------------- SMIFFER ------------------------------- -->
97
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
98
+ # Statistical Molecular Interaction Fields (SMIF) Calculator
99
+ This is a custom implementation of the [Statistical Molecular Interaction Fields (SMIF)](https://www.biorxiv.org/content/10.1101/2025.04.16.649117v1) method.
100
+
101
+ ## Usage
102
+ Run `python3 smiffer.py [mode] [path_structure] [options...]` and provide the parameters of the calculation via arguments:
103
+ - replace `[mode]` with `prot`, `rna` or `ligand` according to the structure of interest.
104
+ - replace `[path_structure]` with the path to the structure file (e.g. PDB). Mandatory positional argument.
105
+ - Optionally, replace `[options...]` with any combination of the following:
106
+ - `-o [folder_out]` where `[folder_out]` is the folder where the output SMIFs should be stored. if not provided, the parent folder of the input file will be used.
107
+ - `-t [path_traj]` where `[path_traj]` is the path to a trajectory file (e.g. XTC) supported by MDAnalysis. This activates "traj" mode, where SMIFs are calculated for all the frames of the trajectory and saved in a CMAP-series file.
108
+ - `-a [path_apbs]` where `[path_apbs]` is the path to the output of APBS. An *OpenDX* file is expected. This grid will be interpolated into the shape of the other grids.
109
+ - `-s [x] [y] [z] [r]` where `[x]`, `[y]`, `[z]` and `[r]` are the float values for the X,Y,Z coordinates and the radius of a sphere in space, respectively. This activates "pocket sphere" mode, where the SMIFs will only be calculated inside the sphere provided.
110
+ - `-b [path_table]` where `[path_table]` is the path to a *.chem* table file to use for ligand mode, or to override the default macromolecules' tables. This flag is mandatory for "ligand" mode.
111
+ - `-c [path_config]` where `[path_config]` is the path to a configuration file with global settings, to override the default settings (e.g. `config_volgrids.ini`).
112
+
113
+
114
+ <!-- ----------------------------------------------------------------------- -->
115
+ ## Commands examples
116
+ - Sample commands to obtain the electrostatic grids from [pdb2pqr](https://pdb2pqr.readthedocs.io/en/latest/) and [APBS](https://apbs.readthedocs.io/en/latest/)
117
+ ```
118
+ pdb2pqr --ff=AMBER testdata/smiffer/pdb-nosolv/1iqj.pdb testdata/smiffer/pqr/1iqj.pqr --apbs-input testdata/smiffer/1iqj.in
119
+ apbs testdata/smiffer/1iqj.in
120
+ ```
121
+
122
+ - Calculate SMIFs for a protein system (`prot`) considering only the space inside a pocket sphere (`-s`).
123
+ ```
124
+ python3 smiffer.py prot testdata/smiffer/pdb-nosolv/1iqj.pdb -s 4.682 21.475 7.161 14.675
125
+ ```
126
+
127
+ - Calculate SMIFs for a whole RNA system (`rna`) considering APBS data (`-a`).
128
+ ```
129
+ python3 smiffer.py rna testdata/smiffer/pdb-nosolv/5bjo.pdb -a testdata/smiffer/apbs/5bjo.pqr.dx
130
+ ```
131
+
132
+ - Calculate SMIFs for an RNA system (`rna`) along a trajectory (`-t`). Note that for "pocket sphere" mode, the same coordinates/radius are used for the whole trajectory.
133
+ ```
134
+ python3 smiffer.py rna testdata/smiffer/traj/7vki.pdb -t testdata/smiffer/traj/7vki.xtc
135
+ ```
136
+
137
+
138
+ <!-- ----------------------------------------------------------------------- -->
139
+ ## Visualization
140
+ ### Color standard
141
+ | Potential | Color | RGB 0-1 | RGB 0-255 | HEX |
142
+ |-----------------|------------|------------|------------|--------|
143
+ | APBS - | Red | 1,0,0 | 255,0,0 | FF0000 |
144
+ | APBS + | Blue | 0,0,1 | 0,0,255 | 0000FF |
145
+ | HB Acceptors | Violet | 0.7,0,1 | 179,0,255 | B300FF |
146
+ | HB Donors | Orange | 1,0.5,0 | 255,128,0 | FF8000 |
147
+ | Hydrophilic (-) | Light Blue | 0.3,0.85,1 | 77,217,255 | 4DD9FF |
148
+ | Hydrophobic (+) | Yellow | 1,1,0 | 255,255,0 | FFFF00 |
149
+ | Stacking | Green | 0,1,0 | 0,255,0 | 00FF00 |
150
+
151
+
152
+ ### MRC/CCP4 data in Chimera
153
+ Use this command when visualizing MRC/CCP4 data with negative values in Chimera (replace `1` with the actual number of the model).
154
+ ```
155
+ volume #1 capFaces false
156
+ ```
157
+
158
+
159
+ ### CMAP trajectories in Chimera
160
+ Follow these instructions to visualize the atomic and SMIF trajectories simultaneously in Chimera. ChimeraX is recommended.
161
+ 1) Open the PDB and load the atom trajectory into it (in ChimeraX, simply drag the files into the window).
162
+ 2) Open the CMAP file in a similar way.
163
+ 3) Start the playback by using this Chimera command. The numbers specified would change if dealing with multiple structures/cmaps. Examples:
164
+ ```
165
+ coordset #1; vseries play #2
166
+ coordset #1 pauseFrames 5; vseries play #2 pauseFrames 5
167
+ coordset #1 pauseFrames 5; vseries play #2 pauseFrames 5; vseries play #3 pauseFrames 5
168
+ ```
169
+ 4) Use this Chimera command to stop the playback. The ids used must match the previous command.
170
+ ```
171
+ coordset stop #1; vseries stop #2
172
+ ```
173
+
174
+
175
+ #### Smooth Trajectories
176
+ 1) Load the PDB and the trajectory files into it Chimera (in ChimeraX, simply drag the files into the window).
177
+ 2) Load the CMAP file in a similar way.
178
+ 3) (Optional) Load the `smooth_md.py` script (again, can be done by dragging it into ChimeraX).
179
+ 4) Start the playback by using this Chimera command. The numbers specified would change if dealing with multiple structures/cmaps. Examples:
180
+ ```
181
+ coordset #1 pauseFrames 10; vop morph #2 playStep 0.0005 frames 2000 modelId 3
182
+ coordset #1 pauseFrames 20; vop morph #2 playStep 0.00025 frames 4000 modelId 3
183
+ coordset #1 pauseFrames 20; vop morph #2 playStep 0.00025 frames 4000 modelId 4; vop morph #3 playStep 0.00025 frames 4000 modelId 5
184
+ ```
185
+ 4) Use this Chimera command to stop the playback. The ids used must match the previous command.
186
+ ```
187
+ coordset stop #1; vseries stop #2
188
+ ```
189
+ Note that this time, the morph can be paused manually with the slider button (is there a command equivalent?)
190
+
191
+ #### Other useful Chimera commands
192
+ ```
193
+ volume level 0.5
194
+ volume transparency 0.5
195
+ volume showOutlineBox true
196
+ ```
197
+
198
+
199
+
200
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
201
+ <!-- -------------------------------- VEINS -------------------------------- -->
202
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
203
+ # Volumetric Energy INSpector (VEINS)
204
+ This tool allows to visualize interaction energies in space by portraying them as a volumetric grid. Apart from the usual structure/trajectory files (PDB, XTC...), a CSV with energy values and the indices of the atoms/residues involved must be given. Interactions between 2, 3 and 4 particles are supported and represented accordingly
205
+
206
+ ## Usage
207
+ Run `python3 veins.py [mode] [path_structure] [path_csv] [options...]` and provide the parameters of the calculation via arguments:
208
+ - replace `[mode]` with `energies`.
209
+ - replace `[path_structure]` with the path to the structure file (e.g. PDB). Mandatory positional argument.
210
+ - replace `[path_csv]` with the path to the energies CSV file. Mandatory positional argument. It must contain the following rows:
211
+ - **kind**: Name of the interaction kind. All rows with the same *kind* will be used to calculate a single grid with its name.
212
+ - **npoints**: Number of particles involved in the interaction.
213
+ - **idxs**: Group of 0-based indices joined by `-`. These are the indices of the particles involved in the interaction. This group must contain *npoints* indices.
214
+ - **idxs_are_residues**: Whether the indices correspond to the molecule's residues (`true`) or atoms (`false`).
215
+ - **energy**: Value of the interaction's energy.
216
+ - Optionally, replace `[options...]` with any combination of the following:
217
+ - `-o [folder_out]` where `[folder_out]` is the folder where the output SMIFs should be stored. if not provided, the parent folder of the input file will be used.
218
+ `-c [cutoff]` where `[cutoff]` is a float number. Energies below this cutoff will be ignored. Default value: 1e-3.
219
+
220
+
221
+
222
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
223
+ <!-- ---------------------------- VOLGRID TOOLS ---------------------------- -->
224
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
225
+ # Volgrid Tools
226
+ Collection of utilities for manipulating DX, MRC, CCP4 and CMAP grids.
227
+
228
+ ## Usage
229
+ Run `python3 vgtools.py [mode] [options...]` and provide the parameters of the calculation via arguments.
230
+ - Replace `[mode]` with one of the following available modes:
231
+ - `convert`: Convert grid files between formats.
232
+ - `pack`: Pack multiple grid files into a single CMAP series-file.
233
+ - `unpack`: Unpack a CMAP series-file into multiple grid files.
234
+ - `fix_cmap`: Ensure that all grids in a CMAP series-file have the same resolution, interpolating them if necessary.
235
+ - `compare`: Compare two grid files by printing the number of differing points and their accumulated difference.
236
+ - `[options...]` will depend on the mode, check the respective help string for more information (run `python3 vgtools.py [mode] -h`).
237
+
238
+
239
+
240
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
241
+ <!-- --------------------------------- TODO -------------------------------- -->
242
+ <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
243
+ # TODO
244
+ * improve help strings
245
+ * add annotations, docstrings and overall cleaning
246
+ * try out cavities-finder ideas
247
+
248
+ ## VGrids
249
+ * implement: raise an error if a format file is opened with the wrong function
250
+ * add tests for parameters being directly passed to the App classes (instead of parsing the CLI arguments)
251
+ * standard ini files use ; instead of # for comments
252
+
253
+ ## SMIFFER
254
+ * maybe: replace the RNDS trimming with a faster method
255
+ * change the ligand example to one that uses both NAMES_HBACCEPTORS, NAMES_HBDONORS and NAMES_HBD_FIXED
256
+ * document the .chem tables
257
+ * check if there's a bug in the peptide bond N of the test toy system peptide_no_h
258
+ * add safeguard when there's no atoms for the specified molecule type
259
+
260
+ ## VEINS
261
+ * finish/rework "energies" mode implementation
262
+ * implement "forces" mode
263
+ * move Grid's static fields into config_volgrids.ini
264
+ * add tests
265
+
266
+ ## VGTools
267
+ * check what happens if performing "fix_cmap" operation when cmap input and output are the same file
268
+ * implement the fixing operation directy on "packing", to ensure that packed frames have the same resolution (add flag to override this behavior)
269
+ * mode to describe grids
270
+ * mode to perform operations on grids: abs, sum, diff, mask...
271
+ * when editing a CMAP file (be it converting it or performing an operation on it), one should be able to specify the key of the relevant grid (instead of GridIO.read_auto arbitrarily deciding to take the first key it finds in the CMAP header)
272
+ * bypass the "large grid" warning when processing an existing large grid with VGTools.
273
+ * add tests for the "average" operation.
274
+
275
+
276
+ <!-- ----------------------------------------------------------------------- -->
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,23 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="volgrids",
5
+ version="0.1.0",
6
+ description="Framework for volumetric calculations, with emphasis in biological molecular systems.",
7
+ keywords="grid mif smif volumetric molecular structural biology interaction field",
8
+ long_description=open("README.md").read(),
9
+ long_description_content_type="text/markdown",
10
+ author="DiegoBarMor",
11
+ author_email="diegobarmor42@gmail.com",
12
+ url="https://github.com/diegobarmor/volgrids",
13
+ license="MIT",
14
+ packages=find_packages(),
15
+ package_data={"volgrids": ["_tables/*"]},
16
+ install_requires=[],
17
+ classifiers=[
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ],
22
+ python_requires=">=3.10",
23
+ )