class pyrosetta.CD(base, first, last, methods)

Bases: tuple


Return a new OrderedDict which maps field names to their values.

_fields = ('base', 'first', 'last', 'methods')
classmethod _make(iterable, new=<built-in method __new__ of type object at 0x891d20>, len=<built-in function len>)

Make a new CD object from a sequence or iterable


Return a new CD object replacing specified fields with new values

_source = "from builtins import property as _property, tuple as _tuple\nfrom operator import itemgetter as _itemgetter\nfrom collections import OrderedDict\n\nclass CD(tuple):\n    'CD(base, first, last, methods)'\n\n    __slots__ = ()\n\n    _fields = ('base', 'first', 'last', 'methods')\n\n    def __new__(_cls, base, first, last, methods):\n        'Create new instance of CD(base, first, last, methods)'\n        return _tuple.__new__(_cls, (base, first, last, methods))\n\n    @classmethod\n    def _make(cls, iterable, new=tuple.__new__, len=len):\n        'Make a new CD object from a sequence or iterable'\n        result = new(cls, iterable)\n        if len(result) != 4:\n            raise TypeError('Expected 4 arguments, got %d' % len(result))\n        return result\n\n    def _replace(_self, **kwds):\n        'Return a new CD object replacing specified fields with new values'\n        result = _self._make(map(kwds.pop, ('base', 'first', 'last', 'methods'), _self))\n        if kwds:\n            raise ValueError('Got unexpected field names: %r' % list(kwds))\n        return result\n\n    def __repr__(self):\n        'Return a nicely formatted representation string'\n        return self.__class__.__name__ + '(base=%r, first=%r, last=%r, methods=%r)' % self\n\n    def _asdict(self):\n        'Return a new OrderedDict which maps field names to their values.'\n        return OrderedDict(zip(self._fields, self))\n\n    def __getnewargs__(self):\n        'Return self as a plain tuple.  Used by copy and pickle.'\n        return tuple(self)\n\n    base = _property(_itemgetter(0), doc='Alias for field number 0')\n\n    first = _property(_itemgetter(1), doc='Alias for field number 1')\n\n    last = _property(_itemgetter(2), doc='Alias for field number 2')\n\n    methods = _property(_itemgetter(3), doc='Alias for field number 3')\n\n"
property base

Alias for field number 0

count(value) integer -- return number of occurrences of value
property first

Alias for field number 1

index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

property last

Alias for field number 2

property methods

Alias for field number 3

class pyrosetta.EnergyMethod(scoreName=None, scoreType=None, version=1)

Bases: object

Decorator function for custom EnergyMethods in PyRosetta.

exception pyrosetta.PyRosettaException

Bases: Exception


Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class pyrosetta.PythonPyExitCallback

Bases: PyExitCallback

assign(self:, :

C++: utility::py::PyExitCallback::operator=(const class utility::py::PyExitCallback &) –> class utility::py::PyExitCallback &

exit_callback(self: None

C++: utility::py::PyExitCallback::exit_callback() –> void

static get_static_int() int

C++: utility::py::PyExitCallback::get_static_int() –> int

static get_static_string() str

C++: utility::py::PyExitCallback::get_static_string() –> std::string

static get_static_string_const() str

C++: utility::py::PyExitCallback::get_static_string_const() –> const std::string

static set_PyExitCallBack(exit_callback_object: None

C++: utility::py::PyExitCallback::set_PyExitCallBack(class std::shared_ptr<class utility::py::PyExitCallback>) –> void


Creates a std::set object, deducing type from the given list.


Creates a Vector1 object, deducing type from the given list.


Determine if in an interactive context.



Read rosetta database directory from environment or standard install locations.

Database resolution proceeds by first searching the current installation for a ‘database’ or ‘rosetta_database’ path. If not found the search then continues to the users’s home dir, cygwin, and osx standard installation locations.

Returns database path if found, else None.

pyrosetta._vector_extend_func(vec, othervec)
pyrosetta.defineEnergyMethodCreator(class_, scoreType)
pyrosetta.generate_nonstandard_residue_set(pose, params_list)

Places the ResidueTypes corresponding to a list of .params filenames into a given pose

.params files must be generated beforehand. Typically, one would obtain a molfile (.mdl) generated from the xyz coordinates of a residue, small molecule, or ion. The script can be used to convert to a Rosetta-readable .params file. It can be found in the /test/tools folder of your PyRosetta installation or downloaded from the Rosetta Commons.


params = [“penicillin.params”, “amoxicillin.params”] pose = Pose() generate_nonstandard_residue_set(pose, params) pose_from_file(pose, “TEM-1_with_substrates.pdb”)

See also:

ResidueTypeSet Vector1() pose_from_file()

pyrosetta.init(options='-ex1 -ex2aro', extra_options='', set_logging_handler=None, notebook=None, silent=False)

Initialize Rosetta. Includes core data and global options.

options string with default Rosetta command-line options args.

(default: ‘-ex1 -ex2aro’)

kwargs -
extra_options - Extra command line options to pass rosetta init.

(default None)

set_logging_handler - Route rosetta tracing through logging logger ‘rosetta’:

None - Set handler if interactive, otherwise not. False - Write logs via c++-level filehandles. “interactive” - Register python log handling and make visible if not. “logging” - Register python log handling, do not update logging config. True - Register python log handling, make visible if logging isn’t configured.


init() # uses default flags init(extra_options=’-pH’) # adds flags to supplement the default init(‘-pH -database /home/me/pyrosetta/rosetta_database’) # overrides default flags - be sure to include the dB last