Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does stlearn calculates the number of L-R pairs of celltype #288

Open
caiquanyou opened this issue Mar 17, 2024 · 1 comment
Open

How does stlearn calculates the number of L-R pairs of celltype #288

caiquanyou opened this issue Mar 17, 2024 · 1 comment

Comments

@caiquanyou
Copy link

How does stlearn calculates the number of L-R pairs of celltype? which part I should usor any code for tutorial.
For example, I run st.tl.cci.run_cci, and how could I get total interactive LR pair of cell A and cell B

@duypham2108
Copy link
Collaborator

You can check the description of the function here. I am not sure I got your question right, but you can set the sig_spots=0 and lower other parameters like min_spots

################################################################################
# Functions for calling Celltype-Celltype interactions #
################################################################################
def run_cci(
adata: AnnData,
use_label: str,
spot_mixtures: bool = False,
min_spots: int = 3,
sig_spots: bool = True,
cell_prop_cutoff: float = 0.2,
p_cutoff: float = 0.05,
n_perms: int = 100,
n_cpus: int = 1,
verbose: bool = True,
):
"""Calls significant celltype-celltype interactions based on cell-type data randomisation.
Parameters
----------
adata: AnnData
Must have had st.tl.cci_rank.run() called prior.
use_label: str
If !spot_mixtures, is a key in adata.obs, else key in adata.uns.
Note if spot_mixtures specified, must have both the deconvolution data
in adata.uns[use_label] and the dominant cell type per spot stored in
adata.obs[use_label]. See tutorial for example.
spot_mixtures: bool
If true, indicates using deconvolution data, hence use_label
refers to adata.uns.
min_spots: int
Specifies the minimum number of spots where LR score present to
include in subsequent analysis.
sig_spots: bool
If true, only consider edges which include a signficant spot from
calling st.tl.cci.run()
cell_prop_cutoff: float
Only relevant if spot_mixtures==True, indicates cutoff where cell type
considered found in spot.
p_cutoff: float
Value at which p is considered significant.
n_perms: int
Number of randomisations of cell data to generate p-values.
If set to 0, then performs no permutations, but still does perform
raw counting of the cell type interactions with each LR hotspot. This
can still be visualised downstream by setting paramters to plot
significant interactions to false.
n_cpus: int
cpu resources to use.
verbose: bool
True if print dialogue to user during run-time.
Returns
-------
adata: AnnData
Relevant information stored
adata.uns['lr_summary']
Additional columns; f"n_cci_sig_{use_label}",
f"n-spot_cci_{use_label}", f"n-spot_cci_sig_{use_label}".
Former is the no. of CCIs significant for the LR, middle is
the no. of individual spot-spot interactions across all CCIs for
LR, and latter is the no. of significant individual spot
interactions.
adata.uns
Dataframes added:
f"lr_cci_raw_{use_label}"
The raw count of spot-spot interactions across all LR
pairs for each possible CCI.
f"lr_cci_raw_{use_label}"
The count of significant spot-spot interactions across
all LR pairs for each possible CCI.
Dictionaries added:
f"per_lr_cci_pvals_{use_label}"
Each key refers to a LR, with the value being a dataframe
listing the p-values for each potential CCI.
f"per_lr_cci_raw_{use_label}"
Each key refers to a LR, with the value being a dataframe
listing the count of spot-spot interactions via the LR in
significant LR neighbourhoods stratified by each
celltype-celltype combination.
f"per_lr_cci_{use_label}"
The same as f"per_lr_cci_raw_{use_label}", except
subsetted to significant CCIs.
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants