Spaces:
Sleeping
Sleeping
| import requests #type: ignore | |
| def fold_protein_sequence(sequence): | |
| """ | |
| Folds a protein sequence using the ESM Atlas API. | |
| - URL: https://api.esmatlas.com/foldSequence/v1/pdb/ | |
| - Method: POST | |
| - Body: Raw sequence string (NOT JSON) | |
| - No API Token required. | |
| """ | |
| api_url = "https://api.esmatlas.com/foldSequence/v1/pdb/" | |
| print(f"Folding sequence ({len(sequence)} residues)...") | |
| try: | |
| # Note: 'data' argument sends raw body. Do not use 'json='. | |
| response = requests.post(api_url, data=sequence, verify=True) | |
| if response.status_code == 200: | |
| return response.text # Returns PDB content directly | |
| else: | |
| print(f"API Error {response.status_code}: {response.text}") | |
| return None | |
| except Exception as e: | |
| print(f"Connection Failed: {e}") | |
| return None |