ovo.app.components.molstar_custom_component.dataclasses

Module Contents

Classes

ContigSegment

Class for storing data about individual contig regions.

EnhancedJSONEncoder

A JSON encoder for enabling the export of dataclasses.

ChainVisualization

Class for storing data about individual chains.

StructureVisualization

Class for storing data about structures shown in the Mol* component.

API

class ovo.app.components.molstar_custom_component.dataclasses.ContigSegment

Class for storing data about individual contig regions.

value: str

None

length: int

None

type: str

None

input_res_start: int

None

input_res_end: int

None

input_res_chain: str

None

out_res_start: int

None

out_res_end: int

None

out_res_chain: str

None

color: str | None

None

class ovo.app.components.molstar_custom_component.dataclasses.EnhancedJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: json.JSONEncoder

A JSON encoder for enabling the export of dataclasses.

Initialization

Constructor for JSONEncoder, with sensible defaults.

If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped.

If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.

If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place.

If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.

If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.

If specified, separators should be an (item_separator, key_separator) tuple. The default is (’, ‘, ‘: ‘) if indent is None and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.

If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a TypeError.

default(o)
class ovo.app.components.molstar_custom_component.dataclasses.ChainVisualization

Class for storing data about individual chains.

Parameters

chain_id : str The chain ID. color : Literal[“uniform”, “chain-id”, “hydrophobicity”, “plddt”, “molecule-type”, “secondary-structure”, “residue-name”], optional The color scheme to use, by default “uniform”. color_params : dict, optional Color parameters. In the case of “uniform”, the color_params field should be for example {“value”: “0x00ff00”}. In the case of “chain-id”, the color_params field should be for example {“palette”: “pastel-1”}. representation_type : Literal[“cartoon”, “cartoon+ball-and-stick”, “molecular-surface”, “gaussian-surface”, “ball-and-stick”], optional The representation type to use, by default “cartoon”. residues : list[int], optional Create a representation just for the specified residues, by default None (all residues). label : str, optional The label to show when hovering over the visualization, by default None.

chain_id: str

None

color: Literal[uniform, chain-id, hydrophobicity, plddt, molecule-type, secondary-structure, residue-name]

‘uniform’

color_params: dict | None

None

representation_type: Literal[cartoon, cartoon+ball-and-stick, molecular-surface, gaussian-surface, ball-and-stick]

‘cartoon’

residues: list[int] | None

None

label: str | None

None

class ovo.app.components.molstar_custom_component.dataclasses.StructureVisualization

Class for storing data about structures shown in the Mol* component.

Parameters

pdb : str A PDB/mmCIF content of the structure to visualize. Can also be a URL to a PDB/mmCIF file. contigs : list[ContigSegment], optional A list of contig segments to show (e.g. on the top of the viewer), by default None. color : Literal[“uniform”, “chain-id”, “hydrophobicity”, “plddt”, “molecule-type”, “secondary-structure”, “residue-name”], optional The color scheme to use, by default “uniform”. color_params : dict, optional Color parameters. In the case of “uniform”, the color_params field should be for example {“value”: “0x00ff00”}. In the case of “chain-id”, the color_params field should be for example {“palette”: “pastel-1”}. representation_type : Literal[“cartoon”, “cartoon+ball-and-stick”, “molecular-surface”, “gaussian-surface”, “ball-and-stick”], optional The representation type to use, by default “cartoon”. highlighted_selections : list[str], optional A list of selections to select and highlight in green color, by default None. chains : list[ChainVisualization], optional A list of separate chain visualizations, useful for individual coloring and representation, by default None. Available only for PDB files in a string format.

pdb: str

None

contigs: str | list[ovo.app.components.molstar_custom_component.dataclasses.ContigSegment] | None

None

color: Literal[uniform, chain-id, hydrophobicity, plddt, molecule-type, secondary-structure, residue-name]

‘uniform’

color_params: dict | None

None

representation_type: Literal[cartoon, cartoon+ball-and-stick, molecular-surface, gaussian-surface, ball-and-stick] | None

‘cartoon’

highlighted_selections: list[str] | None

None

chains: list[ovo.app.components.molstar_custom_component.dataclasses.ChainVisualization] | None

None

__post_init__()
to_dict()