io

class pyrosetta.distributed.cluster.io.IO

Bases: Generic[G]

Input/Output methods for PyRosettaCluster.

DATETIME_FORMAT: str = '%Y-%m-%d %H:%M:%S.%f'
REMARK_FORMAT: str = 'REMARK PyRosettaCluster: '
_get_instance_and_metadata(kwargs: Dict[Any, Any]) Tuple[Dict[Any, Any], Dict[Any, Any]]

Get the current state of the PyRosettaCluster instance, and split the kwargs into the PyRosettaCluster instance kwargs and ancillary metadata.

_get_output_dir(decoy_dir: str) str

Get the output directory in which to write files to disk.

static _filter_scores_dict(scores_dict: Dict[Any, Any]) Dict[Any, Any]
_format_result(result: Union[Pose, PackedPose]) Tuple[str, Dict[Any, Any], PackedPose]

Given a Pose or PackedPose object, return a tuple containing the pdb string and a scores dictionary.

_parse_results(results: Optional[Union[Iterable[Optional[Union[Pose, PackedPose, bytes]]], Pose, PackedPose]]) Union[List[Tuple[str, Dict[Any, Any]]], NoReturn]

Format output results on distributed worker. Input argument results can be a Pose, PackedPose, or None object, or a list or tuple of Pose and/or PackedPose objects, or an empty list or tuple. Returns a list of tuples, each tuple containing the pdb string and a scores dictionary.

_process_kwargs(kwargs: Dict[Any, Any]) Dict[Any, Any]

Remove seed specification from ‘extra_options’ or ‘options’, and remove protocols_key from kwargs.

_get_init_file_json(packed_pose: PackedPose) str

Return a PyRosetta initialization file as a JSON-serialized string.

static _add_pose_comment(packed_pose: PackedPose, pdbfile_data: str) PackedPose

Cache simulation data as a pose comment.

static _dump_json(data: Dict[str, Any]) str

Return JSON-serialized data.

_save_results(results: Any, kwargs: Dict[Any, Any]) None

Write results and kwargs to disk.

_write_environment_file(filename: str) None

Write the YML string to the input filename.

_write_init_file() None

Maybe write PyRosetta initialization file to the input filename.

_dump_init_file(filename: str, input_packed_pose: Optional[PackedPose] = None, output_packed_pose: Optional[PackedPose] = None, verbose: bool = True) None

Dump compressed PyRosetta initialization input files and poses to the input filename.

_is_protocol = False
pyrosetta.distributed.cluster.io.verify_init_file(init_file: str, input_packed_pose: Optional[PackedPose], output_packed_pose: Optional[PackedPose], metadata: Dict[str, Any]) Optional[NoReturn]

Verify a PyRosetta initialization file.

pyrosetta.distributed.cluster.io.sign_init_file_metadata_and_poses(input_packed_pose: Optional[PackedPose] = None, output_packed_pose: Optional[PackedPose] = None) Tuple[Dict[str, Any], List[PackedPose]]

Sign PyRosetta initialization file ‘metadata’ and ‘poses’ keys.

pyrosetta.distributed.cluster.io.get_poses_from_init_file(init_file: str, verify: bool = False) Union[Tuple[Optional[PackedPose], Optional[PackedPose]], NoReturn]

Return a tuple object of the input PackedPose object and the output PackedPose object from a ‘.init’ file, and optionally verify PyRosettaCluster metadata in the ‘.init’ file.

pyrosetta.distributed.cluster.io.secure_read_pickle(filepath_or_buffer: str, compression: Optional[Union[str, Dict[str, Any]]] = 'infer', storage_options: Optional[Dict[str, Any]] = None) DataFrame

Secure replacement for pandas.read_pickle() for file-like objects.

Usage requires adding ‘pandas’ as a secure package to unpickle in PyRosetta: pyrosetta.secure_unpickle.add_secure_package(‘pandas’)