> This page is for AlphaFold2, version 2.1.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 2.1.0 (Latest) (default): https://docs.nvidia.com/nim/bionemo/alphafold2/2.1.0/llms.txt
> - 2.0.0: https://docs.nvidia.com/nim/bionemo/alphafold2/2.0.0/llms.txt
> - 1.2.0: https://docs.nvidia.com/nim/bionemo/alphafold2/1.2.0/llms.txt
> - 1.0.0: https://docs.nvidia.com/nim/bionemo/alphafold2/1.0.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/bionemo/llms.txt.

# Quickstart for AlphaFold2

> Pull the AlphaFold2 NIM container, start the service, and run your first protein structure prediction request.

This Quickstart Guide walks you through pulling the AlphaFold2 NIM container, starting the service, and running your first structure-prediction request. For comprehensive system requirements and verified configurations, refer to [Prerequisites](/nim/bionemo/alphafold2/get-started/prerequisites).

## Prerequisites

Before you start, complete the following prerequisites:

1. Install Docker, the NVIDIA Container Toolkit, and the NVIDIA drivers.
2. Set up the NGC CLI and NGC registry access.
3. Confirm that your system meets the minimum hardware requirements.

For comprehensive system prerequisites and verified configurations, refer to [Prerequisites](/nim/bionemo/alphafold2/get-started/prerequisites).

## Quickstart Steps

To get started with the AlphaFold2 NIM quickly, complete the following steps:

1. Pull the NIM container.

   ```bash
   docker pull nvcr.io/nim/deepmind/alphafold2:2.1.0
   ```
   

2. Set the required environment variables.

   ```bash
   export LOCAL_NIM_CACHE=~/.cache/nim
   export NGC_API_KEY=<Your NGC API Key>
   ```

3. Run the NIM container.

   ```bash
   docker run --rm --name alphafold2 --runtime=nvidia \
       -e NGC_API_KEY \
       -v $LOCAL_NIM_CACHE:/opt/nim/.cache \
       -p 8000:8000 \
       nvcr.io/nim/deepmind/alphafold2:2.1.0
   ```
   

   This command starts the NIM container and exposes port 8000 so you can interact with the NIM. It pulls the model to the cache at `$LOCAL_NIM_CACHE` on the local filesystem.

   <Note>
   This download can take a very long time (4 to 10 hours on a connection of 100 Mbps or faster).
   </Note>

4. Open a new terminal, leaving the current terminal open with the launched service.

5. Wait until the health check endpoint returns `{"status":"ready"}` before proceeding.

   This can take a couple of minutes. In the new terminal, use the following command to query the health check.

   ```bash
   curl -X 'GET' \
       'http://localhost:8000/v1/health/ready' \
       -H 'accept: application/json'
   ```

   **Success Check**: When the service is ready, the health check returns `{"status":"ready"}`.

6. Run inference to get a predicted protein structure for an amino acid sequence.

   ```bash
   curl -X 'POST' \
       'http://localhost:8000/protein-structure/alphafold2/predict-structure-from-sequence' \
       -H 'accept: application/json' \
       -H 'Content-Type: application/json' \
       -d '{"sequence": "MNVIDIAIAMAI"}' > output.json
   ```

   To use the MMSeqs2 GPU-accelerated MSA tool, send the `algorithm=mmseqs2` parameter to the API endpoint:

   ```bash
   curl -X 'POST' \
       'http://localhost:8000/protein-structure/alphafold2/predict-structure-from-sequence' \
       -H 'accept: application/json' \
       -H 'Content-Type: application/json' \
       -d '{"sequence": "MNVIDIAIAMAI", "algorithm": "mmseqs2"}' > output.json
   ```

7. View the outputs.

   Use `cat` to print the outputs to the command line.

   ```bash
   cat output.json
   ```

8. Format the outputs.

   Install [`jq`](https://jqlang.github.io/jq/) to format the JSON (on Linux, `apt-get install jq`), then visualize the output from the file:

   ```bash
   jq . output.json
   ```

   Alternatively, pipe the output directly to `jq`:

   ```bash
   curl -X 'POST' \
       'http://localhost:8000/protein-structure/alphafold2/predict-structure-from-sequence' \
       -H 'accept: application/json' \
       -H 'Content-Type: application/json' \
       -d '{"sequence": "MNVIDIAIAMAI"}' | jq
   ```

## Minimal Code Example

If you prefer to drive the NIM from Python, use this self-contained example to check service health and run an inference request. Install the `requests` module first with `pip install requests`.

```python
import requests
import json

base_url = "http://localhost:8000"
headers = {"content-type": "application/json"}

# 1. Wait until the NIM reports ready.
health = requests.get(f"{base_url}/v1/health/ready", headers=headers)
if health.ok:
    print("Service ready:", health.json())
else:
    print("Service not ready:", health.status_code, health.text)

# 2. Run inference to predict a structure from a sequence.
url = f"{base_url}/protein-structure/alphafold2/predict-structure-from-sequence"
sequence = "MNVIDIAIAMAI"  # Replace with the actual sequence value
data = {
    "sequence": sequence,
    "databases": ["uniref90", "small_bfd"]
}

response = requests.post(url, headers=headers, data=json.dumps(data))
if response.ok:
    print("Request succeeded:", response.json())
else:
    print("Request failed:", response.status_code, response.text)
```

## Next Steps

Now that you have a working setup, explore the following resources in greater detail:

<CardGroup cols={2}>
  <Card title="Endpoints" href="/alphafold2/endpoints">
    Full request and response details for the AlphaFold2 NIM API endpoints.
  </Card>
  <Card title="Deployment Guide" href="/alphafold2/get-started/deployment-guide">
    A detailed walkthrough of the run command, its options, and the container lifecycle.
  </Card>
  <Card title="Performance" href="/alphafold2/performance">
    Benchmarks and tuning guidance for the NIM.
  </Card>
  <Card title="Configuring the NIM at Runtime" href="/alphafold2/configuring-nim-runtime">
    Runtime environment variables and configuration options.
  </Card>
</CardGroup>