mantispy.pp.feature_reproducibility

mantispy.pp.feature_reproducibility#

mantispy.pp.feature_reproducibility(adata, groupby='Metadata_Perturbation', min_icc=0.2, key_added='icc', copy=False)#

Score each feature by how consistently replicates of a perturbation agree on it.

A feature that varies only within replicate groups is noise, however large its variance. The intraclass correlation is the share of variance that lies between groups, which a variance filter does not measure.

Parameters:
  • adata (AnnData) – Profiles with several replicates per group, at well or perturbation resolution.

  • groupby (str (default: 'Metadata_Perturbation')) – obs column whose groups are the replicate sets.

  • min_icc (float (default: 0.2)) – Threshold for the boolean column. See the Notes on choosing it.

  • key_added (str (default: 'icc')) – var[key_added] holds the ICC; var[key_added + "_selected"] the flag.

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

Return type:

AnnData | None

Returns:

None, or the modified copy. Writes the ICC to var[key_added] and the flag to var[key_added + "_selected"].

Raises:

ValueError – If groupby has a single group, so that no variance can lie between groups.

Notes

Filtering on ICC raised replicate-retrieval mAP on all three packaged screens: bbbc021 from 0.121 to 0.141 (ICC > 0.2) and 0.162 (> 0.4), rohban2017 from 0.097 to 0.143 and 0.136, and pki from 0.178 to 0.192 and 0.200. The best cutoff differs by dataset, so 0.2 is a conservative default; choose one from the distribution in var[key_added].

ICC filtering can hurt other tasks. On BBBC021, not-same-compound MOA retrieval fell from 0.777 over all features to 0.767 at ICC > 0.2 and 0.757 at 0.4. ICC measures reproducibility within a treatment, which is a different property from agreement between compounds that share a mechanism.