Spaces:
Sleeping
Sleeping
Create get_3d_structure.py
Browse files- get_3d_structure.py +34 -0
get_3d_structure.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
invoke_url = "https://health.api.nvidia.com/v1/biology/nvidia/esmfold"
|
| 4 |
+
from store_pdb import StorePDB_CloudFlare
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
headers = {
|
| 9 |
+
"Authorization": "Bearer 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",
|
| 10 |
+
"Accept": "application/json",
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
def Get3D_Structure_of_Protein(sequence_for_structure,filename):
|
| 14 |
+
|
| 15 |
+
payload = {
|
| 16 |
+
"sequence":sequence_for_structure
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
#re-use connections
|
| 20 |
+
session = requests.Session()
|
| 21 |
+
|
| 22 |
+
response = session.post(invoke_url, headers=headers, json=payload)
|
| 23 |
+
response.raise_for_status()
|
| 24 |
+
|
| 25 |
+
response_body = response.json()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
if 'pdbs' in response_body:
|
| 29 |
+
#return response_body["pdbs"][0])
|
| 30 |
+
Status,URL=StorePDB_CloudFlare(response_body["pdbs"][0],filename)
|
| 31 |
+
if Status == True and URL != "":
|
| 32 |
+
return URL
|
| 33 |
+
else:
|
| 34 |
+
return "FATAL"
|