a-r-j / graphein

Protein Graph Library
https://graphein.ai/
MIT License
998 stars 125 forks source link

`graphein.protein.edges.distance.add_distance_threshold` should allow computing distance by "any to any" atomistic even with "residue" granularity set #342

Open kamurani opened 10 months ago

kamurani commented 10 months ago

I'm wondering if there's a way to create a graph using residue granularity (i.e. coords from the alpha-carbon; applying node features per in-sequence residue of the protein etc.) but use distance threshold edges (i.e. add_distance_threshold) that do NOT use the alpha-carbon coordinates only.

I would like to create an edge between nodes (residues) if ANY of their constituent atoms are within the threshold distance of eachother.

new_edge_funcs = {"edge_construction_functions": [
    partial(
    add_distance_threshold, long_interaction_threshold=LONG_INTERACTION_THRESHOLD, threshold=NODE_DISTANCE_THRESHOLD)
]}
config = ProteinGraphConfig(
    granularity="CA",
    **new_edge_funcs,
)
# Edge construction function relies on alpha carbon coordinates alone and won't create edges between certain nodes

Is there a clean way to do this?