Loading...
Loading...
Use this skill for OpenFold2, NVIDIA's BioNeMo NIM microservice for monomer protein structure prediction. Invoke whenever the user mentions OpenFold2, AlphaFold2-like monomer folding, protein sequence-to-structure prediction, A3M MSAs, mmCIF templates, hosted NVIDIA API calls, or local Docker deployment.
npx skill4agent add nvidia-bionemo/bionemo-agent-toolkit openfold2-nimSKILL.mdreferences/api.mdreferences/science.mdreferences/parameters.mdreferences/validation.mdreferences/examples.mdHosted NVIDIA API or local Docker NIM?
https://health.api.nvidia.com/v1/biology/openfold/openfold2/predict-structure-from-msa-and-templatehttp://localhost:8000/biology/openfold/openfold2/predict-structure-from-msa-and-templatehttp://localhost:8000/v1/health/ready/v1/Authorization: Bearer $NGC_API_KEYNGC_API_KEYNGC_API_KEYNVIDIA_API_KEYLOCAL_NIM_CACHE.envLOCAL_NIM_CACHE/opt/nim/.cache.envNGC_API_KEYNVIDIA_API_KEYdocker logindocker runnvcr.io/nim/openfold/openfold2:latestreferences/api.md.envNGC_API_KEYLOCAL_NIM_CACHEuntil curl -sf http://localhost:8000/v1/health/ready; do sleep 5; donerequestssequenceinput_idalignmentsselected_modelsrelax_predictionuse_templatesexplicit_templatesimport os
import requests
hosted = True
url = (
"https://health.api.nvidia.com/v1/biology/openfold/openfold2/predict-structure-from-msa-and-template"
if hosted
else "http://localhost:8000/biology/openfold/openfold2/predict-structure-from-msa-and-template"
)
headers = {"Content-Type": "application/json"}
if hosted:
headers["Authorization"] = f"Bearer {os.getenv('NGC_API_KEY')}"
seq = "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPT"
payload = {
"sequence": seq,
"input_id": "kras_fragment",
"selected_models": [1],
"relax_prediction": False,
"alignments": {
"uniref90": {
"a3m": {
"alignment": f">query\n{seq}",
"format": "a3m",
}
}
},
}
response = requests.post(url, headers=headers, json=payload, timeout=300)
response.raise_for_status()
result = response.json()sequencealignmentsa3malignmentformatmsa-search-nimalignmentsexplicit_templatesselected_models.pdb.ciffrom pathlib import Path
import json
Path("openfold2_response.json").write_text(json.dumps(result, indent=2))
def save_strings(obj, prefix="openfold2"):
i = 0
if isinstance(obj, dict):
for key, value in obj.items():
if isinstance(value, str) and ("ATOM" in value or value.lstrip().startswith("data_")):
i += 1
ext = "cif" if value.lstrip().startswith("data_") else "pdb"
Path(f"{prefix}_{key}_{i}.{ext}").write_text(value)
elif isinstance(value, (dict, list)):
i += save_strings(value, f"{prefix}_{key}")
elif isinstance(obj, list):
for idx, value in enumerate(obj, start=1):
if isinstance(value, (dict, list)):
i += save_strings(value, f"{prefix}_{idx}")
return i
saved = save_strings(result)
print(f"saved {saved} structure artifact(s)")selected_models: [1, 2, 3, 4, 5]relax_prediction: Truetruereferences/science.mdreferences/validation.md401422selected_models404/v1/LOCAL_NIM_CACHE