Predicts the 3D structure of a protein from its amino acid sequence, multiple sequence alignments, and templates.
Follow the steps below to download and run the NVIDIA NIM inference microservice for this model on your infrastructure of choice.
Pull and run openfold/openfold2
using Docker (this will download the full model and run it in your local environment)
$ docker login nvcr.io Username: $oauthtoken Password: <PASTE_API_KEY_HERE>
NGC_API_KEY
environment variable.export NGC_API_KEY=<your personal NGC key>
export LOCAL_NIM_CACHE=~/.cache/nim mkdir -p "$LOCAL_NIM_CACHE" sudo chmod 0777 -R "$LOCAL_NIM_CACHE"
docker run -it \ --runtime=nvidia \ --gpus='"device=0"' \ -p 8000:8000 \ -e NGC_API_KEY \ -v "$LOCAL_NIM_CACHE":/opt/nim/.cache \ nvcr.io/nim/openfold/openfold2:1.0.0
This command will start the NIM container and expose port 8000 for the user to interact with the NIM.
{"status":"ready"}
before proceeding. This may take a couple of minutes. You can use the following command to query the health check.curl http://localhost:8000/v1/health/ready
The following examples predict 3D atomic structures from input protein sequence, optionally include multiple-sequence-alignments.
The following is an example of how you can use a Python client to input a protein sequence and two multiple sequence alignments. Two model parameters sets are included. The response includes a prediction for each provided parameters set, ordered by confidence. The relaxation step is not applied.
nim_client.py
.#!/usr/bin/env python3 import requests import os import json from pathlib import Path output_file="output.json" url = "http://localhost:8000/biology/openfold/openfold2/predict-structure-from-msa-and-template" selected_models = [1, 2] sequence = ( "GGSKENEISHHAKEIERLQKEIERHKQSIKKLKQSEQSNPPPNP" "EGTRQARRNRRRRWRERQRQKENEISHHAKEIERLQKEIERHKQSIKKLKQSEC" ) uniref90_alignment_in_a3m_trunc10=\ """>BQXYMDHSRWGGVPIWVK GGSKENEISHHAKEIERLQKEIERHKQSIKKLKQSEQSNPPPNPEGTRQARRNRRRRWRERQRQKENEISHHAKEIERLQKEIERHKQSIKKLKQSEC >UniRef90_A0A221IUG4 --------------------------QTVKLVKRLYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_A7KWE0 ---------------------------TVRLIKQLYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_A0A2I6UE91 ---------------------------TVKLIKEIYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_D6NY33 ---------------------------AVRLIKQIYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_A0A221IUJ5 --------------------------QTVKLIKRLYQSNPPPNPEGTRQARRNRRRRWREKQRQ---------------------------------- >UniRef90_D6NYR3 ---------------------------TVRLVKQLYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_I6Y2C4 ---------------------------TVRLIKRIYQSNPPPNPEGTRQARRNRRRRWRERQRQIQN------------------------------- >UniRef90_A0A161CVP3 --------------------------QTIRLIKLLYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_Q6EFX9 --------------------------QTVRLIKLLYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- >UniRef90_A0A2I6UAR5 --------------------------ETVKIIKYLYQSNPPPNPEGTRQARRNRRRRWRERQRQ---------------------------------- """ small_bfd_alignment_in_a3m = \ """>BQXYMDHSRWGGVPIWVK GGSKENEISHHAKEIERLQKEIERHKQSIKKLKQSEQSNPPPNPEGTRQARRNRRRRWRERQRQKENEISHHAKEIERLQKEIERHKQSIKKLKQSEC >A0A076V4A1_9HIV1 ------------------------------------QSNPPPNHEGTRQARRNRRRRWRERQRQ---------------------------------- """ data = { "sequence": sequence, "alignments": { "uniref90": { "a3m": { "alignment": uniref90_alignment_in_a3m_trunc10, "format": "a3m", } }, "small_bfd": { "a3m": { "alignment": small_bfd_alignment_in_a3m, "format": "a3m", } }, }, "selected_models": selected_models, "relax_prediction": False, } r = requests.post(url=url, json=data) print(r, "Saving to output.json: ", r.text[:200], "...") Path(output_file).write_text(r.text)
chmod +x nim_client.py ./nim_client.py
output.json
file in json format. You can quickly view the file using the following command.less output.json
The following is an example of how you can use a shell client to input a protein sequence. Two model parameters sets are included. The response includes a prediction for each provided parameters set, ordered by confidence. The relaxation step is not applied.
nim_client.sh
.#!/usr/bin/env bash set -e URL='http://localhost:8000/biology/openfold/openfold2/predict-structure-from-msa-and-template' SEQUENCE="GGSKENEISHHAKEIERLQKEIERHKQSIKKLKQSEQSNPPPNPEGTRQ\ ARRNRRRRWRERQRQKENEISHHAKEIERLQKEIERHKQSIKKLKQSEC" # Prepare the JSON data DATA=$(cat <<EOF { "sequence": "${SEQUENCE}", "selected_models": [1,2] } EOF ) echo "Generated JSON data:" echo "DATA=${DATA}" # Make the request echo "Submitting request...the response should arrive in less than a 1 minute" POLL_SECONDS=300 curl -s -X POST "${URL}" \ -H "content-type: application/json" \ -H "NVCF-POLL-SECONDS: ${POLL_SECONDS}" \ -d "${DATA}"
chmod +x nim_client.sh ./nim_client.sh
For more details on getting started with this NIM, visit the NVIDIA NIM Docs.