helixmc.random_step.RandomStepAgg

class helixmc.random_step.RandomStepAgg(data_file=None, gaussian_sampling=True)

Random bp-step generator by aggregating multiple independent simple bp-step generators. Useful for sequence dependence simulations.

Parameters:

data_file : str, optional

Pre-curated database file with sequence dependence in .npz format.

gaussian_sampling : bool, optional

Whether to sample assuming a multivariate Gaussian. Default is True.

See also

RandomStepBase
Base class for Random bp-step generator, for inheritence only.
RandomStepSimple
Simple random bp-step generator.

Attributes

gaussian_sampling (bool) See the Parameters section.
params_avg (ndarray) Average values for the step parameters distribution.
rand_list (list) List of all RandomStep objects in the aggregation.
names (list) List of all names of RandomStep in the aggregation.
__call__(identifier=None)

Draw one random bp-step parameter set from the distribution. Randomly select one generator in the aggregation and return its generated result if no input parameter is given.

Parameters:

identifier : int or str

Index or name of the requested random step generator.

Returns:

params: ndarray, shape (6)

Randomly generated bp-step parameter set.

o : ndarray, shape (3)

Corresponding bp-center for the 2nd bp of the bp-step (1st bp is at origin and oriented with the coordinate frame).

R : ndarray, shape (3,3)

Corresponding frame for the 2nd bp of the bp-step.

Raises:

TypeError :

If the input identifier is not int or str

__init__(data_file=None, gaussian_sampling=True)
append_random_step(name, random_step)

Append one additional random bp-step generator to the aggregation.

Parameters:

name : str

Name of the random bp-step generator.

random_step : subclass of RandomStepBase

The random bp-step generator to be added to the aggregation

Raises:

TypeError

If random_step does not belong to a subclass of RandomStepBase.

ValuError

If the input name already exists in self.names.

clear_all()

Clear all random bp-step generator in the aggregation.

get_rand_step(identifier)

Return one RandomStep object stored in the aggregation.

Parameters:

identifier : int or str

Index or name of the requested random step generator.

Returns:

rand_step : subclass of RandomStepBase

RandomStep object stored in the aggregation.

Raises:

TypeError :

If the input identifier is not int or str

load_from_file(data_file)
Load data file in .npz format and append to the current aggregation.
The routine will look for helixmc/data/ if the file is not found in current folder.
Parameters:

data_file : str, optional

Pre-curated database file with sequence dependence in .npz format.

name2rand_idx(name)

Get the index of a RandomStep object in rand_list from its name.

Parameters:

name : str

Name of the RandomStep in the aggregation.

Returns:

idx : int

The corresponding index of the RandomStep object.