antibody_utils.structure.models

Antibody chains in a structure, and the Fvs that pair them.

These classes wrap a gemmi.Structure rather than copying it. Each AntibodyChain maps the numbered positions of its variable domain to residues of the structure, which keep their original numbering. Treat the structure as read-only while these objects are in use: adding or removing chains or residues invalidates the mapping.

Classes

AntibodyChain(chain, numbered, indices)

A chain of a structure with a numbered antibody variable domain.

AntibodyStructure(structure, chains, scheme, ...)

A structure with its antibody chains identified and numbered.

Fv(heavy, light)

A variable fragment: a heavy and a light chain that pair.

class antibody_utils.structure.models.AntibodyChain(chain, numbered, indices)[source]

Bases: object

A chain of a structure with a numbered antibody variable domain.

Only the residues of the variable domain are numbered. Any others on the chain (such as a constant domain, a tag, ligands or water) are left out here, but remain in the structure.

property chain: Chain

Whether this is a heavy or a light chain.

property gemmi_chain: Chain

The whole chain in the structure, including unnumbered residues.

property name: str

The chain’s name in the structure.

property numbered: NumberedSequence

The numbered variable domain.

region_residues(definition)[source]

Group the residues of the domain by region.

Regions are assigned with antibody_utils.regions.annotate_regions, as for antibody_utils.sequence.region_sequences.

Parameters:

definition (Definition | str) – The region definition to apply.

Return type:

dict[Region, list[Residue]]

Returns:

The residues of each region present, in sequence order.

property residues: list[Residue]

The residues of the numbered domain, in sequence order.

property scheme: Scheme

The numbering scheme.

class antibody_utils.structure.models.AntibodyStructure(structure, chains, scheme, model)[source]

Bases: object

A structure with its antibody chains identified and numbered.

Create one with antibody_utils.structure.read_structure or antibody_utils.structure.from_gemmi.

chains

The antibody chains, in the order they appear in the structure.

property heavy_chains: tuple[AntibodyChain, ...]

The heavy chains.

property light_chains: tuple[AntibodyChain, ...]

The light chains.

property model: Model

The model that the antibody chains belong to.

property other_chains: list[Chain]

The chains of the model that are not antibody chains.

scheme

The numbering scheme.

structure

The underlying GEMMI structure, with its original numbering.

class antibody_utils.structure.models.Fv(heavy, light)[source]

Bases: object

A variable fragment: a heavy and a light chain that pair.

Chains are not paired automatically: choose the pair yourself, for example from the structure’s metadata: Fv(structure[“H”], structure[“L”]).

property heavy: AntibodyChain

The heavy chain.

property light: AntibodyChain

The light chain.

property name: str

The heavy and light chain names, joined, such as “HL”.

property numbered: tuple[NumberedSequence, NumberedSequence]

The numbered heavy and light domains.

These can be passed straight to antibody_utils.sequence.identity and antibody_utils.sequence.similarity.

region_residues(definition)[source]

Group the residues of both domains by region.

Parameters:

definition (Definition | str) – The region definition to apply.

Returns:

the heavy chain’s, then the light chain’s.

Return type:

dict[Region, list[Residue]]

property scheme: Scheme

The numbering scheme.