cycombinepy.correct_data¶
- cycombinepy.correct_data(adata, label_key='cycombine_som', markers=None, batch_key='batch', covar=None, anchor=None, parametric=True, ref_batch=None, layer=None, out_layer='cycombine_corrected', copy=False, return_report=False, uns_key='cycombinepy_correction', error_policy='raise', confound_policy='raise')[source]¶
Per-cluster ComBat batch correction.
- Parameters:
adata (
AnnData) – AnnData with a cluster label inadata.obs[label_key]and a batch inadata.obs[batch_key].label_key (
str) – Column inadata.obswith the SOM cluster id (fromcreate_som()).markers (
Optional[Iterable[str]]) – Var names to correct. IfNone, usescycombinepy.get_markers().batch_key (
str) – Column inadata.obsgiving the batch assignment.covar (
str|None) – Optionaladata.obscolumns used as ComBat covariates. Skew- and confound-detection follow the R logic at lines 455-506.anchor (
str|None) – Optionaladata.obscolumns used as ComBat covariates. Skew- and confound-detection follow the R logic at lines 455-506.parametric (
bool) – Parametric vs. non-parametric ComBat prior.ref_batch – Optional reference batch that is kept unchanged.
layer (
str|None) – If given, read the uncorrected matrix from this layer rather thanX.out_layer (
str) – Name of the layer to store the corrected matrix in.copy (
bool) – If True, return a corrected copy; otherwise mutate in place.return_report (
bool) – If True, return the correction report dict. Withcopy=True, returns(adata, report).uns_key (
str) – Key inadata.unswhere the correction report is stored.error_policy (
Literal['raise','report','warn']) – How to handle ComBat exceptions: raise, record in the report, or warn and record in the report.confound_policy (
Literal['raise','skip','drop']) – How to handle requested covariates that are confounded or dropped by the effective design logic.
- Return type: