volkamerlab / plipify

MIT License
14 stars 6 forks source link

Enable separation of backbone vs sidechain contacts #17

Open apayne97 opened 1 year ago

apayne97 commented 1 year ago

Hi PLIPify team!

I would like to be able to visualize backbone vs side chain contacts as they have different consequences for drug resistance and multi-target activity. It doesn't look like this is currently possible. Not sure what the best way to do this would be but it would be useful!

Cheers, Alex

jchodera commented 1 year ago

@apayne97 : It looks like the plip.exchange.BindingSiteReport class that plipify uses stores the PDB atom id field. For example, the information stored for hydrogen bonds includes the interaction properties DONORIDX and ACCEPTORIDX, which should correspond to the PDB atom ids. That information should end up accessible through the plipify Structure object via the object model once you get down to the specific Interaction object.

Here's one way we could extend plipify to be able to use this information:

After the interaction_dict is retrieved here, we could check if it represents a sidechain or backbone interaction and add another entry or two to the interaction_dict, such as BACKBONE_INTERACTION or SIDECHAIN_INTERACTION that can be True or False. We would just check if the donor or acceptor indices are a protein residue and in the backbone atom names list [N, H, CA, HA, C, O]. The Structure.to_dataframes() should automatically include these in the dataframes it generates as a result.

We would want to extend the table visualization to allow us to separate backbone and sidechain interactions. Currently, the interaction information is extracted for the table visualization by plipify in _prepare_tabledata, which currently just gathers the interaction type, which is then used to generate the table here. We'd need to modify these both to identify and render backbone vs sidechain interactions. We may want to make this a separate visualization method or have it something that can be enabled with a keyword argument so as not to permanently change the behavior.

We might be able to ask @t-kimber for help here, but I imagine we'll have to contribute the solution in a PR and get her to help us get it merged if it seems generally useful.

t-kimber commented 1 year ago

So sorry for getting back late on this! I wasn't involved in the plipify project, but I think that @jaimergp would be the best person to ask! He was the one who set up the whole pipeline 🎉

apayne97 commented 1 year ago

It looks like PLIP natively stores whether the interaction is with a sidechain or backbone atom for hydrogen bond interactions. The interaction_dict has a "SIDECHAIN" attribute for this. However, it doesn't have this for the other types of interactions.

I was hoping I'd be able to use the OpenBabel object in structure._pdbcomplex to get the atom type to compare to your backbone atom list. Unfortunately it doesn't look like it uses the standard atom types so this doesn't seem to be a fruitful direction. Maybe instead I can load the structure with a different program and identify the atom types differently that way. Here's an example of the atom types for Ser144 (indexed as 143 due to 0-indexing). image

jchodera commented 1 year ago

It looks like PLIP natively stores whether the interaction is with a sidechain or backbone atom for hydrogen bond interactions. The interaction_dict has a "SIDECHAIN" attribute for this. However, it doesn't have this for the other types of interactions.

Do we need this for other types of interactions? I'm not sure the other interactions are super relevant for backbones---just separating out backbone vs sidechain H-bonds may be sufficient for our purposes!

apayne97 commented 1 year ago

I was hoping you'd say that! In that case I think I can just add some code necessary to make the final report (the one that looks like this) image have additional categories for hbonds such that there are backbone and sidechain categories for each. I think to do that I will need to change some things in every step of the fingerprinting process since we have to accumulate counts for the new types differently. I might add a flag to the InteractionFingerprint class like split_sidechain_backbone_hbonds = True which would activate this all the way through.

apayne97 commented 1 year ago

Looks like this is working, I'll push to #18 shortly image

jaimergp commented 1 year ago

Ooops, missed this in the ocean of notifications. Looks like it's working now? Lmk if you need further hints!