This function rescales imputed data using one of two methods. The "classic" method rescales the imputed data as in the original implementation. The "adaptive" method adjusts rescaling factors for each gene using only cells with a non-zero expression value.

rescale_data(data, imputed_data, rescale_percent, rescale_method)

Arguments

data

The original unimputed expression matrix where cells correspond to rows and genes correspond to columns

imputed_data

Unscaled imputed data where cells corrsponnd to rows and genes correspond to columns

rescale_percent

Percentile used to rescale imputed data.

rescale_method

A string specifying one of three rescale methods: "adaptive" or "classic" The "classic" method performs rescaling as in the original version of MAGIC: rescaling factors are computed using the given percentile of the original and imputed data or the max if the data is zero at the given percentile. The "adaptive" method adjusts the rescale percentile for each gene between recale_percent and 100 based on the number of non-zero data points.

Value

A cell by gene matrix with the rescaled imputed gene expression values.

Author

Kevin Brulois