Methods

The deconomix.methods submodule provides the models for DTD and ADTD and the respective methods to train them.

DTD Class

class deconomix.methods.DTD(X_mat: DataFrame, Y_mat: DataFrame, C_mat: DataFrame)

Class that implements Digital Tissue Deconvolution via Loss-function Learning

Attributes

X_matpd.DataFrame

Single cell reference matrix X containing (average) profiles as columns per celltype. Shape: genes x celltypes

Y_matpd.DataFrame

Y matrix containing the generated artificial bulk profiles. Shape: genes x n_mixtures

C_matpd.DataFrame

C matrix containing the relative composition of the bulk mixtures in Y. Shape: cell types x n_mixtures

run(iterations=1000, plot=False, path_plot=None, func='pearson')

Function that executes the training of a DTD model and saves the results in the model attributes.

Parameters

iterationsint

How many training steps should be conducted.

plotbool

Whether to plot the development of loss-values during the training.

Updates Attributes

gamma: pd.DataFrame

gene weights resulting form the training. Shape: genes x 1

losses: list

list of loss per training step.

ADTD Class

class deconomix.methods.ADTD(X_mat: DataFrame, Y_mat: DataFrame, gamma: DataFrame, lambda1: float = 1.0, lambda2: float = 1.0, max_iterations: int = 200, eps: float = 1e-08, C_static: bool = False, Delta_static: bool = False, gamma_offset: bool = True, delta_stepsize: int = 1)

Class that implements the Adaptive Digital Tissue Deconvolution algorithm.

Attributes

X_matpd.DataFrame

Single cell reference matrix X containing (average) profiles as columns per celltype. Shape: genes x celltypes

Y_matpd.DataFrame

Y matrix containing bulk profiles. Shape: genes x n_mixtures

gammapd.DataFrame

gene weights. Shape: genes x 1

max_iterationsint

Maximum amount of optimization steps.

lambda1float

Hyperparameter for cellular composition estimation.

lambda2float

Hyperparameter for reference profile adaption (gene regulation).

epsfloat

Stopping criterion based on error.

C_staticbool

Whether cellular composition shall be optimized.

Delta_staticbool

Whether reference profile adaption shall be optimized.

run(verbose=True)

Fit an ADTD model

Attributes

verbosebool

Wether progress bar should be shown during training (default) or not (silent mode).

Updates Attributes

C_estpd.DataFrame

Estimated contribution of the referenced cell types in X to the composition of mixtures in Y. Shape: referenced cell types x mixtures

c_estpd.DataFrame

Estimated contribution of the hidden background to the composition of mixtures in Y. Shape: 1 x mixtures

x_estpd.DataFrame

Estimated consensus hidden background profile. Shape: genes x 1

Delta_estpd.DataFrame

Estimated element-wise adaption factors for the reference matrix X (gene regulation). Shape: genes x referenced cell types (same shape as X)

setup()

Still needed due to reasonable estimate for x. Random initialization may be possible.

update_C0()

Calculate C0 with with lambda1=0 and lambda2->inf. Reasoning that lambda1->inf yields DTD solution no longer holds.