Skip to content

PiStacking fails on intra-protein detection #305

@pbuslaev

Description

@pbuslaev

I considered using ProLIF to study intra-protein interactions. So I essentially provided identical ligand and protein selections for interaction calculation. My selection inluded TYR, so ProLIF started detection for PiStacking, but ligand and protein residues were identical, Thus, Direction calculation here failed.

I thought, that the easiest way to overcome the error is to intercept here:

        for lresid, lres in lig.residues.items():
            if residues is None:
                prot_residues = get_residues_near_ligand(
                    lres,
                    prot,
                    self.vicinity_cutoff,
                    use_segid=self.use_segid or False,
                )
            for prot_key in prot_residues:  # type:ignore[union-attr]
                pres = prot[prot_key]
                # Avoid processing residue with itself, since it is anyway useless
                if pres.resid == lres.resid:
                    continue
                key = (lresid, pres.resid)
                interactions = get_interactions(lres, pres)
                if any(interactions):
                    ifp[key] = interactions  # type: ignore[assignment]

I tested the solution locally and it worked fine. Let me know, if you are up for this change. I, then, can create MR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions