samplers

Custom Sampler classes to generate protein conformations.

Classes

MonteCarloSampler

Custom MonteCarlo sampler for sampling dihedral angles.

Functions

setup_samplers(sampler_params, variance, scorefxn, ...)

Create all Sampler objects to be used during sampling.

Module Contents

class ensemblify.generation.ensemble_utils.samplers.MonteCarloSampler(scorefxn, databases, mover_id, smp_params, variance, log_file)

Custom MonteCarlo sampler for sampling dihedral angles.

Parameters:
  • scorefxn (pyrosetta.rosetta.core.scoring.ScoreFunction)

  • databases (dict)

  • mover_id (str)

  • smp_params (dict[str, int])

  • variance (float)

  • log_file (str)

scorefxn

PyRosetta score function to be used for evaluating Pose objects during sampling.

Type:

pyrosetta.rosetta.core.scoring.ScoreFunction

databases

All the available databases to sample from. Mapping of database_ids to databases nested dicts, that map residue 1lettercodes to dihedral angle values dataframes.

Type:

dict

mover

Custom PyRosetta Mover used to apply dihedral angle changes to a Pose.

Type:

pyrosetta.rosetta.protocols.moves.Mover

params
Hyperparameters for this sampler (temperature and maximum loops):
temperature (int):

A measure of how probable it is to accept Pose objects with a worse score than the current one after applying our Mover, according to the acceptance criterion.

maximum loops (int):

The maximum amount of attempts without accepting a Move before moving on to the next residue to sample.

Type:

dict

log_file

Path to .log file for warnings or error messages related to sampling.

Type:

str

apply(pose, target, chain, database_id, ss_bias, sampling_mode)

Perform MC sampling on the given pose, in the given target residue range.

Parameters:
  • pose (pyrosetta.rosetta.core.pose.Pose) – Pose to be modified during sampling.

  • target (list[int]) – Residue range on which sampling will be applied.

  • chain (str) – Letter identifier for the current chain being sampled.

  • database_id (str) – Identifier for which database to sample from.

  • ss_bias (tuple[tuple[str,tuple[int,int],str],...], optional) – Information about types of secondary structure biases, including which chain and residue numbers they should be applied on.

  • sampling_mode (str) – Whether to sample the database considering neighbouring residues (‘TRIPEPTIDE’) or not (‘SINGLERESIDUE’).

ensemblify.generation.ensemble_utils.samplers.setup_samplers(sampler_params, variance, scorefxn, databases, log_file)

Create all Sampler objects to be used during sampling.

Create a dictionary with all the samplers that will be used during sampling, given a list of sampler_ids and certain parameters.

Parameters:
  • sampler_params (dict[str,dict[str,int]) – Parameters for each sampler to setup.

  • scorefxn (pyrosetta.rosetta.core.scoring.ScoreFunction) – PyRosetta score function, with desired constraints already added.

  • databases (dict[str,dict[str,pd.DataFrame]]) – Mapping of database_ids to databases nested dicts, that map residue 1lettercodes to dihedral angle values dataframes.

  • variance (float)

  • log_file (str)

Returns:

Mapping of sampler_ids to sampler objects to use during sampling.

Return type:

dict[str,MonteCarloSampler]