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)#
Transfer NMF gene loadings from an extracellular RNA dataset to a cellular dataset.
Computes the cellular
Wmatrix by multiplying the cellular gene expression values with the filteredHmatrix (gene loadings) from the extracellular NMF results, restricted to genes shared between both datasets.- 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.AnnData The input
adata_annotated_cellularobject with the calculated NMF factors (Wmatrix) added as a DataFrame toadata.obsm["factors"], and each factor also added as an individual columnNMF_factor_1,NMF_factor_2, … inadata.obs.