ovo.core.utils.residue_selection

Module Contents

Functions

from_residues_to_segments

Convert a list of residues [3,4,5,6,9,10,…] into a list of segments [3-6,9-10,…].

from_residues_to_hotspots

Convert a chain_id (i.e. A) and list of residues [3,4,…] into list of hotspots [A3, A4, …].

parse_selections

Input: a JSON-encoded representation of the selections that looks like this {“sequenceSelections”:[{“chainId”:”A”,”residues”:[10,11,12,13,15,16,17,18,19,20”]}]} Outputs list o segments [“A10-13”, “A15-20”]

get_chains_and_contigs

from_hotspots_to_segments

from_segments_to_hotspots

Convert a list of segments [“A3-5”,”A9-10”,…] to a STRING of hotspots “A3,A4,A5,A9,A10”.

from_contig_to_residues

Convert a str chain_segment / contig “A3-5/A9-10” to a list of residues [3,4,5,9,10].

from_residues_to_chain_breaks

parse_partial_diffusion_binder_contig

Get binder length and DESIGNED segments from binder contig as they correspond to positions in binder chain A

create_partial_diffusion_binder_contig

Create a new binder contig for partial diffusion from the designed segments and old binder contig

API

ovo.core.utils.residue_selection.from_residues_to_segments(chain_id: str, residues: list[int], start_res: int | None = None, end_res: int | None = None) list[str]

Convert a list of residues [3,4,5,6,9,10,…] into a list of segments [3-6,9-10,…].

Args: chain_id (str): Required. The chain ID. residues (list[int]): Required. A list of residues. start_res (int, optional): The start residue. If specified, trims residues from start_res. Defaults to None. end_res (int, optional): The end residue. If specified, trims residues to end_res. Defaults to None.

Returns: list(str): A list of segments, i.e. [3-6,9-10,…]

ovo.core.utils.residue_selection.from_residues_to_hotspots(chain_id: str, residues: list[int])

Convert a chain_id (i.e. A) and list of residues [3,4,…] into list of hotspots [A3, A4, …].

ovo.core.utils.residue_selection.parse_selections(selections: str) list[str]

Input: a JSON-encoded representation of the selections that looks like this {“sequenceSelections”:[{“chainId”:”A”,”residues”:[10,11,12,13,15,16,17,18,19,20”]}]} Outputs list o segments [“A10-13”, “A15-20”]

ovo.core.utils.residue_selection.get_chains_and_contigs(pdb_str: str | None) Dict[str, str] | None
ovo.core.utils.residue_selection.from_hotspots_to_segments(hotspots: str) list[str] | None
ovo.core.utils.residue_selection.from_segments_to_hotspots(segments: list[str] | None) str

Convert a list of segments [“A3-5”,”A9-10”,…] to a STRING of hotspots “A3,A4,A5,A9,A10”.

ovo.core.utils.residue_selection.from_contig_to_residues(chain_segment: str | None) list[int] | None

Convert a str chain_segment / contig “A3-5/A9-10” to a list of residues [3,4,5,9,10].

ovo.core.utils.residue_selection.from_residues_to_chain_breaks(residues: list[int]) List[str] | None
ovo.core.utils.residue_selection.parse_partial_diffusion_binder_contig(binder_contig: str) tuple[int, list[str]]

Get binder length and DESIGNED segments from binder contig as they correspond to positions in binder chain A

default case for a peptide of 12 residues is simply binder_contig=”12-12” turned into [“A1-12”] or when redesigning only A1 and A3-7 in a peptide of 12 residues, this would be binder_contig=”1-1/A2-2/5-5/A8-12” turned into [“A1-1”, “A3-7”]

Parameters:

binder_contig – binder contig, e.g. 12-12 or 1-1/A2-2/5-5/A8-12

Returns:

binder length (int) and list of designed segments (list of str, e.g. [“A1-1”, “A3-7”])

ovo.core.utils.residue_selection.create_partial_diffusion_binder_contig(redesigned_segments: list[str], binder_length: int) str

Create a new binder contig for partial diffusion from the designed segments and old binder contig

default case for a peptide of 12 residues: redesigned_segments=[] -> binder_contig=”12-12” or when redesigning only A1 and A3-7 in a peptide of 12 residues, redesigned_segments=[“A1-1”, “A3-7”] -> binder_contig=”1-1/A2-2/5-5/A8-12”

Parameters:
  • redesigned_segments – list of designed segments (list of str, e.g. [“A1-1”, “A3-7”])

  • binder_length – length of binder (int)

Returns:

new binder contig (str)