candle.P1_utils.combat_batch_effect_removal

candle.P1_utils.combat_batch_effect_removal#

candle.P1_utils.combat_batch_effect_removal(data, batch_labels, model=None, numerical_covariates=None)#

This function corrects for batch effect in data.

Parameters:
  • data – pandas data frame of numeric values, with a size of (n_features, n_samples)

  • batch_labels – pandas series, with a length of n_samples. It should provide the batch labels of samples. Its indices are the same as the column names (sample names) in “data”.

  • model – an object of patsy.design_info.DesignMatrix. It is a design matrix describing the covariate information on the samples that could cause batch effects. If not provided, this function will attempt to coarsely correct just based on the information provided in “batch”.

  • numerical_covariates – a list of the names of covariates in “model” that are numerical rather than categorical.

Returns:

pandas data frame of numeric values, with a size of (n_features, n_samples). It is the data with batch effects corrected.