Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in PDB DataFrame (e.g. when using add_distance_threshold edges in construct_graph) #419

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

kamurani
Copy link
Contributor

fixes #418

Testing

uniprot_id = "P04629"

from functools import partial
from graphein.protein import construct_graph
from graphein.protein.config import ProteinGraphConfig
from graphein.protein.edges.distance import add_distance_threshold

threshold_distance = 6.0

new_edge_funcs = {"edge_construction_functions": [partial(add_distance_threshold, long_interaction_threshold=-1, threshold=threshold_distance)]}
config = ProteinGraphConfig(**new_edge_funcs)
g_dist_all = construct_graph(
    path = f"{uniprot_id}.pdb",
    config=config,
)

for edge in g_dist_all.edges(data=True):
    d = edge[-1]["distance"]
    assert d < threshold_distance

kamurani and others added 3 commits February 19, 2025 15:09
…tom to avoid ambiguous / unexpected indexing using `.loc`
… existing `.pdb` files don't fail the test (pre-fix)
@kamurani kamurani changed the title add reset_index in process_dataframe after sorting by chain,pos,a… Fix bug in PDB DataFrame (e.g. when using add_distance_threshold edges in construct_graph) Feb 19, 2025
@kamurani
Copy link
Contributor Author

@a-r-j

Added a 2nd graph construction test under protein.test_graphs.test_distance_edges (that actually checks the edges' distance values). Interestingly the test passes either way (i.e. without the rest_index fix) when you use the .pdb files that are already under test_data/, so I added the problematic structure that I was using when I first discovered the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG in construct_graph
2 participants