spateo.preprocessing.filter =========================== .. py:module:: spateo.preprocessing.filter .. autoapi-nested-parse:: Filter functions. Functions --------- .. autoapisummary:: spateo.preprocessing.filter.filter_cells spateo.preprocessing.filter.filter_genes spateo.preprocessing.filter.filter_by_coordinates Module Contents --------------- .. py:function:: filter_cells(adata: anndata.AnnData, filter_bool: Optional[numpy.ndarray] = None, keep_filtered: bool = False, min_expr_genes: int = 50, max_expr_genes: float = np.inf, min_area: float = 0, max_area: float = np.inf, inplace: bool = False) -> Optional[anndata.AnnData] Select valid cells based on a collection of filters. This function is partially based on dynamo (https://github.com/aristoteleo/dynamo-release). TODO: What layers need to be considered? Argument `shared_count` ? :param adata: AnnData object. :param filter_bool: A boolean array from the user to select cells for downstream analysis. :param keep_filtered: Whether to keep cells that don't pass the filtering in the adata object. :param min_expr_genes: Minimal number of genes with expression for a cell in the data from X. :param max_expr_genes: Maximal number of genes with expression for a cell in the data from X. :param min_area: Maximum area of a cell in the data from X. :param max_area: Maximum area of a cell in the data from X. :param inplace: Perform computation inplace or return result. :returns: An updated AnnData object with pass_basic_filter as a new column in obs to indicate the selection of cells for downstream analysis. adata will be subset with only the cells pass filtering if keep_filtered is set to be False. .. py:function:: filter_genes(adata: anndata.AnnData, filter_bool: Optional[numpy.ndarray] = None, keep_filtered: bool = False, min_cells: int = 1, max_cells: float = np.inf, min_avg_exp: float = 0, max_avg_exp: float = np.inf, min_counts: float = 0, max_counts: float = np.inf, inplace: bool = False) -> Optional[anndata.AnnData] Select valid genes based on a collection of filters. This function is partially based on dynamo (https://github.com/aristoteleo/dynamo-release). :param adata: filter_bool: :class:`~numpy.ndarray` (default: `None`) A boolean array from the user to select genes for downstream analysis. :param keep_filtered: Whether to keep genes that don't pass the filtering in the adata object. :param min_cells: Minimal number of cells with expression in the data from X. :param max_cells: Maximal number of cells with expression in the data from X. :param min_avg_exp: Minimal average expression across cells for the data. :param max_avg_exp: Maximal average expression across cells for the data. :param min_counts: Minimal number of counts (UMI/expression) for the data :param max_counts: Minimal number of counts (UMI/expression) for the data :param inplace: Perform computation inplace or return result. :returns: An updated AnnData object with pass_basic_filter as a new column in var to indicate the selection of genes for downstream analysis. adata will be subset with only the genes pass filtering if keep_filtered is set to be False. .. py:function:: filter_by_coordinates(adata: anndata.AnnData, filter_bool: Optional[numpy.ndarray] = None, keep_filtered: bool = False, x_range: Sequence[float] = (-np.inf, np.inf), y_range: Sequence[float] = (-np.inf, np.inf), inplace: bool = False) -> Optional[anndata.AnnData] Select valid cells by coordinates. TODO: lasso tool :param adata: AnnData object. :param filter_bool: A boolean array from the user to select cells for downstream analysis. :param keep_filtered: Whether to keep cells that don't pass the filtering in the adata object. :param x_range: The X-axis range of cell coordinates. :param y_range: The Y-axis range of cell coordinates. :param inplace: Perform computation inplace or return result. :returns: An updated AnnData object with pass_basic_filter as a new column in obs to indicate the selection of cells for downstream analysis. adata will be subset with only the cells pass filtering if keep_filtered is set to be False.