ovrlpy.run
- ovrlpy.run(df, n_expected_celltypes=None, cell_diameter=10, min_expression=1.0, signature_matrix=None, fit_umap=True, patch_length=500, n_workers=min(8, len(os.sched_getaffinity(0))), umap_kwargs=UMAP_2D_PARAMS, cumap_kwargs=UMAP_RGB_PARAMS)
This is a wrapper function that computes the integrity map for a given spatial transcriptomics dataset. It includes the entire ovrlpy pipeline, returning a integrity map and a signal strength map and produces a visualizer object that can be used to plot the results.
- Parameters:
df (DataFrame) – The spatial transcriptomics dataset. This dataframe should contain a gene, x, y, and z column.
n_expected_celltypes (int, optional) – A rough estimate of expected cell type clusters. A higher number will lead to a more disjoint UMAP embedding and a higher detection of overlap events. Defaults to None, which will use a heuristic on the PCA explained variance to determine cluster count.
cell_diameter (float, optional) – The expected diameter of the cell/structure of interest in the sample. Defaults to 10.
min_expression (int, optional) – A threshold value to discard areas with low expression, by default 5 Can be interpreted as: The minimum number of transcripts to appear within a radius of ‘KDE_bandwidth’ for a region to be considered containing a cell.
signature_matrix (DataFrame, optional) – A celltypes x gene table of expression signatures to use to annotate the UMAP.
fit_umap (bool) – Whether to fit the UMAP to the data.
patch_length (int) – Size of the length in each dimension when calculating signal integrity in patches. Smaller values will use less memory, but may take longer to compute.
n_workers (int) – The number of workers to use for processsing.
umap_kwargs (dict, optional) – Additional keyword arguments for the 2D UMAP embedding.
cumap_kwargs (dict, optional) – Additional keyword arguments for the 3D UMAP embedding.
- Returns:
integrity_map (numpy.ndarray) – A integrity pixel map of the spatial transcriptomics dataset.
signal_map (numpy.ndarray) – A pixel map of the spatial transcriptomics dataset containing the detected signal.
vis (Visualizer) – A visualizer object that can be used to plot the results of the integrity map