CaviTracer: clearer parameter names, per-residue lining, and output-path fixes - #2263
Open
briza81 wants to merge 8 commits into
Open
CaviTracer: clearer parameter names, per-residue lining, and output-path fixes#2263briza81 wants to merge 8 commits into
briza81 wants to merge 8 commits into
Conversation
…nner_radius for ease of use
…e channels slithering on surface are clear artifacts, no need for switch that would enable thier production
they were move out of the calcChannels signature into **kwargs, listed in a CHANNELS_ADVANCED_OPTIONS table inside the function. They are settings a normal run never touches, and the signature is long enough already. Unknown keywords raise TypeError instead of being ignored, so a misspelled option is reported rather than silently falling back to its default. All these args options remain documented among the arguments, under a note that they are accepted as keywords only.
…er CA atom. Previously, since nucleic acids, ligands, cofactors and ions have no CA, they were dropped from the lining reports entirely, and a channel lined by no protein raised AttributeError (e.g. on ribosome). Residues now come from the hierarchical view. Water is excluded unless include_water=True,. one_letter_aa translates only amino acids and nucleotides. Labels carry the chain (ASP108:A) unless include_chain=False, without which a residue number is not an identifier in an oligomer. An object with no lining is reported as "channelN: None" rather than skipped.
…not its centre. Previously, distA was measured from the probe centre, but the probe is a sphere whose radius varies along the object, so the reach past the wall was distA - r: a second shell was collected where an object is narrow and the wall was missed entirely where it is wide. The criterion is now |v - x| <= r + distA, and distA defaults to 2.5, which keeps channel reports close to their previous size; the distance still runs to the atom centre, so a touching atom sits at about one van der Waals radius. Channel and pore radii come from the radius spline, which also removes repetitive analysis of PDB file with each channel, making it about five times faster. Cavity vertices carry no radius, so the inscribed radius is recomputed against the atoms the tessellation used (water excluded); hence a vertex cannot lie inside one of those atoms, so a negative radius is reported as a mismatch between the cavities and the atoms given, rather than clamped away. + Minor refactors.
…(), not str.replace() to avoid cases wehn separate channel/cavity files were named by filename.replace('.pqr','_chl0.pqr'), which rewrites every occurrence of the extension anywhere in the path. An output directory called run.pqr/ was renamed along with the file, so the write failed after the combined file had already been produced; a name carrying no extension matched neither replace, so every object overwrote the previous one and the combined file with it; and a name holding both extensions was numbered twice. The new _numberedPath() helper numbers the file's own name only and leaves the directories alone.
Contributor
Author
|
@karolamik13 as agreed today, minor modifications, some fixes etc, for your review. Bottleneck argument stays, as it could still have a role; just improved its description. From my side, I consider this a prototype of the (semi)-final version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Renamed parameters (breaking)
r1 → surf_radius, r2 → inner_radius throughout the code, WITHOUT ALIASES, so existing scripts passing r1=/r2= now raise TypeError.
2. Signature slimmed; advanced options are keyword-only
Six rarely-used arguments moved out of the calcChannels signature into **kwargs, defaulted from a CHANNELS_ADVANCED_OPTIONS table: restrict_channels_to_start_point, min_enclosure, max_peel_depth, edge_cost, weighted_cache, weighted_mouth_depth. Unknown keywords now raise TypeError instead of being silently ignored, so a misspelled option is reported rather than falling back to its default. All six remain documented.
3. truncate_at_surface removed — truncation is now unconditional
Channels that surface, run along the outside and re-enter are artifacts, so the switch that could produce them is gone. Surface tetrahedra are always absorbing, and similarity/route_tolerance (previously "only used when truncate_at_surface is True") now always apply.
4. Lining residues read per residue, not per CA atom
getObjectResidueNames / getSurfaceCavityResidueNames and their wrappers previously selected name CA, which dropped nucleic acids, ligands, cofactors and ions from every lining report and raised AttributeError when a channel was lined by no protein (e.g. a ribosome). Residues now come from the hierarchical view.
5. Lining distance measured from the object surface
The criterion is now |v − x| <= r + distA rather than distA from the probe centre, so the reach past the wall no longer varies with local probe width (previously it was distA − r: a second shell where the object is narrow, the wall missed entirely where it is wide). distA default changes 4 → 2.5, which keeps channel reports close to their previous size. Channel/pore radii come from the radius spline, which also removes the repeated PDB re-analysis per channel — roughly 5× faster. Cavity vertices carry no radius, so the inscribed radius is recomputed against the tessellation atoms (water excluded); a negative radius is reported as a mismatch between cavities and atoms rather than clamped.
6. Output file naming fixed
Per-object files were named by filename.replace('.pqr', '_chl0.pqr'), which rewrites the extension anywhere in the path. Three failure modes: an output directory named run.pqr/ was renamed along with the file (write fails after the combined file was already written); a name with no extension matched neither replace, so every object overwrote the previous one and the combined file; a name with both extensions was numbered twice. New _numberedPath() uses Path.with_name() and touches only the file's own name. Also fixes selectChannelBySelection, which split on _channel while the writer had long emitted _chl.
7. Smaller cleanups
VDW_RADII lifted to module level and getVdwRadii made a static method; shared _kdTree, _requireCoords, _sampleObjectSpheres, _channelRecords helpers replacing duplicated bodies; the dead try/except AttributeError around getCoords (unreachable — getCoords raises TypeError) removed from four entry points; an undefined forbidden NameError in scanChannelParameters's error path fixed;