plinder.data.databases#

plinder.data.databases.run(cmd: list[str], *, cwd: Path | None = None) → None[source]#
plinder.data.databases.make_db(input_dir: Path, output_dir: Path, db: str, tmp_dir: Path = PosixPath('tmp'), threads: int = 1) → None[source]#

Create full databases. input_dir is a misnomer for mmseqs because it wants the full path to the pdb_seqres.txt.gz or pdb_uniprot.fasta. output_dir is a misnomer in both cases because it wants the full path to the filename of the database, not just the directory it writes to.

Parameters:
input_dirPath

Input file or directory. Foldseek accepts coordinate files such as *-enrich.cif.gz for apo/holo structures and AF-*-F1-model_v4.cif for predicted structures. MMseqs accepts a sequence file such as pdb_seqres.txt.gz or pdb_uniprot.txt.gz.

output_dirPath

location of full final database (including file name)

dbstr

name of db in [“foldseek”, “mmseqs”]

tmp_dirPath, default=Path(“tmp”)

scratch directory

threadsint, default=1

Maximum number of threads used by Foldseek or MMseqs.

plinder.data.databases.create_db(input_dir: Path, output_dir: Path, db: str, *, threads: int = 1) → None[source]#

Create a Foldseek/MMseqs database without indexing it.

plinder.data.databases.create_db_index(output_dir: Path, db: str, *, tmp_dir: Path = PosixPath('tmp'), threads: int = 1) → None[source]#

Index an existing Foldseek/MMseqs database.

plinder.data.databases.created_database_is_complete(database: Path, aln_type: str) → bool[source]#

Return whether createdb finished all lookup and data outputs.

plinder.data.databases.install_database_directory(source: Path, target: Path, *, preserve_directories: tuple[str, ...] = ()) → None[source]#

Copy a completed scratch DB and swap it into shared storage.

Generated search results can share a backend directory with its target database. preserve_directories moves those directories through the atomic swap instead of copying them to scratch or deleting them with the retired database generation.

plinder.data.databases.publish_search_database_bundle(*, source_root: Path, target_root: Path, aln_type: str) → dict[str, int | str][source]#

Atomically publish the portable files needed for custom searches.

The full Foldseek source database and exact-clustering build artifacts are not needed after createclusearchdb. MMseqs retains its full target and representative-to-member alignments because expandaln followed by member-level align requires both.

plinder.data.databases.database_identifiers(database: Path) → set[str][source]#

Return identifiers for records actually selected into a database.

plinder.data.databases.exact_search_database_paths(db_dir: Path, search_db: str, aln_type: str) → tuple[Path, Path, Path | None][source]#

Return full target, representative target and expansion alignment DB.

plinder.data.databases.make_exact_search_db(*, full_db: Path, aln_type: str, tmp_dir: Path, threads: int) → dict[str, Any][source]#

Build and index an exactly deduplicated, expandable search target.

The search cap is applied to representatives. Foldseek’s native cluster search realigns every expanded structure. MMseqs uses a representative search followed by expandaln and a final member-level align.

plinder.data.databases.make_sub_db(entry_chain_ids: set[str], full_db: Path, sub_db: Path, aln_type: str, *, portable: bool = False) → list[str][source]#

Requires a list of already generated annotation entries. Create reduced indexes from the full databases based on the passed entry_chain_ids.

Parameters:
entry_chain_idsset[str]

output from get_db_ids

full_dbPath

path to full database

sub_dbPath

path to sub database

aln_typestr

database name

plinder.data.databases.get_db_ids(entries: Dict[str, EntryView], search_db: str, aln_type: str, entry_ids: list[str] | None = None) → set[str][source]#

get chain IDs for a given database from the provided entries.

Parameters:
entriesDict[str, EntryView]

the collection of entries

search_dbstr

search_db in [“apo”, “holo”, “pred”]

aln_typestr

aln_type in [“foldseek”, “mmseqs”]

Returns:
db_idsset[str]

db IDs in the given database

plinder.data.databases.make_sub_dbs(db_dir: Path, db_sources: Dict[str, Path], entries: Dict[str, EntryView] | None = None, *, identifiers_by_database: dict[str, set[str]] | None = None, tmp_dir: Path | None = None, threads: int = 1) → None[source]#

Create the apo/holo subdbs for score generation.

Parameters:
db_dirPath

directory where subdbs get written

db_sourcesDict[str, Path]

map of database name to path to full database

entriesDict[str, EntryView], optional

Map of entries used to derive identifiers for scorer-managed databases.

identifiers_by_databasedict[str, set[str]], optional

Precomputed identifiers keyed by {search_db}_{alignment_type}. The release pipeline uses this to select protein receptor chains directly from the chain index without constructing all systems.