troutpy.pl.apply_exrnaH_to_cellular_to_create_cellularW

troutpy.pl.apply_exrnaH_to_cellular_to_create_cellularW#

troutpy.pl.apply_exrnaH_to_cellular_to_create_cellularW(adata_extracellular_with_nmf, adata_annotated_cellular)#

Transfers the gene loadings (H matrix) derived from extracellular RNA analysis to a cellular dataset. It calculates the new W matrix for cellular data by multiplying the gene expression values of the cellular dataset with the filtered H matrix.

Parameters:
  • adata_extracellular_with_nmf (anndata.AnnData) – An AnnData object containing the extracellular RNA data with the NMF results. The H matrix is expected to be stored in adata.uns['H_nmf'].

  • adata_annotated_cellular (anndata.AnnData) – An AnnData object containing the cellular RNA data with annotated gene expression values.

Returns:

AnnData. The input adata_annotated_cellular object with the following updates. Adds the calculated NMF factors (W matrix) as a DataFrame to adata.obsm['factors'].Adds each NMF factor as individual columns in adata.obs with names NMF_factor_1, NMF_factor_2, etc.