Skip to content

Instantly share code, notes, and snippets.

@mglerner
Created September 17, 2021 19:35
Show Gist options
  • Save mglerner/45bec83454211335b077e3f993d3f7d6 to your computer and use it in GitHub Desktop.
Save mglerner/45bec83454211335b077e3f993d3f7d6 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "7a47d5a0-1aa3-44b9-94ed-771a60e26c94",
"metadata": {},
"source": [
"Looks like it needs Biopython 1.79\n",
"\n",
"```\n",
"conda install -c conda-forge biopython \n",
"```\n",
"\n",
"Then, I don't know how to tell Biopython download structures from the web, so I downloaded 1lcd manually.\n",
"\n",
"Then, for SOME REASON, the biopython site doesn't use real quotes. So I couldn't just copy and paste without changing \"smart quotes\" into real quotes."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2ead59d6-bbe2-4ab2-97e3-1e59116f8cce",
"metadata": {},
"outputs": [],
"source": [
"from Bio.PDB import PDBParser"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4e1318a3-34ae-415f-8a7c-25e21a4ae5ef",
"metadata": {},
"outputs": [],
"source": [
"p = PDBParser(QUIET=1)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "9df61cca-1a34-496c-9745-1974283a31ee",
"metadata": {},
"outputs": [],
"source": [
"#struct = p.get_structure(\"1LCD\", \"PDB/1LCD.pdb\")\n",
"struct = p.get_structure(\"1LCD\", \"1lcd.pdb\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d168091c-8ebc-432a-8f8d-90143ba70292",
"metadata": {},
"outputs": [],
"source": [
"#Needed this line\n",
"from Bio.PDB import SASA"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "264c5dc8-da1f-4c8b-83f4-5b4a19222ab3",
"metadata": {},
"outputs": [],
"source": [
"#sr = ShrakeRupley()\n",
"sr = SASA.ShrakeRupley()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "8b337c70-a615-407f-b59d-f21ca9c06125",
"metadata": {},
"outputs": [],
"source": [
"sr.compute(struct, level=\"S\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "8798c32f-a4ad-4b0b-a01d-66ff2a70e229",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"7053.43\n"
]
}
],
"source": [
"print(round(struct.sasa, 2))\n",
"# expect 7053.43"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "2f06eab6-83b9-4766-9e61-12d0ba61ee9c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9.64\n"
]
}
],
"source": [
"print(round(struct[0][\"A\"][11][\"OE1\"].sasa, 2))\n",
"# expect 9.64"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8ba4b03f-3025-4aa9-935b-62144dd0eaed",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment