pyckmeans.utils package
Submodules
pyckmeans.utils.plotting module
Plotting utitlies
- pyckmeans.utils.plotting.plot_ckmeans_result(ckm_res: pyckmeans.core.ckmeans.CKmeansResult, names: Optional[Iterable[str]] = None, order: Optional[Union[str, numpy.ndarray]] = 'GW', cmap_cm: Union[str, matplotlib.colors.Colormap] = 'Blues', cmap_clbar: Union[str, matplotlib.colors.Colormap] = 'tab20', figsize: Tuple[float, float] = (7, 7)) matplotlib.figure.Figure
Plot pyckmeans result consensus matrix with consensus clusters.
- Parameters
- ckm_resCKmeansResult
CKmeansResult as returned from CKmeans.predict.
- namesOptional[Iterable[str]]
Sample names to be plotted.
- orderOptional[Union[str, numpy.ndarray]]
Sample Plotting order. Either a string, determining the oder method to use (see CKmeansResult.order), or a numpy.ndarray giving the sample order, or None to apply no reordering.
- cmap_cmUnion[str, matplotlib.colors.Colormap], optional
Colormap for the consensus matrix, by default ‘Blues’
- cmap_clbarUnion[str, matplotlib.colors.Colormap], optional
Colormap for the cluster bar, by default ‘tab20’
- figsizeTuple[float, float], optional
Figure size for the matplotlib figure, by default (7, 7).
- Returns
- matplotlib.figure.Figure
Matplotlib figure.
- pyckmeans.utils.plotting.plot_cmatrix(cmatrix: numpy.ndarray, cl: numpy.ndarray, names: Optional[Iterable[str]] = None, order: Optional[Union[str, numpy.ndarray]] = 'GW', cmap_cm: Union[str, matplotlib.colors.Colormap] = 'Blues', cmap_clbar: Union[str, matplotlib.colors.Colormap] = 'tab20', figsize: Tuple[float, float] = (7, 7)) Tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes, matplotlib.axes._axes.Axes]
Plot consensus matrix and consensus clustering.
- Parameters
- cmatrixnumpy.ndarray
Consensus matrix.
- clnumpy.ndarray
Cluster membership.
- namesOptional[Iterable[str]]
Sample names to be plotted.
- orderOptional[Union[str, numpy.ndarray]]
Sample Plotting order. Either a string, or a numpy.ndarray giving the sample order, or None to apply no reordering.
- cmap_cmUnion[str, matplotlib.colors.Colormap], optional
Colormap for the consensus matrix, by default ‘Blues’
- cmap_clbarUnion[str, matplotlib.colors.Colormap], optional
Colormap for the cluster bar, by default ‘tab20’
- figsizeTuple[float, float], optional
Figure size for the matplotlib figure, by default (7, 7).
- Returns
- Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes, matplotlib.axes.Axes, matplotlib.axes.Axes]
Figure, consensus matrix Axes, cluster membership Axes, colorbar Axes.
- pyckmeans.utils.plotting.plot_multickmeans_metrics(mckm_res: pyckmeans.core.multickmeans.MultiCKmeansResult, figsize: Tuple[float, float] = (7, 7)) matplotlib.figure.Figure
Plot MultiCKMeansResult metrics.
- Parameters
- mckm_resMultiCKmeansResult
MultiCKmeansResult object
- figsizeTuple[float, float], optional
Figure size for the matplotlib figure, by default (7, 7).
- Returns
- matplotlib.figure.Figure
Matplotlib Figure of the metrics plot.
- pyckmeans.utils.plotting.plot_wecr_result(wecr_res: pyckmeans.core.wecr.WECRResult, k: int, names: Optional[Iterable[str]] = None, order: Optional[Union[str, numpy.ndarray]] = 'GW', cmap_cm: Union[str, matplotlib.colors.Colormap] = 'Blues', cmap_clbar: Union[str, matplotlib.colors.Colormap] = 'tab20', figsize: Tuple[float, float] = (7, 7)) matplotlib.figure.Figure
Plot wecr result consensus matrix with consensus clusters.
- Parameters
- wecr_respyckmeans.core.WECRResult
WECRResult as returned from pyckmeans.core.WECR.predict.
- k: int
The number of clusters k to use for plotting.
- namesOptional[Iterable[str]]
Sample names to be plotted.
- orderOptional[Union[str, numpy.ndarray]]
Sample Plotting order. Either a string, determining the oder method to use (see WECRResult.order), or a numpy.ndarray giving the sample order, or None to apply no reordering.
- cmap_cmUnion[str, matplotlib.colors.Colormap], optional
Colormap for the consensus matrix, by default ‘Blues’
- cmap_clbarUnion[str, matplotlib.colors.Colormap], optional
Colormap for the cluster bar, by default ‘tab20’
- figsizeTuple[float, float], optional
Figure size for the matplotlib figure, by default (7, 7).
- Returns
- matplotlib.figure.Figure
Matplotlib figure.
- Raises
- wecr.InvalidKError
Raised if an invalid k argument is provided.
- pyckmeans.utils.plotting.plot_wecr_result_metrics(wecr_res: pyckmeans.core.wecr.WECRResult, figsize: Tuple[float, float] = (7, 7)) matplotlib.figure.Figure
Plot WECRResult metrics.
- Parameters
- wecr_resWECRResult
WECRResult object
- figsizeTuple[float, float], optional
Figure size for the matplotlib figure, by default (7, 7).
- Returns
- matplotlib.figure.Figure
Matplotlib Figure of the metrics plot.
pyckmeans.utils.progressbar module
Progress bar utilities
- class pyckmeans.utils.progressbar.MultiCKMeansProgressBars(mckm: pyckmeans.core.multickmeans.MultiCKMeans, **kwargs: Dict[str, Any])
Bases:
objectContext Manager for a MultiCKMeans progress bars.
- Parameters
- mckmMultiCKMeans
MultiCKMeans object to display progress bars for.
- kwargsDict[str, Any]
Additional keyword arguments passed to tqdm.tqdm.
Methods
update([n])Update progress by n iterations.
- update(n: int = 1)
Update progress by n iterations.
- Parameters
- nint, optional
Progress increment in iterations, by default 1
Module contents
Utilties module