mcbrowse.figures.interface¶
The common interface implemented by all figures.
In general, each figure defines the following:
A
FigureFilterobject that describes how to collect the data.A
FigureDataobject that contains the collected data.A
FigureVeneerobject that defines how to format the figure.
- class mcbrowse.figures.interface.FigureFilter(*args, **kwds)[source]¶
Bases:
ABC,Generic[AnyDataT]Control how to extract the figure data from the
dafrepository.Todo
Have each
FigureFilterexpose aplotlywidget that configures it.- abstract collect(data: DafReader) AnyDataT[source]¶
Collect the matching
FigureDataout of thedata.
- class mcbrowse.figures.interface.FigureData[source]¶
Bases:
ABCContain the data to be included in the figure.
Note
This applies to most figures, but not to heatmaps.
- abstract filter(filter: Union[Dict[str, Union[Callable[[Vector], bool], Collection[Any]]], Callable[[Series], bool]]) None[source]¶
Filter the contained data using
tidy_filter_data.Note
To filter the rows or columns of a heatmap, specify a
TidyFilterthat filters the rows or columns axis used by the figure.
- abstract highlight(filter: Union[Dict[str, Union[Callable[[Vector], bool], Collection[Any]]], Callable[[Series], bool]]) None[source]¶
Mark everything matching the
filteras “highlighted” usingtidy_filter_mask. This will trigger using a different veneer for the highlighted data (the details will depend on the specific figure).Figures are expected to plot the normal data first and the highlighted data later (“on top” of the normal data).
Note
This can only be called once.
- abstract sort(order: Union[Callable[[Series], Any], Sequence[str]]) None[source]¶
Sort the contained data using
tidy_sort_by.Figures are expected to plot the normal data first and the highlighted data later (“on top” of the normal data), but will use the sort
orderwithin each category.
- abstract randomize(random_seed: Optional[int]) None[source]¶
Randomize the contained data using
tidy_randomize.Figures are expected to plot the normal data first and the highlighted data later (“on top” of the normal data), but will randomize the order within each group.
- class mcbrowse.figures.interface.TidyFigureData(tidy: Union[FrameInRows, FrameInColumns])[source]¶
Bases:
FigureDataImplement
FigureDatafor the very common case of a tidypandas.DataFrame.- tidy: Optional[Union[FrameInRows, FrameInColumns]]¶
The tidy data frame containing the figures data.
If we are highlighting, this will only contain the “normal” (non-highlighted) data.
If all the data is highlighted, this will be
None.
- highlighted: Optional[Union[FrameInRows, FrameInColumns]]¶
If we are highlighting, this will only contain the highlighted data.
- filter(filter: Union[Dict[str, Union[Callable[[Vector], bool], Collection[Any]]], Callable[[Series], bool]]) None[source]¶
Filter the contained data using
tidy_filter_data.Note
To filter the rows or columns of a heatmap, specify a
TidyFilterthat filters the rows or columns axis used by the figure.
- highlight(filter: Union[Dict[str, Union[Callable[[Vector], bool], Collection[Any]]], Callable[[Series], bool]]) None[source]¶
Mark everything matching the
filteras “highlighted” usingtidy_filter_mask. This will trigger using a different veneer for the highlighted data (the details will depend on the specific figure).Figures are expected to plot the normal data first and the highlighted data later (“on top” of the normal data).
Note
This can only be called once.
- sort(order: Union[Callable[[Series], Any], Sequence[str]]) None[source]¶
Sort the contained data using
tidy_sort_by.Figures are expected to plot the normal data first and the highlighted data later (“on top” of the normal data), but will use the sort
orderwithin each category.
- randomize(random_seed: Optional[int] = None) None[source]¶
Randomize the contained data using
tidy_randomize.Figures are expected to plot the normal data first and the highlighted data later (“on top” of the normal data), but will randomize the order within each group.
- class mcbrowse.figures.interface.HeatmapData[source]¶
Bases:
ABCContain the heatmap data to be included in the figure.
Todo
Add clustering control and clustering-preserving sorting to
HeatmapData.Todo
Create a SimpleHeatmapData implementation that keeps both a 2D matrix and a frame of annotations for the rows and the columns.
- abstract filter(*, rows_filter: Optional[Union[Callable[[Vector], bool], Collection[Any]]] = None, columns_filter: Optional[Union[Callable[[Vector], bool], Collection[Any]]] = None) None[source]¶
Filter the contained data using
matrix_filter_data.
- class mcbrowse.figures.interface.FigureVeneer(*args, **kwds)[source]¶
Bases:
ABC,Generic[AnyDataT]Contain the parameters controlling the figure’s appearance.
Todo
Have each
FigureVeneerexpose aplotlywidget that configures it.