Repository navigation
Channel clustering update - additional small changes to channel lining analysis and pymol visualization - #2286
MatthewLicht wants to merge 22 commits into
Conversation
…cavity_clusters merging to update with visualization changes
…added back later when they are complete
karolamik13
left a comment
There was a problem hiding this comment.
I tested the clustering functions using 20 frames from the caseStudy2 trajectory (247 channels). Everything worked well, and the PyMOL visualizations look reasonable.
I also noticed a few things in the code that might be worth improving:
-
In clusterChannels(), calc_stats=False seems to be ignored because ClusteringRecords always calls init_stats(). When calc_stats=True, the statistics may also be calculated twice.
-
In writeVoxelOccupancyPQR(), the default min_occupancy=0.0 includes voxels with zero occupancy. Perhaps occupancy > 0 should always be required to avoid writing empty voxels
[ indices = np.argwhere((occupancy > 0) & (occupancy >= min_occupancy)) ] -
There is a typo in the generated PyMOL script: "multipleand" should be "multiple and". The visualization worked after correcting it.
[ if (multiple and clustering_name is not None): ] -
In getObjectLiningInfo(), callbacks=None is the default, but the function calls callbacks.items() without checking for None. Perhaps a default callback could be assigned.
[
if callbacks is None:
callbacks = {'Residues': getLiningResidues}
] -
In getResidueOrientation(), the side-chain center is calculated as the average of atomic coordinates rather than the mass-weighted center of mass. The documentation should probably say geometric center. Also, residues without side chains (e.g., glycine) are excluded, which may make it difficult to match orientation values to residue indices. Returning NaN for these residues could help.
…mum occupancy 0.2 and raises an error if the minimum occupancy is not greater than 0;fixed multipleand typo;added default callback assignment in getObjectLiningInfo;updated documentation in getResidueOrientation
…ins (e.g. glycine)
e7ea241 to
2c41408
Compare
… into cluster_lining_update changes on remtoe branch not present in local
…prevent negative numbers from being passed, changed indices argument so that zero-occupancy voxels are not included, but if minimum occupancy is 0.0 then all voxels with any positive occupancy will be included
Also, I see that all checks are failing, but they are failing on a test for calcSignatureCavities or for an InSty function. I have not changed anything with InSty or calcSignatureCavities and am unsure what is causing the checks to fail. Please advise. |
karolamik13
left a comment
There was a problem hiding this comment.
Hi Matthew,
I looked through the changes and noticed a few issues that might explain some of the failing CI tests.
First, _infoAsListOfStrings() does not accept **kwargs, but both getSurfaceCavityResidueNames() and getChannelResidueNames() pass additional keyword arguments to it. For example, calcSignatureCavities() calls getSurfaceCavityResidueNames() with distA=4 and one_letter_aa=True, which may result in a TypeError because these arguments are forwarded to _infoAsListOfStrings(). Since they are already handled when calculating the residue information, I think removing **kwargs from the calls to _infoAsListOfStrings() might fix this.
I also noticed two other issues:
- In
_infoAsListOfStrings(), the loop handling multiple frames usesconf, but this variable is not defined. - In
getSurfaceCavityLiningInfo(), when a cavity has no tetrahedra, the code usesinfo[key][name] = [], butkeyis not defined.
I'm not sure whether they also explain the InSty failures, but it would be good to fix these issues first and rerun the tests to see if anything is left.
|
Hi Karolina, You are correct. I fixed the issues with _infoAsListOfStrings(), getSurfaceCavityLiningInfo() and related functions. Originally, I wrote getObjectLiningInfo and getSurfaceCavityLiningInfo to return info as a dictionary of dictionaries, with the keys indicating the channel/cavity index, but later changed it to a list of dictionaries. Some of the issues like info[key][name] = [] are caused I missed a few lines when making the change. All checks now pass. |
Adding the classes ClusterCalculator, ChannelRecord, Cluster, and ClusteringRecord and associated functions to channels.py for clustering analysis of channel objects
Includes:
Functions for calculating distances between channels
Building distance matrices
Clustering data based on the distance matrices
Subclustering of clustered data
Assigning noise to data in agglomerative clustering
Evaluating the Quality of Clustering
Changing how the objectLining functions work so that information besides residues can easily be obtained. Is also slightly faster.
Orientation of residues to channel objects can now be obtained.
Updates to the visualization of cavities with PyMol
Small changes to the Channel class that prevents a bug when using multiprocessing features (cubcic splines were not getting pickled and the channel objects were not getting sent to the workers)
Attached is a jupyter notebook demonstration of the clustering analysis using VMAT (caseStudy2) files which are using in the tutorial for the trajectory analysis.
ChannelClusteringDemoFinal.ipynb