mantispy.pp.feature_batch_sensitivity

mantispy.pp.feature_batch_sensitivity#

mantispy.pp.feature_batch_sensitivity(adata, batch_key='Metadata_Batch', threshold=0.05, key_added='batch', copy=False)#

Test each feature for dependence on the batch, after whatever correction was applied.

Parameters:
  • adata (AnnData) – Profiles to test.

  • batch_key (str (default: 'Metadata_Batch')) – obs column holding the batch, imaging week or plate.

  • threshold (float (default: 0.05)) – q-value below which a feature is called batch sensitive.

  • key_added (str (default: 'batch')) – Prefix for var[key_added + "_pvalue"], _qvalue and _sensitive.

  • copy (bool (default: False)) – Return a modified copy instead of mutating in place.

Return type:

AnnData | None

Returns:

None, or the modified copy. Writes var[key_added + "_pvalue"], var[key_added + "_qvalue"] and the boolean var[key_added + "_sensitive"].

Raises:

ValueError – If batch_key holds fewer than two batches.

Notes

Uses Kruskal-Wallis instead of ANOVA, because morphology features are not normally distributed and a few extreme wells should not decide the result. Expect a large fraction to come back sensitive, since per-plate centering does not remove plate structure: over BBBC021’s treated wells, 338 of 344 features still depend on the plate at q < 0.05 after per-plate normalization, and rohban2017 and pki are similar.

Compare the sensitive fraction before and after a correction.