mushi.mu

class mu(change_points, Z, mutation_types)[source]

Bases: mushi.histories.History

Mutation spectrum history (MuSH) \(\boldsymbol\mu(t)\).

Parameters
  • change_points (ndarray) – epoch change points (times)

  • Z (ndarray) – matrix of constant values for each epoch (rows) in each mutation type (columns)

  • mutation_types (List[str]) – list of mutation type names (optional None element)

Example

>>> import mushi
>>> import numpy as np
>>> mu = mushi.mu(np.array([1, 10, 100, 1000]),
...               np.ones((5, 2)),
...               ['TCC>TTC', 'GAA>GGA'])

Methods

arrays

Return time grid and values in each cell.

check_grid

Test if time grid is the same as another instance.

clustermap

Clustermap of compositionally centralized MuSH

epochs

Generator yielding epochs as tuples: (start_time, end_time, value)

plot

Plot history.

plot_cumulative

Plot the cumulative mutation rate, like a Muller plot

Attributes

Z

read-only alias to vals attribute in base class.

mutation_types

arrays()

Return time grid and values in each cell.

check_grid(other)

Test if time grid is the same as another instance.

Parameters

other (History) – another History object

epochs()

Generator yielding epochs as tuples: (start_time, end_time, value)

property Z

read-only alias to vals attribute in base class.

plot(types=None, clr=False, **kwargs)[source]

Plot history.

Parameters
  • types (Optional[List[str]]) – list of mutation types to plot (default all)

  • clr (bool) – flag to normalize to total mutation intensity and display as centered log ratio transform

Return type

None

plot_cumulative(t_gen=None, clr=False, **kwargs)[source]

Plot the cumulative mutation rate, like a Muller plot

Parameters
  • t_gen (Optional[float]) – generation time in years (optional)

  • clr (bool) – flag to normalize to total mutation intensity and display as centered log ratio transform

  • kwargs – key word arguments passed to plt.fill_between

Return type

None

clustermap(t_gen=None, **kwargs)[source]

Clustermap of compositionally centralized MuSH

Parameters
  • t_gen (Optional[float]) – generation time in years (optional)

  • kwargs – additional keyword arguments passed to pd.clustermap

Return type

None