nichesphere.coloc.getColocProbs

Contents

nichesphere.coloc.getColocProbs#

nichesphere.coloc.getColocProbs(CTprobs: DataFrame, spotSamples: Series, spotweights: Series = None) → DataFrame#

Vectorized calculation of cell type pair co-localization probabilities per sample (sum across spots of probabilities of each cell type pair being in the same spot)

Parameters:
  • CTprobs (pd.DataFrame) – Dataframe of cell type probabilities per spot

  • spotSamples (pd.Series) – Series indicating the sample to which each spot belongs, with spot ids as index.

  • spotweights (pd.Series (default: None)) – Series of weights per spot with spot ids as index.

Returns:

CTcolocalizationP – concatenated dataframes of cell type pairs co-localization probabilities per sample

Return type:

pd.DataFrame