chemosim-lab / ProLIF

Interaction Fingerprints for protein-ligand complexes and more
https://prolif.readthedocs.io
Apache License 2.0
372 stars 71 forks source link

Excluding intramolecular interactions from fingerprint #220

Closed williambrown3 closed 1 month ago

williambrown3 commented 1 month ago

I have a system with many tripeptide fragments and many small rna fragments (3 nucleotides). When calculating the contacts between rna-rna and peptide-peptide, I believe that the intramolecular contacts are being counted and overcounting. I only want all contacts between different chains, how would I accomplish this?

cbouy commented 1 month ago

Hi @williambrown3,

Just to make sure I understood correctly, you mean you have for example:

rna = u.select_atoms("nucleic")
fp.run(u.trajectory, rna, rna)

and you want to exclude from the fingerprint contacts where the RNA fragments are the same? And same for peptide? Your only option would be to postprocess the results like so:

for ifp in fp.ifp.values():
    for res1, res2 in list(ifp):
        if res1 == res2:
            del ifp[(res1, res2)]

And then all the to_dataframe and plotting methods should not have the intramolecular contacts anymore.

Feel free to reopen the issue if I completely misunderstood or if you have further question!