Replies: 1 comment 1 reply
-
The current code for Contacts does not allow you to exclude neighbors and nearest neighbors. You could probably write your own version that does something like it. When you look at the source code's mdanalysis/package/MDAnalysis/analysis/contacts.py Lines 486 to 499 in 0582265 then you see that we calculate all distances with d = distance_array(self.grA.positions, self.grB.positions,
box=self._get_box(self._ts)) but then filter these distances with
import numpy as np
c = Contacts(...)
initial_contacts = c.initial_contacts[0] # depending on how you run Contacts, can contain more
mask = np.ones(initial_contacts.shape, dtype=bool)
# keep second, first, and main diagonal at True, set upper and lower triangles to False
mask = np.triu(mask, k=-2) * np.tril(mask, k=2)
# set contacts on 2nd, 1st, and main diagonal to False
initial_contacts[mask] = False
# and update the class before running analysis
c.initial_contacts[0] = initial_contacts
# run analysis
c.run() The above code will not just work — I only had a quick look at the source code and I think you can hack it using the ideas above. Perhaps the notes on native contact analysis are also useful. You could also rewrite the In any case, you'll have some coding to do in order to achieve what you want. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm working with MDAnalysis and have a question about 'native contact analysis'
I'm trying to get Q value (native contact value) of all heavy atoms.
I tried as follows:
It worked, but it took a long time to compute. Additionally it was hard to interpret the result.
I read the paper about Q value (https://doi.org/10.1073/pnas.1311599110) again, and found they compute only pairs of heavy atoms i and j belonging to residues θi and θj are in contact provided that |θi - θj| > 3
Is there a way to only count pairs of heavy atoms whose their residue number difference is larger than 3?
Any suggestion or advice would be appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions