mantispy.pp.sphere#
- mantispy.pp.sphere(adata, method='ZCA-cor', reference='negcon', epsilon=1e-06, by=None, key_added=None, copy=False)[source]#
Whiten profiles with a transform fitted on the reference rows.
- Parameters:
adata (
AnnData) – Object to sphere. Usually well-level profiles.method (
str(default:'ZCA-cor')) –"ZCA"and"ZCA-cor"rotate back into the original feature basis, so the output columns still correspond to features andvarstill describes them."PCA"and"PCA-cor"return principal components, whichvarno longer describes, and warn about it unlesskey_addedis set. The-corvariants whiten the correlation instead of the covariance, so high-variance features do not dominate.reference (
str|None(default:'negcon')) – Rows to fit on:"negcon"for the controls,Nonefor everything, or the name of a booleanobscolumn.epsilon (
float|str(default:1e-06)) – Regularization added to the singular values, or"auto"to pick it from the data."auto"scores each candidate by the mean of its activity and replicability mAP on the transformed profiles and keeps the argmax, starting from the jump-profiling-recipe grid and then sampling past both ends and between points when the best sits there, so the chosen value can fall outside the recipe’s range. It needs copairs,Metadata_Perturbation,Metadata_Plateand a negcon reference; the search is global, sobyonly changes how the chosen value is applied. Every candidate, its score and the chosen value are written touns["mantispy"]["sphere_epsilon"].by (
str|None(default:None)) – Fit and apply separately within each group of this column, e.g. per batch.key_added (
str|None(default:None)) – Write tolayers[key_added]instead of overwritingX.copy (
bool(default:False)) – Return a modified copy instead of mutating in place.
- Return type:
- Returns:
None, or the modified copy. WritesXorlayers[key_added].- Raises:
ImportError –
epsilon="auto"was asked but copairs, the extra the sweep scores with, is not installed.ValueError – If
methodis unknown,epsilonis neither a float nor"auto",referenceselects no rows, a group has fewer than two reference rows, the reference holds missing or infinite values, a-cormethod meets a zero-variance feature, the reference matrix is not full rank,epsilon="auto"is asked without the columns and reference the sweep needs, or everyepsilon="auto"candidate scored non-finite.