Resources chevron_right Protocols chevron_right FoldSeek
Protocol // Protein Structure

FoldSeek

Search proteins for structural homologues using fast 3D structure alignment against large databases.

Protein Structure codeGitHub languageWebsite menu_bookPaper scheduleApril 3, 2026

Installation

Install using conda (or choose another method from the GitHub page):

conda create -n foldseek
conda activate foldseek
conda install -c conda-forge -c bioconda foldseek

Download Databases

After installing FoldSeek, download the databases you want to use to compare against.

#To download the databases
foldseek databases # gets you a list of their databases

#Then download the ones you want with:
# foldseek databases <name of database> <name of database in your folder> <tmpDir> [options]
#for example, to download the Swiss-Prot database:
foldseek databases Alphafold/Swiss-Prot sp tmp

Search Against a Database

#foldseek easy-search <file.pdb> <path_to_search_database> <output.html> tmp --format-mode 3
# --format-mode 4  gives you a table
# --threads
# --write-mapping 0
foldseek easy-search protein.pdb ../foldseek/databases/swissprot/sp protein_foldseek.html tmp --format-mode 3

#There are also other output modes, this one will generate a nice html view that shows the folds overlaid with the hits
#It can take some time to load if there are over 100s of sequences

#If you want to search over a lot of structures, make a txt file of the filenames of the structures and you can use this bash for loop to automate:
for file in `cat test_foldseek_names.txt`; do
foldseek easy-search $file ../foldseek/databases/swissprot/sp $file.html tmp --format-mode 3 ; done

Search in Your Own Database

Create a database

foldseek createdb cluster_pdbs/ cluster_pdbs_DB

Search

foldseek easy-search protein.pdb cluster_pdbs_DB protein_cluster_matches.html tmp --format-mode 3

To generate the output with Taxonomy

foldseek easy-search SRVP_Atabeyarchaeota.pdb /home/Anaconda3-23/envs/FoldSeek/afdb Tax-PDB-protein.tab tmp --format-mode 4 --write-mapping 0 --format-output qsetid,tset,tsetid,taxid,taxname,taxlineage --threads 70
foldseek easy-search your_PDB_file.pdb Path_to_The_Database_file_Created Output_to_Be_Generated tmp --format-mode 4 --write-mapping 0 --threads 70
foldseek easy-search your_PDB_file.pdb Path_to_The_Database_file_Created Output_to_Be_Generated tmp --format-mode 4 --write-mapping 0 --format-output qsetid,tset,tsetid,taxid,taxname,taxlineage --threads 70
foldseek easy-search AlphaAP023361_COX1_2_3.pdb /home/Anaconda3-23/envs/FoldSeek/afdb Alpha_result tmpFolder --format-mode 4 --format-output query,target,evalue,gapopen,pident,qstart,qend,qlen,tstart,tend,tlen,alnlen,theader,qaln,taln,qcov,tcov
info

We can use a folder as input if we want to search multiple protein structures.

Search using a multimer as query

foldseek easy-complexsearch Katy-COX1_2_3.rar /home/Anaconda3-23/envs/FoldSeek/databases/PDB-DB result tmpFolder --format-mode 4 --format-output query,target,evalue,gapopen,pident,qstart,qend,qlen,tstart,tend,tlen,alnlen,theader,qaln,taln,qcov,tcov

Clustering Proteins

Create a database

foldseek createdb example/ db

Search the proteins in the same database

foldseek search Database Database aln tmpFolder -c 0.8

Cluster the PDBs with the alignment as guidance and save in clu folder

foldseek clust Database aln clu

Create a TSV file with the results

foldseek createtsv Database Database clu clu.tsv

Recover PDB Files — RCSB

#!/bin/bash

# Script to download files from RCSB http file download services.
# Use the -h switch to get help on usage.

if ! command -v curl &> /dev/null
then
    echo "'curl' could not be found. You need to install 'curl' for this script to work."
    exit 1
fi

PROGNAME=$0
BASE_URL="https://files.rcsb.org/download"

usage() {
  cat << EOF >&2
Usage: $PROGNAME -f <file> [-o <dir>] [-c] [-p]

 -f <file>: the input file containing a comma-separated list of PDB ids
 -o  <dir>: the output dir, default: current dir
 -c       : download a cif.gz file for each PDB id
 -p       : download a pdb.gz file for each PDB id (not available for large structures)
 -a       : download a pdb1.gz file (1st bioassembly) for each PDB id (not available for large structures)
 -x       : download a xml.gz file for each PDB id
 -s       : download a sf.cif.gz file for each PDB id (diffraction only)
 -m       : download a mr.gz file for each PDB id (NMR only)
 -r       : download a mr.str.gz for each PDB id (NMR only)
EOF
  exit 1
}

download() {
  url="$BASE_URL/$1"
  out=$2/$1
  echo "Downloading $url to $out"
  curl -s -f $url -o $out || echo "Failed to download $url"
}

listfile=""
outdir="."
cif=false
pdb=false
pdb1=false
xml=false
sf=false
mr=false
mrstr=false
while getopts f:o:cpaxsmr o
do
  case $o in
    (f) listfile=$OPTARG;;
    (o) outdir=$OPTARG;;
    (c) cif=true;;
    (p) pdb=true;;
    (a) pdb1=true;;
    (x) xml=true;;
    (s) sf=true;;
    (m) mr=true;;
    (r) mrstr=true;;
    (*) usage
  esac
done
shift "$((OPTIND - 1))"

if [ "$listfile" == "" ]
then
  echo "Parameter -f must be provided"
  exit 1
fi
contents=$(cat $listfile)

# see https://stackoverflow.com/questions/918886/how-do-i-split-a-string-on-a-delimiter-in-bash#tab-top
IFS=',' read -ra tokens <<< "$contents"

for token in "${tokens[@]}"
do
  if [ "$cif" == true ]
  then
    download ${token}.cif.gz $outdir
  fi
  if [ "$pdb" == true ]
  then
    download ${token}.pdb.gz $outdir
  fi
  if [ "$pdb1" == true ]
  then
    download ${token}.pdb1.gz $outdir
  fi
  if [ "$xml" == true ]
  then
    download ${token}.xml.gz $outdir
  fi
  if [ "$sf" == true ]
  then
    download ${token}-sf.cif.gz $outdir
  fi
  if [ "$mr" == true ]
  then
    download ${token}.mr.gz $outdir
  fi
  if [ "$mrstr" == true ]
  then
    download ${token}_mr.str.gz $outdir
  fi

done

Use the flag -h to see all options. The input file is a comma-separated list of PDB IDs.

Run

./PDB-Download.sh -f list_file.txt -p

Use on a Webserver

open_in_new

FoldSeek is available as a web server — no installation required: search.foldseek.com/search