czbenchmarks.datasets.utils_single_cell ======================================= .. py:module:: czbenchmarks.datasets.utils_single_cell Attributes ---------- .. autoapisummary:: czbenchmarks.datasets.utils_single_cell.logger Functions --------- .. autoapisummary:: czbenchmarks.datasets.utils_single_cell.run_multicondition_dge_analysis Module Contents --------------- .. py:data:: logger .. py:function:: run_multicondition_dge_analysis(adata: anndata.AnnData, condition_key: str, de_gene_col: str, control_cells_ids: Dict[str, List[str]], filter_min_cells: int = 10, filter_min_genes: int = 1000, min_pert_cells: int = 50, remove_avg_zeros: bool = False, store_dge_metadata: bool = False, return_merged_adata: bool = False) -> Tuple[pandas.DataFrame, anndata.AnnData] Run differential gene expression analysis for a list of conditions between perturbed and matched control cells. :param adata (AnnData): :type adata (AnnData): Annotated data matrix containing gene expression and metadata. :param condition_key (str): :type condition_key (str): Column name for condition labels in `adata.obs`. :param de_gene_col (str): :type de_gene_col (str): Column name for gene labels in `adata.var`. :param control_cells_ids (Dict[str: :type control_cells_ids (Dict[str: Mapping from condition -> list of matched control cell ids. :param List[str]]): :type List[str]]): Mapping from condition -> list of matched control cell ids. :param filter_min_cells (int: :type filter_min_cells (int: Minimum number of cells expressing a gene to include that gene. Defaults to 10. :param optional): :type optional): Minimum number of cells expressing a gene to include that gene. Defaults to 10. :param filter_min_genes (int: :type filter_min_genes (int: Minimum number of genes detected per cell. Defaults to 1000. :param optional): :type optional): Minimum number of genes detected per cell. Defaults to 1000. :param min_pert_cells (int: :type min_pert_cells (int: Minimum number of perturbed cells required. Defaults to 50. :param optional): :type optional): Minimum number of perturbed cells required. Defaults to 50. :param remove_avg_zeros (bool: :type remove_avg_zeros (bool: Whether to remove genes with zero average expression. Defaults to True. :param optional): :type optional): Whether to remove genes with zero average expression. Defaults to True. :param store_dge_metadata (bool: :type store_dge_metadata (bool: Whether to store DGE metadata in the results DataFrame. Defaults to False. :param optional): :type optional): Whether to store DGE metadata in the results DataFrame. Defaults to False. :param return_merged_adata (bool: :type return_merged_adata (bool: Whether to return the merged AnnData object. Defaults to False. :param optional): :type optional): Whether to return the merged AnnData object. Defaults to False. :returns: (results_df, adata_merged): - results_df: Differential expression results for `selected_condition`. - adata_merged: AnnData containing concatenated condition and control cells. :rtype: Tuple[pd.DataFrame, anndata.AnnData]