nichecompass.nn.FCOmicsFeatureDecoder

class nichecompass.nn.FCOmicsFeatureDecoder(modality, entity, n_prior_gp_input, n_addon_gp_input, n_cat_covariates_embed_input, n_output, n_layers, recon_loss)

Fully connected omics feature decoder class.

Takes the latent space features z as input, and has a fully connected layer to decode the parameters of the underlying omics feature distributions.

Parameters:
  • modality (Literal['rna', 'atac']) – Omics modality that is decoded. Can be either rna or atac.

  • entity (Literal['target', 'source']) – Entity that is decoded. Can be either target or source.

  • n_prior_gp_input (int) – Number of maskable prior gp input nodes to the decoder (maskable latent space dimensionality).

  • n_addon_gp_input (int) – Number of non-maskable add-on gp input nodes to the decoder ( non-maskable latent space dimensionality).

  • n_cat_covariates_embed_input (int) – Number of categorical covariates embedding input nodes to the decoder (categorical covariates embedding dimensionality).

  • n_output (int) – Number of output nodes from the decoder (number of omics features).

  • n_layers (int) – Number of fully connected layers used for decoding.

  • recon_loss (Literal['nb']) – The loss used for omics reconstruction. If nb, uses a negative binomial loss.

Methods table

forward(z, log_library_size[, ...])

Forward pass of the fully connected omics feature decoder.

Methods

FCOmicsFeatureDecoder.forward(z, log_library_size, cat_covariates_embed=None, **kwargs)

Forward pass of the fully connected omics feature decoder.

Parameters:
  • z (Tensor) – Tensor containing the latent space features.

  • log_library_size (Tensor) – Tensor containing the log library size of the nodes.

  • dynamic_mask – Dynamic mask that can change in each forward pass. Is used for atac modality. If a gene is removed by regularization in the rna decoder (its weight is set to 0), the corresponding peaks will be marked as 0 in the dynamic_mask.

  • cat_covariates_embed (Optional[Tensor] (default: None)) – Tensor containing the categorical covariates embedding (all categorical covariates embeddings concatenated into one embedding).

Return type:

Tensor

Returns:

nb_means: The mean parameters of the negative binomial distribution.