Skip to content

Cavitracer multimodel - #2282

Merged
karolamik13 merged 14 commits into
prody:mainfrom
briza81:cavitracer_multimodel
Sep 25, 2026
Merged

karolamik13 merged 14 commits into
prody:mainfrom
briza81:cavitracer_multimodel

Conversation

@briza81

@briza81 briza81 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Adds multi-model output to CaviTracer and lets the VMD, PyMOL and ChimeraX viewer scripts show it frame by frame.

New

  • mergeFramesPQR merges the per-frame PQR files of a multi-frame run into one multi-model PQR, one MODEL per frame. Frames that found nothing are kept as placeholders, so frames stay in step in every viewer. Chamber links can be merged too (links=True).
  • writeVmdMultiModelScript, writePyMolMultiModelScript and writeChimeraXMultiModelScript write a viewer script for a PQR on disk. The frames are stepped through with each program's own slider or state controls.

Changed

  • The VMD, PyMOL and ChimeraX scripts open both a single structure and a multi-model PQR.
  • All viewer scripts share one colour palette, so a channel has the same colour in every program.
  • writePyMolCaviTracerScript can write a PQR (output_format='pqr'); mmCIF stays the default.
  • ChimeraX scripts set the sphere radii with a single command, so large results load in seconds rather than minutes.
  • calcChannels and calcPoresFromChannels no longer write a PyMOL script automatically; the write*CaviTracerScript functions do that.
  • Pore files of multi-frame runs are numbered by the frame they come from.

Example

channels_all, surfaces_all = calcChannelsMultipleFrames(atoms, trajectory=dcd,
                                                        output_path='frames')  # an existing folder
mergeFramesPQR('frames', 'channels_frames.pqr', frames=range(len(channels_all)))
writeVmdMultiModelScript('channels_frames.pqr', atoms)

…meraX scripts take their colours from pregenerated high contrast palette, so a channel is the same colour in all three. VMD keeps ranks 0-29 in fixed colour IDs and later ranks in colour-scale IDs.
…esFromChannels automatically. A run writes its results only; the viewer scripts come from the dedicated write*CaviTracerScript functions supplying viewers for PyMOL, VMD, or ChimeraX
…phere. The PDB reader ChimeraX opens a PQR with keeps the radius as the B-factor, and size byattribute copies it across, where one size command per sphere took over a minute for thousands of spheres; combineSymAtoms false stops it merging spheres that lie close together.
…format='pqr' writes every object into one file, as the VMD and ChimeraX writers do, and vis_channels.py now splits such a file into one object per channel, named, coloured and grouped as from an mmCIF. The default stays mmCIF.
…ame run into one multi-model PQR, a MODEL block per frame numbered by the frame, with an optional stride.
…ltiModelScript writes one for a multimodel PQR on disk. The script decides what to show based on the file, so one structure opens as before and a multimodel PQR opens as a submodel per frame,browsable with a slider.
…iModelScript writes it for a PQR on disk. Each channel rank becomes one object with a state per frame, titled with the frame number; a PQR of one structure opens as before.
…ript writes one for a PQR on disk. The script reads the PQR itself, a molecule per MODEL, and VMD's animation slider shows one frame at a time; only the slider's molecule follows the animation, as a frame change made VMD rebuild the protein's surface every step. One structure opens as before.
…a coordinate set per model, rather than a submodel per model drawn on top of one another.
…r channels came from. calcChannelsMultipleFrames records the frame in each frame's details, and calcPoresFromChannelsMultipleFrames names the pore files by it, so a run started past frame 0 no longer numbers its pores from 0.
… all three can be called alike as (pqr_file, atoms, output_path).
…ame that found nothing gets a MODEL holding a radius-0 NIL placeholder, so frames stay in step in every viewer; frames= names the run's frames, so empty first and last frames are written too; links=True merges the links files. The stride option is removed.
@briza81

briza81 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@karolamik13 ready for your review.

@karolamik13
karolamik13 self-requested a review September 25, 2026 09:20

@karolamik13 karolamik13 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the code, and I would add one improvement for writePyMolMultiModelScript.

For VMD and ChimeraX, we need to specify the object type if we want to save something other than channels, but for writePyMolMultiModelScript, once we add the parameter 'object_type,' the code is crashing. To be consistent, I would add this parameter to match two other functions. It can be skipped inside the function. In VMD and ChimeraX, I wanted to use something other than VMD representation for surface cavities because they do not look nice. This is one reason we need to specify the object type in the function.

Also, the question is whether we like the visualization of surface cavities in PyMol. See below all three visualizations for channels and surface cavities (sorry for the different angles applied to the protein structure). Those are examples from the tutorial, so later I will add them there.

Image Image Image Image Image Image

@labbit-eu

Copy link
Copy Markdown

@karolamik13 I am on it. So, for surface cavities in pymol, we would like to have some surface too, right?

@karolamik13

Copy link
Copy Markdown
Contributor

@karolamik13 I am on it. So, for surface cavities in pymol, we would like to have some surface too, right?

If we want to have a similar visualization for all, then yes.

…ake the same object types as the VMD and ChimeraX ones. writePyMolCaviTracerScript writes cavities and connected results as PQR, writePyMolMultiModelScript accepts object_type, and the viewer tells a connected file's cavities from its channels by chain. The three writers now share one PQR writer.
@labbit-eu

Copy link
Copy Markdown

@karolamik13 should be working now, tested on a couple of structures

…ushed deeper even onto narrower tetra by start point optimization, which could even seal the cavity. Now the start point tetra is alway considered when selecting best available tetra within search distance.
@briza81
briza81 requested a review from karolamik13 September 25, 2026 13:38
@briza81

briza81 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

@karolamik13 the failed check seems to be unrelated to the work done here; not sure how that occurred.

@karolamik13 karolamik13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, it looks good. I tested the code on two systems, both channels and surface cavities.

@karolamik13
karolamik13 merged commit 25aea16 into prody:main Sep 25, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants