Support atoms in showOccupancies#2246
Conversation
atoms in showOccupancies
There was a problem hiding this comment.
Test below. I took one of my files from Dali.
In [1]: from prody import *
...: import matplotlib.pyplot as plt
...:
...: dali = DaliRecord('dali_ens.txt', '4nre', 'A', localFile=True)
...: pdbs = dali.filter(cutoff_len=0.7, cutoff_rmsd=2.0, cutoff_Z=10)[:20]
...: structures = parsePDB(pdbs, subset='ca')
...: dali_ens = buildPDBEnsemble(structures, mapping=dali.getMappings())
...:
...: showOccupancies(dali_ens, normed=True, atoms=dali_ens.getAtoms())
...: plt.show()
...:
@> Obtained 1720 PDB chains from Dali for 4nreA.
@> 1611 PDBs have been filtered out from 1720 Dali hits (remaining: 109).
@> 20 PDBs were parsed in 0.95s.
@> Starting iterative superposition:
@> Step #1: RMSD difference = 2.4160e+01
@> Step #2: RMSD difference = 3.0334e-01
@> Step #3: RMSD difference = 1.2812e-01
@> Step #4: RMSD difference = 7.8682e-02
@> Step #5: RMSD difference = 4.8933e-02
@> Step #6: RMSD difference = 3.0505e-02
@> Step #7: RMSD difference = 1.9036e-02
@> Step #8: RMSD difference = 1.1886e-02
@> Step #9: RMSD difference = 7.4247e-03
@> Step #10: RMSD difference = 4.6391e-03
@> Step #11: RMSD difference = 2.8992e-03
@> Step #12: RMSD difference = 1.8121e-03
@> Step #13: RMSD difference = 1.1328e-03
@> Step #14: RMSD difference = 7.0817e-04
@> Step #15: RMSD difference = 4.4275e-04
@> Step #16: RMSD difference = 2.7683e-04
@> Step #17: RMSD difference = 1.7309e-04
@> Step #18: RMSD difference = 1.0823e-04
@> Step #19: RMSD difference = 6.7681e-05
@> Iterative superposition completed in 0.08s.
@> Final superposition to calculate transformations.
@> Superposition completed in 0.00 seconds.
@> Ensemble (20 conformations) were built in 0.82s.
The outcome:
|
Thanks, looks good. Can you confirm that the residue numbers start at around 0? |
Yes, resid is 2. With almost 700 residues, it is around 0 on the plot. |
|
Great. Can you try using ensemble select to confirm it changes please |
Sure: In [2]: dali_ens In [3]: dali_ens.getAtoms() In [4]: dali_ens.getDataLabels() In [5]: dali_ens.getAtoms().getResnums() In [6]: dali_ens.getAtoms().getResnums().min() In [7]: dali_ens.getAtoms().getResnums().max() |
|
I meant if you use select or setAtoms on the ensemble to start at 20 or 100 then do we see the x axis change so we can confirm that it is really numbering by atoms. It’s hard to know for sure when the atoms start from 2 |
|
However, if we put multiple chains then it doesn't know how to handle that, so this isn't what we want |
@copilot wrap through showAtomicLines instead |
Addressed in aff2a14. |
|
@copilot remove your new tests. We do not run unit tests on plotting functions and using PDBENSEMBLEA that only has 10 atoms with resnums 1 to 10 anyway doesn't help assess it anyway |


showOccupanciesacceptedatoms=in practice but forwarded it tomatplotlib, causing plotting to fail with an unexpected keyword argument error. It also did not use ensemble atoms by default, so occupancy plots could not align to residue numbering without manual workarounds.Behavior change
atomsinsideshowOccupanciesinstead of passing it through toplt.plotpdbensemble.getAtoms()whenatomsis not providedX-axis handling
atoms.getResnums()Atom indextoResidue numberfor atom-aware plotsValidation
Regression coverage
atoms=usageExample:
This now plots occupancies against residue numbers instead of passing
atomsthrough tomatplotlib.