mantispy.pp.outliers#
- mantispy.pp.outliers(adata, method='ecod', contamination=0.01, score_cutoff=None, key='selected', by=None, seed=0, key_added='qc_outlier', copy=False)[source]#
Flag outlying cells.
Every method produces a score where higher means more outlying, and the same thresholding applies to all of them, so
contaminationis the flagged fraction whichever method is used.- Parameters:
adata (
AnnData) – Object to flag.method (
str(default:'ecod')) –"ecod"is parameter-free and interpretable per feature,"isolation_forest"catches outliers defined by feature interactions, and"mad"takes the largest robust z-score across features, which is easy to explain but sees each feature alone.contamination (
float(default:0.01)) – Fraction of cells to flag. Ignored whenscore_cutoffis given.score_cutoff (
float|None(default:None)) – Threshold the score absolutely instead of by quantile. Withmethod="mad"the score is a robust z-score, soscore_cutoff=5gives the usual rule.key (
str|None(default:'selected')) – Restrict to features flagged by this booleanvarcolumn, usually"selected". Falls back to every feature when the column is absent.by (
str|None(default:None)) – Threshold within each group of thisobscolumn, e.g. per plate, rather than globally.seed (
int(default:0)) – Seed forisolation_forest.key_added (
str(default:'qc_outlier')) – Prefix for the outputs:obs[key_added]andobs[key_added + "_score"].copy (
bool(default:False)) – Return a modified copy instead of mutating in place.
- Return type:
- Returns:
None, or the modified copy.