lib5c.plotters.expected module¶
Module for visualization of one-dimensional distance-dependent expected models.
Two convenience functions are exposed:
plot_bin_expected()
plot_fragment_expected()
which are bin- and fragment-level wrappers around plot_log_log_expected()
.
The other functions are utility functions.
These functions are all overloaded so that an arg called distance_expected
can be replaced with a dict of named distance expecteds. This will result in an
overlayed comparison of all the expected models in the dict.
The other functions in this module are private helper functions.
-
lib5c.plotters.expected.
plot_bin_expected
(obs_matrix, distance_expected, hexbin=False, kde=False, color='r', semilog=False, linewidth=4, title='1-D expected model', ylabel='log counts', xlabel='log distance', legend=True, **kwargs)[source]¶ Convenience function for plotting a visualization of a one-dimensional distance-dependent expected model defined over bin-level data.
- Parameters
obs_matrix (np.ndarray) – The matrix of real interaction data that the model will be compared to.
distance_expected (List[float]) – The one-dimensional distance-dependence model. The
i
th element of the list should correspond to the expected value for interactions between loci separated byi
bins. To compare multiple expected models to the same observed data, pass a dict or an OrderedDict whose keys are string names for the models.hexbin (bool) – Pass True to use a hexbin plot to represent the density of the real data.
kde (bool) – Pass True to use a kernel density estimate to represent the density of the real data.
color (str) – The color to draw the expected model line with. When comparing multiple models, this can be a dict or OrderedDict with the same keys as
distance_expected
.semilog (bool) – Pass True to leave the distance axis unlogged.
linewidth (float) – Line width to draw the model with.
kwargs (kwargs) – Typical plotter kwargs.
- Returns
The axis plotted on.
- Return type
pyplot axis
-
lib5c.plotters.expected.
plot_fragment_expected
(obs_matrix, distance_expected, distance_matrix, hexbin=False, kde=False, color='r', semilog=False, linewidth=4, title='1-D expected model', ylabel='log counts', xlabel='log distance', legend=True, **kwargs)[source]¶ Convenience function for plotting a visualization of a one-dimensional distance-dependent expected model defined over fragment-level data.
- Parameters
obs_matrix (np.ndarray) – The matrix of real interaction data that the model will be compared to.
distance_expected (Dict[int, float]) – A mapping from interaction distances in units of base pairs to the expected value at that distance. To compare multiple expected models to the same observed data, pass a dict or an OrderedDict whose keys are string names for the models.
distance_matrix (np.ndarray) – The pairwise distance matrix for the fragments in this region.
hexbin (bool) – Pass True to use a hexbin plot to represent the density of the real data.
kde (bool) – Pass True to use a kernel density estimate to represent the density of the real data.
color (str) – The color to draw the expected model line with. When comparing multiple models, this can be a dict or OrderedDict with the same keys as
distance_expected
.semilog (bool) – Pass True to leave the distance axis unlogged.
linewidth (float) – Line width to draw the model with.
kwargs (kwargs) – Typical plotter kwargs.
- Returns
The axis plotted on.
- Return type
pyplot axis
-
lib5c.plotters.expected.
plot_log_log_expected
(obs_distances, obs_values, exp_distances, exp_values, hexbin=False, kde=False, color='r', pseudocount=1, semilog=False, linewidth=4, title='1-D expected model', ylabel='log counts', xlabel='log distance', legend=True, **kwargs)[source]¶ Plot a visualization of an expected model over real data.
- Parameters
obs_distances (np.ndarray) – Flat array of the distances of the
obs_values
.obs_values (np.ndarray) – Flat array of the real data values.
exp_distances (np.ndarray) – Flat array of the distances of the
exp_values
.exp_values (np.ndarray) – Flat array of the expected data values predicted by the model. To compare multiple expected models to the same observed data, pass a dict or an OrderedDict whose keys are string names for the models.
title (str) – Title to write on the plot.
ylabel (str) – Label for the y-axis on the plot.
xlabel (str) – Label for the x-axis on the plot.
hexbin (bool) – Pass True to use a hexbin plot to represent the density of the real data.
kde (bool) – Pass True to use a kernel density estimate to represent the density of the real data.
color (str) – The color to draw the expected model line with. When comparing multiple models, this can be a dict or OrderedDict with the same keys as
distance_expected
.pseudocount (int) – Pseudocount to add to distances if called with
semilog=True
.semilog (bool) – Pass True to leave the distance axis unlogged.
linewidth (float) – Line width to draw the model with.
kwargs (kwargs) – Typical plotter kwargs.
- Returns
The axis plotted on.
- Return type
pyplot axis