rectanglepy.tl.deconvolution

rectanglepy.tl.deconvolution(signatures, bulks, correct_mrna_bias=True, n_cpus=None)

Performs recursive deconvolution using rectangle signatures and bulk data.

Parameters:
  • signatures (RectangleSignatureResult) – The rectangle signature result containing the signature data and results.

  • bulks (pandas.DataFrame) – The tpm normalized bulk data for deconvolution. Rows are samples and columns are genes.

  • correct_mrna_bias (bool) – A flag indicating whether to correct for mRNA bias. Defaults to True.

  • n_cpus (int) – The number of CPUs to use for parallel processing. If not provided, the function will use all available CPUs. Each CPU will process a bulk sample.

Return type:

DataFrame

Returns:

-estimation_df (DataFrame)

A DataFrame containing the estimated cell fractions. Each row represents a sample, each column represents a cell type (including ‘Unknown’ if applicable).

-bulk_err_df (DataFrame)

A DataFrame containing the gene-level difference between the true bulk expression and the reconstructed bulk expression (i.e., bulk - bulk_est) for each sample.