ovo.core.database.models¶
Module Contents¶
Classes¶
subclasses will be converted to dataclasses |
|
Placeholder DescriptorWorkflow used when the descriptors are generated by a design workflow |
|
Unknown workflow type, used when the workflow type is not recognized or not registered |
|
Descriptor storing a number for the whole molecule |
|
Descriptor storing a number for each residue in a protein chain |
|
Descriptor storing a string label for the whole molecule |
|
Descriptor storing a string for multiple residues, as a {resid -> string} dictionary, stored in the DB as a JSON-encoded string. |
|
Descriptor storing a category label for each residue in a protein chain, each category represented by a letter. |
|
Descriptor storing list of residue numbers as a value, for example A123,A124,A202 |
|
Descriptor storing a Storage file path as a value |
|
Descriptor storing a structure file path as a value (PDB, mmCIF) |
Data¶
API¶
- class ovo.core.database.models.Base¶
Bases:
sqlalchemy.orm.MappedAsDataclass,sqlalchemy.orm.DeclarativeBasesubclasses will be converted to dataclasses
- class ovo.core.database.models.JobMixin¶
Bases:
sqlalchemy.orm.MappedAsDataclass- scheduler_key: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- job_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- job_started_date_utc: sqlalchemy.orm.Mapped[datetime.datetime]¶
‘mapped_column(…)’
- job_finished_date_utc: sqlalchemy.orm.Mapped[datetime.datetime]¶
‘mapped_column(…)’
- job_result: sqlalchemy.orm.Mapped[bool | None]¶
‘mapped_column(…)’
- warnings: sqlalchemy.orm.Mapped[list[str]]¶
‘mapped_column(…)’
- class ovo.core.database.models.MetadataMixin¶
Bases:
sqlalchemy.orm.MappedAsDataclass- author: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- created_date_utc: sqlalchemy.orm.Mapped[datetime.datetime]¶
‘mapped_column(…)’
- class ovo.core.database.models.UserSettings¶
Bases:
ovo.core.database.models.Base- __tablename__¶
‘user_setting’
- username: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- last_project_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- class ovo.core.database.models.Project¶
Bases:
ovo.core.database.models.Base,ovo.core.database.models.MetadataMixin- __tablename__¶
‘project’
- __table_args__¶
()
- id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- name: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- public: sqlalchemy.orm.Mapped[bool]¶
‘mapped_column(…)’
- class ovo.core.database.models.Round¶
Bases:
ovo.core.database.models.Base,ovo.core.database.models.MetadataMixin- __tablename__¶
‘round’
- id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- project_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- name: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- description: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- ovo.core.database.models.MODEL_WEIGHTS_SCAFFOLD¶
[‘Base’, ‘ActiveSite’]
- ovo.core.database.models.MODEL_WEIGHTS_BINDER¶
[‘Complex_base’, ‘Complex_beta’]
- class ovo.core.database.models.WorkflowParams¶
- validate()¶
- classmethod from_dict(data)¶
- to_dict(human_readable=False)¶
- class ovo.core.database.models.Threshold¶
- min_value: float | None¶
None
- max_value: float | None¶
None
- enabled: bool¶
True
- copy(**kwargs) ovo.core.database.models.Threshold¶
- __eq__(other)¶
- format(descriptor_name: str = '') str | None¶
- get_bounds(descriptor: ovo.core.database.models.NumericDescriptor, descriptor_values: pandas.Series) tuple[float | int, float | int] | None¶
Get min, max bounds for the threshold for a specific set of designs, based on the descriptor values
Can be used to plot the threshold on a histogram or scatter plot.
- Parameters:
descriptor – Descriptor object, used to get the min and max values if not set in the threshold
descriptor_values – Series of descriptor values for the designs, used to determine the bounds
- Returns:
tuple of (min, max) bounds for the threshold, or None if no bounds are set
- class ovo.core.database.models.WorkflowTypes¶
- _registry¶
None
- classmethod register(workflow_name)¶
Decorator to register a workflow class with a given name
- classmethod exists(workflow_name)¶
Check if a workflow type with the given name exists
- classmethod get(workflow_name)¶
Get workflow class by name
- classmethod get_subclass_names(workflow_name) list[str]¶
Get list of registered workflow names that are subclasses of the given workflow name (including itself)
- class ovo.core.database.models.Workflow¶
- name: str¶
‘field(…)’
- is_instance(cls)¶
Safe isinstance that avoids error on objects loaded from Streamlit session state after live reload
This solves the problem that sometimes is_instance returns false in our app even though the object actually is of that class.
See documentation: https://docs.streamlit.io/develop/concepts/design/custom-classes And issue: https://github.com/streamlit/streamlit/issues/8180
- classmethod is_subclass(other_cls)¶
Safe issubclass that avoids error on objects loaded from Streamlit session state after live reload
- classmethod from_dict(data)¶
Convert dict to Workflow object - NOTE: This method currently cannot be extended, the base class method will always be called! See db.encoder module
- get_param_fields(human_readable=False) dict[str, ovo.core.database.models.WorkflowParams]¶
Get all …_param fields, verify they are instances of WorkflowParams
with human_readble=False, returns dict: field_name -> params instance with human_readble=True, returns dict: Tool name -> params instance
- get_param_dict() dict¶
Get all values of all param fields, as flat dictionary
- get_table_row(**kwargs) pandas.Series¶
Get all values of all param fields, skip fields with metadata.show_to_user=False, return pd.Series
- validate()¶
- get_time_estimate(scheduler: ovo.core.scheduler.base_scheduler.Scheduler) str¶
- abstractmethod get_pipeline_name() str¶
- abstractmethod prepare_params(workdir: str) dict¶
Submit the workflow to the scheduler and return the job id
- abstractmethod process_results(job: Union[ovo.core.database.models.DesignJob, ovo.core.database.models.DescriptorJob], callback: Callable = None) list[ovo.core.database.models.Base]¶
Process results of a successful workflow - download files from workdir, create and return objects to be saved such as Designs and DescriptorValues
- classmethod get_download_fields()¶
- class ovo.core.database.models.DescriptorWorkflow¶
Bases:
ovo.core.database.models.Workflow,abc.ABC- chains: List[str]¶
‘field(…)’
- design_ids: List[str]¶
‘field(…)’
- validate()¶
- class ovo.core.database.models.DesignDescriptorWorkflow¶
Bases:
ovo.core.database.models.DescriptorWorkflowPlaceholder DescriptorWorkflow used when the descriptors are generated by a design workflow
- design_job_id: str¶
‘field(…)’
- class ovo.core.database.models.DesignWorkflow¶
Bases:
ovo.core.database.models.Workflow- acceptance_thresholds: dict[str, ovo.core.database.models.Threshold]¶
‘field(…)’
- get_table_row(**kwargs) pandas.Series¶
Get all values of all param fields, skip fields with metadata.show_to_user=False, return pd.Series
- validate()¶
- abstractmethod classmethod visualize_multiple_designs_structures(design_ids: list[str])¶
Visualize multiple design structures in Streamlit
- classmethod visualize_single_design_structures(design_id: str)¶
Visualize single design structures in Streamlit
- classmethod visualize_single_design_sequences(design_id: str)¶
- class ovo.core.database.models.UnknownWorkflow(data: dict, error: str)¶
Bases:
ovo.core.database.models.DesignWorkflow,ovo.core.database.models.DescriptorWorkflowUnknown workflow type, used when the workflow type is not recognized or not registered
This can happen when a plugin is uninstalled.
Initialization
- __do_not_serialize__¶
True
- data: dict¶
None
- error: str¶
None
- class ovo.core.database.models.DesignJob¶
Bases:
ovo.core.database.models.Base,ovo.core.database.models.MetadataMixin,ovo.core.database.models.JobMixin- __tablename__¶
‘design_job’
- id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- workflow: sqlalchemy.orm.Mapped[ovo.core.database.models.DesignWorkflow]¶
‘mapped_column(…)’
- class ovo.core.database.models.Pool¶
Bases:
ovo.core.database.models.Base,ovo.core.database.models.MetadataMixin- __tablename__¶
‘pool’
- __table_args__¶
()
- id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- round_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- design_job_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- name: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- description: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- processed: sqlalchemy.orm.Mapped[bool]¶
‘mapped_column(…)’
- classmethod generate_id()¶
- ovo.core.database.models.DesignChainType¶
None
- ovo.core.database.models.x¶
None
- class ovo.core.database.models.DesignChain¶
- type: ovo.core.database.models.DesignChainType¶
None
- chain_ids: list[str]¶
None
- sequence: str¶
None
- smiles: str¶
None
- ccd: str¶
None
- contig: str¶
None
- cyclic: bool¶
False
- class ovo.core.database.models.DesignSpec¶
- chains: list[ovo.core.database.models.DesignChain]¶
None
- get_chain(chain_id: str)¶
- classmethod from_pdb_str(pdb_data: str, chains: list[str], cyclic=False)¶
- classmethod from_dict(data)¶
- class ovo.core.database.models.Design¶
Bases:
ovo.core.database.models.Base- __tablename__¶
‘design’
- id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- pool_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- structure_path: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- structure_descriptor_key: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- accepted: sqlalchemy.orm.Mapped[bool]¶
‘mapped_column(…)’
- spec: sqlalchemy.orm.Mapped[ovo.core.database.models.DesignSpec]¶
‘mapped_column(…)’
- contig_index: sqlalchemy.orm.Mapped[int]¶
‘mapped_column(…)’
- __post_init__()¶
- classmethod design_id_to_pool_id(design_id: str) str¶
Get Pool ID from Design ID (ovo_xyz_1234 -> xyz)
- classmethod from_pdb_file(storage, filename: str, pdb_str: str, chains: list[str], project_id: str, pool_id: str, id: str = None, **kwargs)¶
- class ovo.core.database.models.DescriptorJob¶
Bases:
ovo.core.database.models.Base,ovo.core.database.models.MetadataMixin,ovo.core.database.models.JobMixin- __tablename__¶
‘descriptor_job’
- id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- round_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- processed: sqlalchemy.orm.Mapped[bool]¶
‘mapped_column(…)’
- workflow: sqlalchemy.orm.Mapped[ovo.core.database.models.DescriptorWorkflow]¶
‘mapped_column(…)’
- classmethod generate_id(tries=100)¶
Generate unique UID shortened for memory efficiency in descriptor_value table
- class ovo.core.database.models.DescriptorValue¶
Bases:
ovo.core.database.models.Base- __tablename__¶
‘descriptor_value’
- design_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- descriptor_key: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- descriptor_job_id: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- chains: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- value: sqlalchemy.orm.Mapped[str]¶
‘mapped_column(…)’
- class ovo.core.database.models.Descriptor¶
Bases:
abc.ABC- name: str¶
None
- description: str¶
None
- tool: str¶
None
- key: str¶
None
- serialize(value)¶
Serialize a value into a number or string so that it can be stored in the DB
- deserialize(value)¶
De-serialize a value stored in the DB into a meaningful object in python
- class ovo.core.database.models.NumericDescriptor¶
Bases:
ovo.core.database.models.Descriptor,abc.ABC- comparison: str¶
None
- min_value: float¶
None
- max_value: float¶
None
- warning_value: float¶
None
- error_value: float¶
None
- unit: str¶
None
- color_scale: str¶
None
- get_plot_range(values: pandas.Series, padding=0.05) tuple[float, float] | None¶
Return range for the plot based on min_value, max_value with additional padding
- format(value)¶
- class ovo.core.database.models.NumericGlobalDescriptor¶
Bases:
ovo.core.database.models.NumericDescriptorDescriptor storing a number for the whole molecule
- class ovo.core.database.models.NumericResidueDescriptor¶
Bases:
ovo.core.database.models.NumericDescriptorDescriptor storing a number for each residue in a protein chain
- class ovo.core.database.models.StringGlobalDescriptor¶
Bases:
ovo.core.database.models.DescriptorDescriptor storing a string label for the whole molecule
- class ovo.core.database.models.StringResidueDescriptor¶
Bases:
ovo.core.database.models.DescriptorDescriptor storing a string for multiple residues, as a {resid -> string} dictionary, stored in the DB as a JSON-encoded string.
- serialize(value)¶
Serialize a value into a number or string so that it can be stored in the DB
- deserialize(value)¶
De-serialize a value stored in the DB into a meaningful object in python
- class ovo.core.database.models.CategoricalResidueDescriptor¶
Bases:
ovo.core.database.models.DescriptorDescriptor storing a category label for each residue in a protein chain, each category represented by a letter.
Annotation for the whole chain is saved as a single string, each category represented by a letter (key in category_labels), for example “EEEHHH—HHH” for DSSP secondary structure annotation.
- category_labels: dict[str]¶
‘field(…)’
- class ovo.core.database.models.ResidueNumberDescriptor¶
Bases:
ovo.core.database.models.DescriptorDescriptor storing list of residue numbers as a value, for example A123,A124,A202
- class ovo.core.database.models.FileDescriptor¶
Bases:
ovo.core.database.models.DescriptorDescriptor storing a Storage file path as a value
- class ovo.core.database.models.StructureFileDescriptor¶
Bases:
ovo.core.database.models.FileDescriptorDescriptor storing a structure file path as a value (PDB, mmCIF)
- structure_type: Literal[backbone_design, sequence_design, prediction, experimentally_resolved]¶
None
- b_factor_value: Literal[plddt, fractional_plddt]¶
None
- ovo.core.database.models.__all__¶
[‘Base’, ‘JobMixin’, ‘MetadataMixin’, ‘UserSettings’, ‘Project’, ‘Round’, ‘WorkflowParams’, ‘Thresho…