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

Added surface_area.py #25

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/bept/analysis/surface_area.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from Bio.PDB import PDBParser
from Bio.PDB.SASA import ShrakeRupley

def get_residues_and_sasa(protein_file):
"""
Parameters
----------
protein_file : str
The pdb file path(without the .pdb)

Returns
-------
SASA : int
The solvent accessible surface area
"""
p = PDBParser(QUIET=1)
struct = p.get_structure(protein_file, protein_file + ".pdb")

sr = ShrakeRupley()
sr.compute(struct, level="S")

with open(protein_file + "_surface_resi.txt", "w+") as f:
for i in struct.get_residues():
f.write(i.get_resname(), i.id[1])

return round(struct.sasa, 6)