pycallingcards.tools.diff2group_bygroup#

pycallingcards.tools.diff2group_bygroup(adata_cc, groupby, name1, name2=None, peakname=None, test_method='fisher_exact', alternative='greater')[source]#

Compare the peak difference between two groups for specific peak by group.

Parameters:
  • adata_cc (AnnData) – Annotated data matrix.

  • groupby (str) – The key in adata_cc of the observation groups to consider.

  • name1 (str) – The name of the first group.

  • name2 (Optional[str] (default: None)) – The name of the second group.

  • peakname (Optional[str] (default: None)) – The name of the peak used for comparing.

  • test_method (Optional[Literal['binomtest', 'binomtest2', 'fisher_exact']] (default: 'fisher_exact')) – binomtest uses binomial test, binomtest2 uses binomial test but stands on a different hypothesis of binomtest, fisher_exact uses fisher exact test.

  • alternative (Optional[Literal['two-sided', 'greater']] (default: 'greater')) – If it has two clusters, ‘two-sided’ is recommended. Otherwise, please use ‘greater’.

Return type:

Union[List[float], float]

Returns:

Pvalue for the specific hypothesis.

Example:

>>> import pycallingcards as cc
>>> adata_cc = cc.datasets.mousecortex_data(data="CC")
>>> cc.tl.diff2group_bygroup(adata_cc, 'cluster', 'Neuron_Excit_L5_Mixed','Astrocyte','chr2_28188592_28188996')