antibody_utils.structure.parser

Read structures and identify their numbered antibody chains.

There are two ways to number a structure’s antibody chains:

  • By default, every protein chain is numbered with ANARCII, which needs the numbering extra. Chains that ANARCII cannot number are treated as non-antibody chains.

  • If the file is already numbered, as SAbDab’s files are, name its antibody chains with chains to use that numbering as it is, without renumberin with ANARCII.

Functions

from_gemmi(structure[, scheme, chains, ...])

Number the antibody chains of a structure that is already loaded.

read_structure(path[, scheme, chains, ...])

Read a structure file and number its antibody chains.

antibody_utils.structure.parser.from_gemmi(structure, scheme=Scheme.IMGT, *, chains=None, model=0, cpu=False)[source]

Number the antibody chains of a structure that is already loaded.

The structure is copied, so later changes to structure do not affect the result. The arguments are as for read_structure.

Parameters:
  • structure (Structure) – The structure.

  • scheme (Scheme | str) – The numbering scheme.

  • chains (Mapping[str, Chain | str] | None) – The antibody chains whose numbering to use as it is.

  • model (int) – The index of the model to use.

  • cpu (bool) – When numbering with ANARCII, run on the CPU.

Return type:

AntibodyStructure

Returns:

The structure, with its antibody chains.

antibody_utils.structure.parser.read_structure(path, scheme=Scheme.IMGT, *, chains=None, model=0, cpu=False)[source]

Read a structure file and number its antibody chains.

Parameters:
  • path (str | PathLike[str]) – A PDB, mmCIF or other file that GEMMI can read, optionally gzipped.

  • scheme (Scheme | str) – The numbering scheme. With chains, this is the scheme that the file is already numbered in.

  • chains (Mapping[str, Chain | str] | None) – The antibody chains, as a mapping from chain names to their types (“H” or “L”), whose numbering in the file is used as it is. By default, every chain is numbered with ANARCII instead.

  • model (int) – The index of the model to use.

  • cpu (bool) – When numbering with ANARCII, run on the CPU even if a GPU is available.

Return type:

AntibodyStructure

Returns:

The structure, with its antibody chains.

Raises:
  • KeyError – If a chain named in chains is not in the structure.

  • ValueError – If a chain named in chains has no residues numbered in the variable domain, or its numbering is out of order.

  • ImportError – If chains is not given and ANARCII is not installed.