batch_correct

besca.tl.bcor.batch_correct(adata, batch_to_correct)[source]

function to perform batch correction

mnnpy batch correction with the batch specified by batch_to_correct using all the genes contained in adata. Before running this function the highly variable genes should be selected.

This function will return a corrected AnnData object without any .raw! please use the function postprocess_mnnpy to generate a complete AnnData object which contains the corrected values and the original raw. Because of this pleae ensure that you do not save the output of this function to the variable adata!

Parameters:
  • adata (AnnData) – AnnData objec that is to be batch corrected

  • batch_to_correct ('str') – string identifiyng the column which contains the batches that are to be corrected

  • returns

  • AnnData – the corrected AnnData object (raw values have been truncated to the highly variable genes)