io

IO routines operating on PackedPose representations.

pyrosetta.distributed.io.pack_result(func)
pyrosetta.distributed.io.pose_result(func)
pyrosetta.distributed.io.pose_from_file(*args, **kwargs)

Uses the input filename from *args or **kwargs and returns a PackedPose object from it, deserializing:

  • bz2-encoded files ending with file extensions: (“.pdb.bz2”, “.bz2”)

  • gzip-encoded files ending with file extensions: (“.pdb.gz”, “.gz”)

  • xz-encoded files ending with file extensions: (“.pdb.xz”, “.xz”)

  • base64-encoded files ending with file extension: “.b64_pose”

    Warning: This function uses the pickle module to deserialize “.b64_pose” files. Using the pickle module is not secure, so please only run with “.b64_pose” files you trust. Learn more about the pickle module and its security here.

  • pickle-encoded files ending with file extension: “.pkl_pose”

    Warning: This function uses the pickle module to deserialize “.pkl_pose” files. Using the pickle module is not secure, so please only run with “.pkl_pose” files you trust. Learn more about the pickle module and its security here.

Otherwise, implements io.to_packed(pyrosetta.io.pose_from_file(*args, **kwargs)).

@klimaj

pyrosetta.distributed.io.pose_from_sequence(seq, res_type='fa_standard', auto_termini=True)

Returns a Pose object generated from a single-letter sequence of amino acid residues in <seq> using the <res_type> ResidueType and creates N- and C- termini if <auto_termini> is set to True.

Unlike make_pose_from_sequence(), this method generates a default PDBInfo and sets all torsion angles to 180 degrees.

Example:

pose = pose_from_sequence(“THANKSEVAN”)

See also:

Pose make_pose_from_sequence() pose_from_file() pose_from_rcsb()

pyrosetta.distributed.io.pose_from_pdbstring(*args, **kwargs)

Instantiate a Pose object from a PDB string. If a Pose object is provided, it is passed to pyrosetta.rosetta.core.import_pose.pose_from_pdbstring, otherwise a new Pose object is instantiated.

@klimaj

pyrosetta.distributed.io.pose_from_pdb(*args, **kwargs)
pyrosetta.distributed.io.pose_from_pdb(none: None)

Uses the input filename from *args or **kwargs and returns a PackedPose object from it, deserializing:

  • bz2-encoded files ending with file extensions: (“.pdb.bz2”, “.bz2”)

  • gzip-encoded files ending with file extensions: (“.pdb.gz”, “.gz”)

  • xz-encoded files ending with file extensions: (“.pdb.xz”, “.xz”)

  • base64-encoded files ending with file extension: “.b64_pose”

    Warning: This function uses the pickle module to deserialize “.b64_pose” files. Using the pickle module is not secure, so please only run with “.b64_pose” files you trust. Learn more about the pickle module and its security here.

  • pickle-encoded files ending with file extension: “.pkl_pose”

    Warning: This function uses the pickle module to deserialize “.pkl_pose” files. Using the pickle module is not secure, so please only run with “.pkl_pose” files you trust. Learn more about the pickle module and its security here.

Otherwise, implements io.to_packed(pyrosetta.io.pose_from_file(*args, **kwargs)).

@klimaj

pyrosetta.distributed.io.pose_from_base64(filename)
pyrosetta.distributed.io.pose_from_base64(none: None)
pyrosetta.distributed.io.pose_from_base64(filename: str)

Warning: This function uses the pickle module to deserialize the input filename. Using the pickle module is not secure, so please only run with input files you trust. Learn more about the pickle module and its security here.

Load a PackedPose object from a base64-encoded pickled Pose file.

To load a PackedPose object from an input base64-encoded string, use io.to_packed(string) or io.to_packed(io.to_pose(string)).

@klimaj

pyrosetta.distributed.io.pose_from_pickle(filename)
pyrosetta.distributed.io.pose_from_pickle(none: None)
pyrosetta.distributed.io.pose_from_pickle(filename: str)

Warning: This function uses the pickle module to deserialize the input filename. Using the pickle module is not secure, so please only run with input files you trust. Learn more about the pickle module and its security here.

Load a PackedPose object from a pickled Pose file.

To load a PackedPose object from an input pickle-encoded bytestring, use io.to_packed(bytestring) or io.to_packed(io.to_pose(bytestring)).

@klimaj

pyrosetta.distributed.io.pose_from_init_file(filename)
pyrosetta.distributed.io.pose_from_init_file(none: None)
pyrosetta.distributed.io.pose_from_init_file(filename: str)

Warning: This function uses the pickle module to deserialize the input filename. Using the pickle module is not secure, so please only run with input files you trust. Learn more about the pickle module and its security here.

Return the first PackedPose object from the list in a ‘.init’ file if PyRosetta is initialized. If PyRosetta is not yet initialized, then initialize PyRosetta from the ‘.init’ file using the pyrosetta.init_from_file() function, then return the first PackedPose object from the list in the ‘.init’ file.

@klimaj

pyrosetta.distributed.io.poses_from_files(objs, *args, **kwargs)

Returns an iterator object which is composed of Pose objects from input files.

Example: import glob poses = pyrosetta.io.poses_from_files(glob.glob(“path/to/pdbs/*.pdb”))

pyrosetta.distributed.io.poses_from_sequences(objs, *args, **kwargs)

Returns an iterator object which is composed of Pose objects with input sequences.

Example: poses = pyrosetta.io.poses_from_sequences([“TEST”, “TESTING [ATP]”, “ACDEFGHIKLMNPQRSTVWY”])

pyrosetta.distributed.io.poses_from_multimodel_pdb(filename, *args, **kwargs)

Returns an Iterator object which is composed of Pose objects from an input multimodel PDB file. Poses are generated in the order in which they appear in the input multimodel PDB file. Any models without lines are skipped with a warning. Additional input *args and **kwargs are passed to pose_from_pdbstring.

Example: poses = pyrosetta.io.poses_from_multimodel_pdb(filename) for pose in poses:

name = pose.pdb_info().name()

@klimaj

pyrosetta.distributed.io.poses_from_silent(silent_filename)

Returns an Iterator object which is composed of Pose objects from a silent file.

@atom-moyer

pyrosetta.distributed.io.poses_from_init_file(filename)
pyrosetta.distributed.io.poses_from_init_file(none: None)
pyrosetta.distributed.io.poses_from_init_file(filename: str)

Warning: This function uses the pickle module to deserialize the input filename. Using the pickle module is not secure, so please only run with input files you trust. Learn more about the pickle module and its security here.

Return a list object of PackedPose objects from a ‘.init’ or ‘.init.bz2’ file if PyRosetta is initialized. If PyRosetta is not yet initialized, then first initialize PyRosetta from the ‘.init’ or ‘.init.bz2’ file using the pyrosetta.distributed.io.init_from_file() function, then return a list object of PackedPose objects from the ‘.init’ or ‘.init.bz2’ file.

@klimaj

pyrosetta.distributed.io.to_base64(inp)
pyrosetta.distributed.io.to_base64(none: None)

Takes a Pose or PackedPose object and returns a base64-encoded string.

pyrosetta.distributed.io.to_pickle(inp)
pyrosetta.distributed.io.to_pickle(none: None)

Takes a Pose or PackedPose object and returns a pickle-encoded bytestring.

pyrosetta.distributed.io.to_silent(inp, output_filename)

Takes a Pose, PackedPose, or a list and outputs them as a silent file. This currently only outputs to a binary silent file.

Inputs: poses: Pose object, PackedPose object or list of either. output_filename: The desired name of the output silent file.

Example: pyrosetta.distributed.io.to_silent(poses, “mydesigns.silent”)

The decoy name in your silent file is take from pose.pdb_info().name() To set a different decoy name, change it in your pose before calling this function. To change the name, you must have a Pose object, not a PackedPose Example: pose = pyrosetta.distributed.packed_pose.to_pose(packed_pose) pose.pdb_info().name(“my_tag”)

@srgerb

pyrosetta.distributed.io.to_pdbstring(inp)
pyrosetta.distributed.io.to_pdbstring(maybe_packed_dict: dict)
pyrosetta.distributed.io.to_pdbstring(container: set)
pyrosetta.distributed.io.to_pdbstring(container: tuple)
pyrosetta.distributed.io.to_pdbstring(container: list)
pyrosetta.distributed.io.to_pdbstring(generator: Generator)
pyrosetta.distributed.io.to_pdbstring(dataframe: DataFrame)
pyrosetta.distributed.io.to_pdbstring(series: Series)

Convert to pdb-formatted string with score and energy data.

pyrosetta.distributed.io.to_output_record(inp)
pyrosetta.distributed.io.to_output_record(maybe_packed_dict: dict)
pyrosetta.distributed.io.to_output_record(container: set)
pyrosetta.distributed.io.to_output_record(container: tuple)
pyrosetta.distributed.io.to_output_record(container: list)
pyrosetta.distributed.io.to_output_record(generator: Generator)
pyrosetta.distributed.io.to_output_record(dataframe: DataFrame)
pyrosetta.distributed.io.to_output_record(series: Series)

Convert to an “archive” output record with scores, pdb string and packed string.

pyrosetta.distributed.io.dump_file(inp, output_filename)

Dump a file from a PackedPose or Pose object and output filename.

@klimaj

pyrosetta.distributed.io.dump_pdb(inp, output_filename)

Dump a PDB file from a PackedPose or Pose object and output filename.

@klimaj

pyrosetta.distributed.io.dump_scored_pdb(inp, output_filename, scorefxn)

Dump a scored PDB file from a PackedPose or Pose object, output filename and score function. The score function may be a str object representing the weights passed to ScorePoseTask, a ScorePoseTask instance, or a ScoreFunction instance.

@klimaj

pyrosetta.distributed.io.dump_multimodel_pdb(inp, output_filename)

Dump a multimodel PDB file from a list, tuple, or set of PackedPose or Pose objects, and an output filename.

@klimaj

pyrosetta.distributed.io.dump_cif(inp, output_filename)

Dump a CIF file from a PackedPose or Pose object and output filename.

@klimaj

pyrosetta.distributed.io.dump_mmtf(inp, output_filename)

Dump a MMTF file from a PackedPose or Pose object and output filename.

@klimaj

pyrosetta.distributed.io.dump_base64(inp, output_filename)

Dump a base64-encoded file from a PackedPose or Pose object and output filename.

@klimaj

pyrosetta.distributed.io.dump_pickle(inp, output_filename)

Dump a pickle-encoded file from a PackedPose or Pose object and output filename.

@klimaj

pyrosetta.distributed.io.create_score_function(*args, **kwargs)

Returns a ScorePoseTask instance. Input *args and **kwargs are passed to ScorePoseTask.

@klimaj

pyrosetta.distributed.io.get_fa_scorefxn()

Returns a ScorePoseTask instance with weights from pyrosetta.rosetta.protocols.loops.get_fa_scorefxn().

@klimaj

pyrosetta.distributed.io.get_score_function()

Returns a ScorePoseTask instance with weights and patch from pyrosetta.rosetta.core.scoring.get_score_function().

@klimaj