ovo.core.logic.descriptor_logic

Module Contents

Functions

get_available_descriptors

Return all descriptor keys found in DB for the given design ids.

get_wide_descriptor_table

Return a wide descriptor table for the given design ids. The table will have design ids as index and human-readable descriptor names (or keys if human_readable=False) as columns.

submit_descriptor_workflow

prepare_proteinqc_params

prepare_refolding_params

get_log

Get the log of a descriptor job from the scheduler.

process_results

Process results of a successful workflow - save DescriptorValues to database

read_descriptor_file_values

Process descriptor job, return list of DescriptorValues to be inserted into DB.

save_descriptor_job_for_design_job

find_id_column

generate_descriptor_values_for_design

Generate DescriptorValue objects for a given design based on descriptor tables.

update_and_process_descriptors

Update descriptor jobs and process finished descriptor jobs

export_proteinqc_excel

export_design_descriptors_excel

Export Excel file with design descriptors for the given design ids.

API

ovo.core.logic.descriptor_logic.get_available_descriptors(design_ids: list[str]) dict[str, ovo.core.database.models.Descriptor]

Return all descriptor keys found in DB for the given design ids.

ovo.core.logic.descriptor_logic.get_wide_descriptor_table(*, pool_ids: Collection[str] = None, design_ids: Collection[str] = None, descriptor_keys: Collection[str] = None, human_readable=True, nested=False, **filters) pandas.DataFrame

Return a wide descriptor table for the given design ids. The table will have design ids as index and human-readable descriptor names (or keys if human_readable=False) as columns.

ovo.core.logic.descriptor_logic.submit_descriptor_workflow(workflow: ovo.core.database.models.DescriptorWorkflow, scheduler_key: str, round_id: str)
ovo.core.logic.descriptor_logic.prepare_proteinqc_params(workflow: ovo.core.database.models_proteinqc.ProteinQCWorkflow, workdir: str) dict
ovo.core.logic.descriptor_logic.prepare_refolding_params(workflow: ovo.core.database.models_refolding.RefoldingWorkflow, workdir: str) dict
ovo.core.logic.descriptor_logic.get_log(descriptor_job: ovo.core.database.models.DescriptorJob, tail: int = None) str

Get the log of a descriptor job from the scheduler.

ovo.core.logic.descriptor_logic.process_results(descriptor_job: ovo.core.database.models.DescriptorJob, callback: Callable = None, wait: bool = True)

Process results of a successful workflow - save DescriptorValues to database

ovo.core.logic.descriptor_logic.read_descriptor_file_values(descriptor_job: ovo.core.database.models.DescriptorJob, design_id_mapping: dict[str, str | tuple], filenames: dict[str, str] = None, descriptor_tables: dict[str, pandas.DataFrame] = None) list[ovo.core.database.models.DescriptorValue]

Process descriptor job, return list of DescriptorValues to be inserted into DB.

Parameters:
  • descriptor_job – DescriptorJob object

  • design_id_mapping – Mapping from design.id to table_id (basename of PDB file = id column in descriptor output file)

  • filenames – Dict of “pipeline_name|tool_key” -> filename in output directory (without file extension - will look for .csv or .jsonl)

  • descriptor_tables – Optional dictionary of pre-loaded descriptor tables (tool_key -> pd.DataFrame).

ovo.core.logic.descriptor_logic.save_descriptor_job_for_design_job(design_job: ovo.core.database.models.DesignJob, round_id: str, chains: list[str], design_ids: list[str]) ovo.core.database.models.DescriptorJob
ovo.core.logic.descriptor_logic.find_id_column(df: pandas.DataFrame, df_name: str)
ovo.core.logic.descriptor_logic.generate_descriptor_values_for_design(design_id: str, table_ids: str | tuple, descriptor_job_id: str | None, descriptor_tables, chains: list[str]) list[ovo.core.database.models.DescriptorValue]

Generate DescriptorValue objects for a given design based on descriptor tables.

Requirements (otherwise an error is raised, leading to interrupted processing of the job):

  • Each descriptor table must contain at least one recognized descriptor (defined by Descriptor objects)

  • One of the design’s table_ids must be found in each descriptor table (each design should be present)

  • Descriptor table index must be unique

Parameters:
  • design_id – ID of the design

  • table_ids – ID(s) corresponding to the design in the dataframes (can be a single string or a tuple of strings)

  • descriptor_job_id – ID of the DescriptorJob

  • descriptor_tables – Dictionary of descriptor tables (tool_key -> pd.DataFrame, indexed by table_id)

  • chains – List of chain IDs the descriptors apply to

Returns:

List of DescriptorValue objects

ovo.core.logic.descriptor_logic.update_and_process_descriptors(descriptor_jobs: List[ovo.core.database.models.DescriptorJob], error_callback: Callable)

Update descriptor jobs and process finished descriptor jobs

ovo.core.logic.descriptor_logic.export_proteinqc_excel(design_ids: list[str], output_path: str = None)
ovo.core.logic.descriptor_logic.export_design_descriptors_excel(df: pandas.DataFrame, output_path=None) io.BytesIO | None

Export Excel file with design descriptors for the given design ids.

Parameters:
  • df – Dataframe with any values, descriptor columns should be descriptor keys

  • output_path – If given, write the Excel file to this path. If None, return the bytes of the Excel file.