Skip to content

Commit

Permalink
[fix] calculate bfactor per residue instead of per atom
Browse files Browse the repository at this point in the history
  • Loading branch information
kierandidi committed Apr 21, 2024
1 parent b4bf164 commit 8f0a730
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion graphein/protein/tensor/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ def protein_to_pyg(
out.hetatms = [het_coords]

if store_bfactor:
out.bfactor = torch.from_numpy(df["b_factor"].values)
# group by residue_id and average b_factor per residue
residue_bfactors = df.groupby("residue_id")["b_factor"].mean()
out.bfactor = torch.from_numpy(residue_bfactors.values)

return out

Expand Down

0 comments on commit 8f0a730

Please sign in to comment.