mantispy.tl.cluster_composition#
- mantispy.tl.cluster_composition(adata, cluster_key='leiden', by=('Metadata_Plate', 'Metadata_Well'), reference='negcon')[source]#
Fraction of each well’s cells in each cluster, as a well-level object.
- Parameters:
adata (
AnnData) – Clustered single-cell object.cluster_key (
str(default:'leiden')) –obscolumn holding the cluster label.by (
Sequence[str] |str(default:('Metadata_Plate', 'Metadata_Well'))) – Columns defining a row of the result, normally the well.reference (
str|None(default:'negcon')) – Controls to test each well’s composition against, orNoneto skip the test.
- Return type:
- Returns:
A new object with wells as rows and clusters as columns, holding the fraction of each well’s cells in each cluster. It is a well-level mantispy object, so
map(),normalize()and the plots accept it.uns["mantispy"]["composition_test"]holds a chi-square test of each well against the pooled control composition.
Notes
A well with few cells has a noisy composition. The chi-square test is computed on counts and accounts for this, but the fractions in
Xdo not. Filter withwell_qc()first.