spateo.tools.cell_communication =============================== .. py:module:: spateo.tools.cell_communication Functions --------- .. autoapisummary:: spateo.tools.cell_communication.niches spateo.tools.cell_communication.predict_ligand_activities spateo.tools.cell_communication.predict_target_genes Module Contents --------------- .. py:function:: niches(adata: anndata.AnnData, path: str, layer: Tuple[None, str] = None, weighted: bool = False, spatial_neighbors: str = 'spatial_neighbors', spatial_distances: str = 'spatial_distances', species: Literal['human', 'mouse', 'drosophila', 'zebrafish', 'axolotl'] = 'human', system: Literal['niches_c2c', 'niches_n2c', 'niches_c2n', 'niches_n2n'] = 'niches_n2n', method: Literal['gmean', 'mean', 'sum'] = 'sum') -> anndata.AnnData Performing cell-cell transformation on an anndata object, while also limiting the nearest neighbor per cell to k. This function returns another anndata object, in which the columns of the matrix are bucket -bucket pairs, while the rows ligand-receptor mechanisms. This resultant anndated object allows flexible downstream manipulations such as the dimensional reduction of the row or column of this object. Our method is adapted from: Micha Sam Brickman Raredon, Junchen Yang, Neeharika Kothapalli, Naftali Kaminski, Laura E. Niklason, Yuval Kluger. Comprehensive visualization of cell-cell interactions in single-cell and spatial transcriptomics with NICHES. doi: https://doi.org/10.1101/2022.01.23.477401 :param adata: An Annodata object. :param path: Path to ligand_receptor network of NicheNet (prior lr_network). :param layer: the key to the layer. If it is None, adata.X will be used by default. :param weighted: 'False' (defult) whether to supply the edge weights according to the actual spatial distance(just as weighted kNN). Defult is 'False', means all neighbor edge weights equal to 1, others is 0. :param spatial_neighbors: neighbor_key {spatial_neighbors} in adata.uns.keys(), :param spatial_distances: neighbor_key {spatial_distances} in adata.obsp.keys(). :param system: 'niches_n2n'(defult) cell-cell signaling ('niches_c2c'), defined as the signals passed between cells, determined by the product of the ligand expression of the sending cell and the receptor expression of the receiving cell, and system-cell signaling ('niches_n2c'), defined as the signaling input to a cell, determined by taking the geometric mean of the ligand profiles of the surrounding cells and the receptor profile of the receiving cell.similarly, 'niches_c2n','niches_n2n'. :returns: An anndata of Niches, which rows are mechanisms and columns are all possible cell x cell interactions. .. py:function:: predict_ligand_activities(adata: anndata.AnnData, path: str, sender_cells: Optional[List[str]] = None, receiver_cells: Optional[List[str]] = None, geneset: Optional[List[str]] = None, ratio_expr_thresh: float = 0.01, species: Literal['human', 'mouse'] = 'human') -> pandas.DataFrame Function to predict the ligand activity. Our method is adapted from: Robin Browaeys, Wouter Saelens & Yvan Saeys. NicheNet: modeling intercellular communication by linking ligands to target genes. Nature Methods volume 17, pages159–162 (2020). :param path: Path to ligand_target_matrix, lr_network (human and mouse). :param adata: An Annodata object. :param sender_cells: Ligand cells. :param receiver_cells: Receptor cells. :param geneset: The genes set of interest. This may be the differentially expressed genes in receiver cells (comparing cells in case and control group). Ligands activity prediction is based on this gene set. By default, all genes expressed in receiver cells is used. :param ratio_expr_thresh: The minimum percentage of buckets expressing the ligand (target) in sender(receiver) cells. :returns: A pandas DataFrame of the predicted activity ligands. .. py:function:: predict_target_genes(adata: anndata.AnnData, path: str, sender_cells: Optional[List[str]] = None, receiver_cells: Optional[List[str]] = None, geneset: Optional[List[str]] = None, species: Literal['human', 'mouse'] = 'human', top_ligand: int = 20, top_target: int = 300) -> pandas.DataFrame Function to predict the target genes. :param lt_matrix_path: Path to ligand_target_matrix of NicheNet. :param adata: An Annodata object. :param sender_cells: Ligand cells. :param receiver_cells: Receptor cells. :param geneset: The genes set of interest. This may be the differentially expressed genes in receiver cells (comparing cells in case and control group). Ligands activity prediction is based on this gene set. By default, all genes expressed in receiver cells is used. :param top_ligand: `int` (default=20) select 20 top-ranked ligands for further biological interpretation. :param top_target: `int` (default=300) Infer target genes of top-ranked ligands, and choose the top targets according to the general prior model. :returns: A pandas DataFrame of the predict target genes.