Loading...
Loading...
Generate multiple sequence alignments (MSAs) for protein sequences using the ColabFold MSA-Search NIM. Use for homolog search, UniRef30/ColabFold env searches, A3M or FASTA alignments, paired MSA search for complexes, PDB70 structural templates, hosted NVIDIA API calls, or local Docker deployment. For local deployment, download the databases in parallel with aria2c and launch via NIM_MODEL_NAME (the recommended default fast path, ~14 min vs over 80 min for the built-in downloader); a plain docker run uses the slow built-in downloader.
npx skill4agent add nvidia-bionemo/bionemo-agent-toolkit msa-search-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/colabfold/msa-search/predicthttps://health.api.nvidia.com/v1/biology/colabfold/msa-search/paired/predicthttp://localhost:8000/biology/colabfold/msa-search/predicthttp://localhost:8000/biology/colabfold/msa-search/paired/predicthttp://localhost:8000/biology/colabfold/msa-search/structure-templates/predict/v1/Authorization: Bearer $NGC_API_KEYNGC_API_KEYNVIDIA_API_KEY-e NGC_API_KEYNIM_MODEL_NAMEdocker rundatabases:pdb70docker loginNIM_MODEL_NAMENVIDIA_API_KEY# --- env preflight (do not drop the NVIDIA_API_KEY fallback) ---
set -a
[ -f .env ] && . ./.env
set +a
if [ -z "${NGC_API_KEY:-}" ] && [ -n "${NVIDIA_API_KEY:-}" ]; then
export NGC_API_KEY="$NVIDIA_API_KEY"
fi
: "${NGC_API_KEY:?Set NGC_API_KEY or NVIDIA_API_KEY}"
: "${DB_DIR:=/data/fast-db}" # where the parallel download lands
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
# --- 1) pick the DB version(s) you need (paired/complex work = uniref30 only) ---
DB_VERSION=uniref30_2302-m18v1
command -v aria2c >/dev/null || { echo "aria2c required; install it (e.g. apt-get install -y aria2) and re-run"; exit 1; }
mkdir -p "$DB_DIR"
# --- 2) parallel download from NGC (see "Parallel Download" section for the all-DB loop) ---
curl -fsS -H "Authorization: Bearer $NGC_API_KEY" \
"https://api.ngc.nvidia.com/v2/org/nim/team/colabfold/models/msa-search/${DB_VERSION}/files" \
-o /tmp/files.json
DB_DIR="$DB_DIR" python3 - <<'PY'
import json, os
d = json.load(open("/tmp/files.json")); dbdir = os.environ["DB_DIR"]; lines = []
for url, path in zip(d["urls"], d["filepath"]):
lines += [url.strip(), f" dir={dbdir}", f" out={path}"]
open("/tmp/aria.in", "w").write("\n".join(lines) + "\n")
PY
aria2c -i /tmp/aria.in --max-concurrent-downloads=4 --max-connection-per-server=16 \
--split=16 --min-split-size=1M --continue=true --file-allocation=none
# --- 3) launch the NIM against the downloaded files (skips the slow built-in download) ---
docker run -d --name msa-search --runtime=nvidia --gpus all \
-e NGC_API_KEY \
-e NIM_MODEL_NAME=/databases \
-v "${DB_DIR}:/databases" \
-p 8000:8000 \
nvcr.io/nim/colabfold/msa-search:2until curl -sf http://localhost:8000/v1/health/ready; do sleep 5; done$DB_DIRdatabases:alldatabases:pdb70NIM_MODEL_PROFILE: "${LOCAL_NIM_CACHE:?Set LOCAL_NIM_CACHE}"
mkdir -p "${LOCAL_NIM_CACHE}"; chmod 755 "${LOCAL_NIM_CACHE}"
docker run --rm --name msa-search \
--runtime=nvidia --gpus all \
-e NGC_API_KEY \
-e NIM_MODEL_PROFILE=<hash-from-list-model-profiles> \
-v "${LOCAL_NIM_CACHE}:/opt/nim/.cache" \
-p 8000:8000 \
nvcr.io/nim/colabfold/msa-search:2docker run --rm --entrypoint list-model-profiles nvcr.io/nim/colabfold/msa-search:2NIM_MODEL_PROFILEdocker run --rm --name msa-search \
--runtime=nvidia --gpus all \
-e NGC_API_KEY \
-e NIM_MODEL_PROFILE=<hash-from-list-model-profiles> \
-v "${LOCAL_NIM_CACHE}:/opt/nim/.cache" \
-p 8000:8000 \
nvcr.io/nim/colabfold/msa-search:2list-model-profiles| Profile tags | Databases | Best for | Storage |
|---|---|---|---|
| PDB70 | Quick testing / smoke check | ~100 MB |
| UniRef30 | Paired MSA search for complexes — UniRef30 is the only DB used for species-based pairing | ~500 GB |
| UniRef30 + PDB70 + PDB structures | Structural template search | ~700 GB |
| UniRef30 + ColabFold envdb + PDB70 + PDB100 + PDB structures | Full sensitivity, all databases | ~1.2 TB |
curl -s localhost:8000/v1/metadata | jqdatabasesNIM_MODEL_PROFILEcolabfold_envdb_202108databases:uniref30databases:allNIM_MODEL_NAMEngc registry model download-version nim/colabfold/msa-search:uniref30_2302-m18v1
# then mount the directory and set -e NIM_MODEL_NAME=/databasesNIM_MODEL_NAME**/*.idxmmseqs createindexuniref30_2302-m18v1colabfold_envdb_202108-m18v1pdb70_220313-m18v1pdb100_230517-m18v1pdb_20251028_zip-m18v1databases:alldatabases:uniref30max_parallel_files=10/health/readyaccept-ranges: bytesaria2cNIM_MODEL_NAME# 1) Get presigned file URLs for the individual database model version from NGC.
# (Requires NGC_API_KEY. The response arrays `urls` and `filepath` are positionally paired.)
curl -s -H "Authorization: Bearer $NGC_API_KEY" \
'https://api.ngc.nvidia.com/v2/org/nim/team/colabfold/models/msa-search/uniref30_2302-m18v1/files' \
-o files.json
# 2) Build an aria2 input file (URL + target filename per entry) and download in parallel.
python3 - <<'PY'
import json
d = json.load(open("files.json"))
lines = []
for url, path in zip(d["urls"], d["filepath"]):
lines += [url.strip(), " dir=/data/fast-db", f" out={path}"]
open("aria.in", "w").write("\n".join(lines) + "\n")
PY
aria2c -i aria.in \
--max-concurrent-downloads=4 --max-connection-per-server=16 --split=16 \
--min-split-size=1M --continue=true --file-allocation=none
# 3) Start the NIM against the downloaded directory. NIM_MODEL_NAME makes the NIM discover
# databases by scanning for **/*.idx, bypassing the profile/blob cache entirely.
docker run -d --name msa-search --runtime=nvidia --gpus all \
-e NGC_API_KEY \
-e NIM_MODEL_NAME=/databases \
-v /data/fast-db:/databases \
-p 8000:8000 \
nvcr.io/nim/colabfold/msa-search:2databases:allNIM_MODEL_NAME**/*.idx# fetch each DB's file list into /data/all-db/<db>/ ... then one aria2c per list, e.g.:
for V in uniref30_2302-m18v1 colabfold_envdb_202108-m18v1 pdb70_220313-m18v1 \
pdb100_230517-m18v1 pdb_20251028_zip-m18v1; do
curl -s -H "Authorization: Bearer $NGC_API_KEY" \
"https://api.ngc.nvidia.com/v2/org/nim/team/colabfold/models/msa-search/$V/files" \
-o "files_$V.json"
# build an aria2 input from files_$V.json (dir=/data/all-db) and run aria2c on it
done
# then launch once against the parent:
# docker run -d ... -e NIM_MODEL_NAME=/databases -v /data/all-db:/databases ...files.jsonuniref30_2302/…filepath.idx.UNIREF30_READY*.tar.gz.unpacked--split--max-connection-per-serverfast-dbimport os
import requests
HOSTED = True
url = (
"https://health.api.nvidia.com/v1/biology/colabfold/msa-search/predict"
if HOSTED else "http://localhost:8000/biology/colabfold/msa-search/predict"
)
headers = {"Content-Type": "application/json"}
if HOSTED:
headers["Authorization"] = f"Bearer {os.getenv('NGC_API_KEY')}"
payload = {
"sequence": "SGSMKTAISLPDETFDRVSRRASELGMSRSEFFTKAAQR",
"databases": ["Uniref30_2302", "colabfold_envdb_202108"],
"e_value": 0.0001,
"output_alignment_formats": ["a3m"],
}
response = requests.post(url, headers=headers, json=payload, timeout=300)
response.raise_for_status()
result = response.json()sequencesalignments_by_chainurl = (
"https://health.api.nvidia.com/v1/biology/colabfold/msa-search/paired/predict"
if HOSTED else "http://localhost:8000/biology/colabfold/msa-search/paired/predict"
)
payload = {
"sequences": [chain_a_sequence, chain_b_sequence],
"e_value": 0.0001,
"output_alignment_formats": ["a3m"],
}max_msa_sequences=500NIM_GLOBAL_MAX_MSA_DEPTHurl = "http://localhost:8000/biology/colabfold/msa-search/structure-templates/predict"
headers = {"Content-Type": "application/json"}
payload = {
"sequence": "VLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHGSAQVKGHGKKVADALTNAVA",
"structural_template_databases": ["pdb70_220313"],
"max_structures": 20,
"max_msa_sequences": 500,
}# Standard MSA: result["alignments"][database][format]["alignment"]
for db_name, formats in result.get("alignments", {}).items():
for fmt_name, data in formats.items():
with open(f"msa_{db_name}.{fmt_name}", "w", encoding="utf-8") as handle:
handle.write(data["alignment"])
# Paired MSA: one alignment set per chain
for chain_id, chain_data in result.get("alignments_by_chain", {}).items():
for db_name, formats in chain_data.items():
for fmt_name, data in formats.items():
with open(f"msa_chain_{chain_id}_{db_name}.{fmt_name}", "w", encoding="utf-8") as handle:
handle.write(data["alignment"])
# Template search: save mmCIF structures and M8 hit tables
for name, cif in result.get("structures", {}).items():
open(f"template_{name}.cif", "w", encoding="utf-8").write(cif)
for name, hit_table in result.get("search_hits", {}).items():
open(f"template_hits_{name}.m8", "w", encoding="utf-8").write(hit_table)references/validation.mdXmax_msa_sequencesNIM_GLOBAL_MAX_MSA_DEPTH/v1/LOCAL_NIM_CACHE