hic3defdr.plotting.ma module¶
-
hic3defdr.plotting.ma.
plot_ma
(data, sig_idx, loop_idx=None, names=None, s=-1, nonloop_s=None, density_dpi=72, vmax=None, nonloop_vmax=None, ax=None, legend=True, **kwargs)[source]¶ Plots an MA plot.
Parameters: - data (np.ndarray) – Unlogged values to use for computing M and A for each pixel (rows) in each condition (columns).
- sig_idx (np.ndarray) – Boolean vector indicating which pixels among those that are in
loop_idx
are significantly differential. - loop_idx (np.ndarraym, optional) – Boolean vector indicating which pixels in
data
are in loops. Pass None if all pixels indata
are in loops. - names (tuple of str, optional) – The names of the two conitions being compared.
- s (float) – The marker size to pass to ax.scatter(). Pass -1 to use ax.scatter_density() instead, avoiding plotting each point separately. See Notes below for more details and caveats.
- nonloop_s (float, optional) – Pass a separate marker size to use specifically for the non-loop pixels if loop_idx is not None. Useful for drawing just the non-loop pixels as a density by passing s=1, nonloop_s=-1. Pass None to use s as the size for both loop and non-loop pixels.
- density_dpi (int) – If s is -1 this specifies the DPI to use for the density grid.
- nonloop_vmax (vmax,) – The vmax to use for ax.scatter_density() if s or nonloop_s is -1, respectively. Pass None to choose values automatically.
- ax (pyplot axis) – The axis to plot to. Must have been created with projection=’scatter_density’. Pass None to create a new axis.
- legend (bool) – Pass True to add a legend. Note that passing legend=’outside’ is not supported.
- kwargs (kwargs) – Typical plotter kwargs.
Returns: The axis plotted on.
Return type: pyplot axis
Notes
It is recommended to use ax.scatter_density() from the mpl_scatter_density module to plot the data by passing s=-1. This avoids the massive slowdown experienced when plotting one separate dot for each pixel in the genome in the case where loop_idx=None. In order to support ax.scatter_density(), a new pyplot figure and axis must be created with projection=’scatter_density’. Therefore, even though this function is decorated with @plotter, it has a non-standard behavior for interpreting the ax kwarg: if ax=None is passed, it will create a new figure and axis rather than re-using the current axis.