You are here

Best way to store a pose by Pyrosetta for Pyrosetta

1 post / 0 new
Best way to store a pose by Pyrosetta for Pyrosetta

A pose can have a constraint set, a modifiable residue set, an unnoticed `pose.pdb_info().obsolete() == True` case, virtual residues, energies and a few more. Therefore when saving to disk none of the following truly work as they save coordinates:

pose.dump_scored_pdb('foo.pdb', pyrosetta.get_fa_scorefxn())
pose.dump_mmtf('foo.mmtf')[pose], 'foo.silent')

So I was hoping for an all-in-one


I know one can address some of extras manually, e.g.

# nothing to be done for
# pose.conformation().modifiable_residue_type_set_for_conf().????()

But that is rather a lot of effort and would not catch some corner cases, say fixing protonation on a catalytic triad does not get dumped cleanly.

pyrosetta.rosetta.protocols.simple_moves.MutateResidue(target=10, new_res='CYZ').apply(mutant)  # nucleophile
pyrosetta.rosetta.protocols.simple_moves.MutateResidue(target=20, new_res='HIS_D').apply(mutant)  # base in HID, not HIE


PackedPose IO-type mover seems relevant for cereal-based serialisation to pickle, but in my normal installation it is not available (relavant post I found here). —is this the solution for preserving data?

#AttributeError: module 'pyrosetta.distributed' has no attribute 'packed_pose'
# PyRosetta-4 2020 [Rosetta PyRosetta4.Release.python37.linux 2020.49+release.fac69dd63b19b7d5dac246655b6c15158b98365e 2020-12-01T20:40:56] retrieved from:[...]


There is also, a serialisation submodule in `io`, which can add a pose to a BUFFER object, a pybind11 of a structure defined in the `serialize_pose` header file (not the `pyrosetta.rosetta.std.stringbuf()` one, i.e. the one passed to `pyrosetta.rosetta.std.ostream` say). In the `serialize_pose` file the write_binary comments say it's writing to file, but I am guessing it requires `memcpy` function calls to do which I don't think I can access in Python.

b =   # no idea what the size is., b)
# b.write(str, int) -> int
#, int) -> int  # char * and str work differently, but a `ctypes.c_char_p` is not accepted.


Post Situation: 
Wed, 2021-04-07 06:50