Last updated: 2024-04-05

Checks: 7 0

Knit directory: misc/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(1) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 8b7bab0. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.RData
    Ignored:    analysis/.Rhistory
    Ignored:    analysis/ALStruct_cache/
    Ignored:    data/.Rhistory
    Ignored:    data/methylation-data-for-matthew.rds
    Ignored:    data/pbmc/
    Ignored:    data/pbmc_purified.RData

Untracked files:
    Untracked:  .dropbox
    Untracked:  Icon
    Untracked:  analysis/GHstan.Rmd
    Untracked:  analysis/GTEX-cogaps.Rmd
    Untracked:  analysis/PACS.Rmd
    Untracked:  analysis/Rplot.png
    Untracked:  analysis/SPCAvRP.rmd
    Untracked:  analysis/admm_02.Rmd
    Untracked:  analysis/admm_03.Rmd
    Untracked:  analysis/cache/
    Untracked:  analysis/cholesky.Rmd
    Untracked:  analysis/compare-transformed-models.Rmd
    Untracked:  analysis/cormotif.Rmd
    Untracked:  analysis/cp_ash.Rmd
    Untracked:  analysis/eQTL.perm.rand.pdf
    Untracked:  analysis/eb_prepilot.Rmd
    Untracked:  analysis/eb_var.Rmd
    Untracked:  analysis/ebpmf1.Rmd
    Untracked:  analysis/ebpmf_sla_text.Rmd
    Untracked:  analysis/ebspca_sims.Rmd
    Untracked:  analysis/explore_psvd.Rmd
    Untracked:  analysis/fa_check_identify.Rmd
    Untracked:  analysis/fa_iterative.Rmd
    Untracked:  analysis/flash_test_tree.Rmd
    Untracked:  analysis/flash_tree.Rmd
    Untracked:  analysis/flashier_newgroups.Rmd
    Untracked:  analysis/flashier_nmf_triples.Rmd
    Untracked:  analysis/flashier_pbmc.Rmd
    Untracked:  analysis/flashier_snn_shifted_prior.Rmd
    Untracked:  analysis/greedy_ebpmf_exploration_00.Rmd
    Untracked:  analysis/ieQTL.perm.rand.pdf
    Untracked:  analysis/lasso_em_03.Rmd
    Untracked:  analysis/m6amash.Rmd
    Untracked:  analysis/mash_bhat_z.Rmd
    Untracked:  analysis/mash_ieqtl_permutations.Rmd
    Untracked:  analysis/methylation_example.Rmd
    Untracked:  analysis/mixsqp.Rmd
    Untracked:  analysis/mr.ash_lasso_init.Rmd
    Untracked:  analysis/mr.mash.test.Rmd
    Untracked:  analysis/mr_ash_modular.Rmd
    Untracked:  analysis/mr_ash_parameterization.Rmd
    Untracked:  analysis/mr_ash_ridge.Rmd
    Untracked:  analysis/mv_gaussian_message_passing.Rmd
    Untracked:  analysis/nejm.Rmd
    Untracked:  analysis/nmf_bg.Rmd
    Untracked:  analysis/normal_conditional_on_r2.Rmd
    Untracked:  analysis/normalize.Rmd
    Untracked:  analysis/pbmc.Rmd
    Untracked:  analysis/pca_binary_weighted.Rmd
    Untracked:  analysis/pca_l1.Rmd
    Untracked:  analysis/poisson_nmf_approx.Rmd
    Untracked:  analysis/poisson_shrink.Rmd
    Untracked:  analysis/poisson_transform.Rmd
    Untracked:  analysis/pseudodata.Rmd
    Untracked:  analysis/qrnotes.txt
    Untracked:  analysis/ridge_iterative_02.Rmd
    Untracked:  analysis/ridge_iterative_splitting.Rmd
    Untracked:  analysis/samps/
    Untracked:  analysis/sc_bimodal.Rmd
    Untracked:  analysis/shrinkage_comparisons_changepoints.Rmd
    Untracked:  analysis/susie_cov.Rmd
    Untracked:  analysis/susie_en.Rmd
    Untracked:  analysis/susie_z_investigate.Rmd
    Untracked:  analysis/svd-timing.Rmd
    Untracked:  analysis/temp.RDS
    Untracked:  analysis/temp.Rmd
    Untracked:  analysis/test-figure/
    Untracked:  analysis/test.Rmd
    Untracked:  analysis/test.Rpres
    Untracked:  analysis/test.md
    Untracked:  analysis/test_qr.R
    Untracked:  analysis/test_sparse.Rmd
    Untracked:  analysis/tree_dist_top_eigenvector.Rmd
    Untracked:  analysis/z.txt
    Untracked:  code/multivariate_testfuncs.R
    Untracked:  code/rqb.hacked.R
    Untracked:  data/4matthew/
    Untracked:  data/4matthew2/
    Untracked:  data/E-MTAB-2805.processed.1/
    Untracked:  data/ENSG00000156738.Sim_Y2.RDS
    Untracked:  data/GDS5363_full.soft.gz
    Untracked:  data/GSE41265_allGenesTPM.txt
    Untracked:  data/Muscle_Skeletal.ACTN3.pm1Mb.RDS
    Untracked:  data/P.rds
    Untracked:  data/Thyroid.FMO2.pm1Mb.RDS
    Untracked:  data/bmass.HaemgenRBC2016.MAF01.Vs2.MergedDataSources.200kRanSubset.ChrBPMAFMarkerZScores.vs1.txt.gz
    Untracked:  data/bmass.HaemgenRBC2016.Vs2.NewSNPs.ZScores.hclust.vs1.txt
    Untracked:  data/bmass.HaemgenRBC2016.Vs2.PreviousSNPs.ZScores.hclust.vs1.txt
    Untracked:  data/eb_prepilot/
    Untracked:  data/finemap_data/fmo2.sim/b.txt
    Untracked:  data/finemap_data/fmo2.sim/dap_out.txt
    Untracked:  data/finemap_data/fmo2.sim/dap_out2.txt
    Untracked:  data/finemap_data/fmo2.sim/dap_out2_snp.txt
    Untracked:  data/finemap_data/fmo2.sim/dap_out_snp.txt
    Untracked:  data/finemap_data/fmo2.sim/data
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.config
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.k
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.k4.config
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.k4.snp
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.ld
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.snp
    Untracked:  data/finemap_data/fmo2.sim/fmo2.sim.z
    Untracked:  data/finemap_data/fmo2.sim/pos.txt
    Untracked:  data/logm.csv
    Untracked:  data/m.cd.RDS
    Untracked:  data/m.cdu.old.RDS
    Untracked:  data/m.new.cd.RDS
    Untracked:  data/m.old.cd.RDS
    Untracked:  data/mainbib.bib.old
    Untracked:  data/mat.csv
    Untracked:  data/mat.txt
    Untracked:  data/mat_new.csv
    Untracked:  data/matrix_lik.rds
    Untracked:  data/paintor_data/
    Untracked:  data/running_data_chris.csv
    Untracked:  data/running_data_matthew.csv
    Untracked:  data/temp.txt
    Untracked:  data/y.txt
    Untracked:  data/y_f.txt
    Untracked:  data/zscore_jointLCLs_m6AQTLs_susie_eQTLpruned.rds
    Untracked:  data/zscore_jointLCLs_random.rds
    Untracked:  explore_udi.R
    Untracked:  output/fit.k10.rds
    Untracked:  output/fit.nn.pbmc.purified.rds
    Untracked:  output/fit.nn.rds
    Untracked:  output/fit.nn.s.001.rds
    Untracked:  output/fit.nn.s.01.rds
    Untracked:  output/fit.nn.s.1.rds
    Untracked:  output/fit.nn.s.10.rds
    Untracked:  output/fit.snn.s.001.rds
    Untracked:  output/fit.snn.s.01.nninit.rds
    Untracked:  output/fit.snn.s.01.rds
    Untracked:  output/fit.varbvs.RDS
    Untracked:  output/fit2.nn.pbmc.purified.rds
    Untracked:  output/glmnet.fit.RDS
    Untracked:  output/snn07.txt
    Untracked:  output/snn34.txt
    Untracked:  output/test.bv.txt
    Untracked:  output/test.gamma.txt
    Untracked:  output/test.hyp.txt
    Untracked:  output/test.log.txt
    Untracked:  output/test.param.txt
    Untracked:  output/test2.bv.txt
    Untracked:  output/test2.gamma.txt
    Untracked:  output/test2.hyp.txt
    Untracked:  output/test2.log.txt
    Untracked:  output/test2.param.txt
    Untracked:  output/test3.bv.txt
    Untracked:  output/test3.gamma.txt
    Untracked:  output/test3.hyp.txt
    Untracked:  output/test3.log.txt
    Untracked:  output/test3.param.txt
    Untracked:  output/test4.bv.txt
    Untracked:  output/test4.gamma.txt
    Untracked:  output/test4.hyp.txt
    Untracked:  output/test4.log.txt
    Untracked:  output/test4.param.txt
    Untracked:  output/test5.bv.txt
    Untracked:  output/test5.gamma.txt
    Untracked:  output/test5.hyp.txt
    Untracked:  output/test5.log.txt
    Untracked:  output/test5.param.txt

Unstaged changes:
    Modified:   .gitignore
    Modified:   analysis/flashier_log1p.Rmd
    Modified:   analysis/flashier_sla_text.Rmd
    Modified:   analysis/mr_ash_pen.Rmd
    Modified:   analysis/susie_flash.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/flashier_pbmc_purified.Rmd) and HTML (docs/flashier_pbmc_purified.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 8b7bab0 Matthew Stephens 2024-04-05 workflowr::wflow_publish("flashier_pbmc_purified.Rmd")
html 059e85c Matthew Stephens 2024-04-04 Build site.
Rmd cb16e70 Matthew Stephens 2024-04-04 workflowr::wflow_publish("flashier_pbmc_purified.Rmd")

Introduction

I run flashier (sparse EBNMF) on the purified pbmcs. I use some code from Eric Weine to plot the results.

library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(tidyr)
library(purrr)
library(stringr)
library(Matrix)

Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':

    expand, pack, unpack
library(flashier)
Loading required package: ebnm
Loading required package: magrittr

Attaching package: 'magrittr'
The following object is masked from 'package:purrr':

    set_names
The following object is masked from 'package:tidyr':

    extract
library(ggplot2)

Load the data (in a sparse matrix called counts)

load("../data/pbmc_purified.RData")
lcounts = counts
lcounts@x = log(counts@x + 1)

Run flashier

fit1 = flash(lcounts,S = 0.01, ebnm_fn = ebnm_point_exponential, var_type = 2)
Adding factor 1 to flash object...
Adding factor 2 to flash object...
Adding factor 3 to flash object...
Adding factor 4 to flash object...
Adding factor 5 to flash object...
Adding factor 6 to flash object...
Adding factor 7 to flash object...
Adding factor 8 to flash object...
Adding factor 9 to flash object...
Adding factor 10 to flash object...
Adding factor 11 to flash object...
Adding factor 12 to flash object...
Adding factor 13 to flash object...
Adding factor 14 to flash object...
Adding factor 15 to flash object...
Adding factor 16 to flash object...
Adding factor 17 to flash object...
Adding factor 18 to flash object...
Adding factor 19 to flash object...
Factor doesn't significantly increase objective and won't be added.
Wrapping up...
Done.
Nullchecking 18 factors...
Done.
saveRDS(fit1,file='../output/fit.nn.pbmc.purified.rds')

Note that the first factor is “intercept-like”, capturing library size and some kind of background expression,

plot(fit1$L_pm[,1],rowSums(lcounts),main="loadings for factor 1 vs rowSums of lcounts")

Version Author Date
059e85c Matthew Stephens 2024-04-04

Here I am using Eric’s code to plot a heatmap of the results, ordered by cell type

FF_log1p = fit1$L_pm
FF_log1p <- scale(FF_log1p, center = FALSE, scale = apply(FF_log1p, 2, max))
colnames(FF_log1p) <- paste0("k", 1:ncol(FF_log1p))

cell.type <- samples$celltype

# Downsample the number of cells and sort them using tSNE.
set.seed(8675309)
cell.idx <- numeric(0)
cell.types <- levels(cell.type)
for (i in 1:length(cell.types)) {
  which.idx <- which(cell.type == cell.types[i])
  # Downsample common cell types.
  if (length(which.idx) > 1250) {
    which.idx <- sample(which.idx, 1250)
  }
  # Don't include rare cell types.
  if (length(which.idx) > 20) {
    # Sort using tsne.
    tsne.res <- Rtsne::Rtsne(
      FF_log1p[which.idx, ],
      dims = 1,
      pca = FALSE,
      normalize = FALSE,
      perplexity = min(100, floor((length(which.idx) - 1) / 3) - 1),
      theta = 0.1,
      max_iter = 1000,
      eta = 200,
      check_duplicates = FALSE
    )$Y[, 1]
    which.idx <- which.idx[order(tsne.res)]
    cell.idx <- c(cell.idx, which.idx)
  }
}

cell.type <- cell.type[cell.idx]
cell.type <- droplevels(cell.type)

FF_log1p <- FF_log1p[cell.idx, ]

make.heatmap.tib <- function(FF) {
  tib <- as_tibble(scale(FF, center = FALSE, scale = apply(FF, 2, max))) %>%
    mutate(Cell.type = cell.type) %>%
    arrange(Cell.type) %>%
    mutate(Cell.idx = row_number())
  
  tib <- tib %>%
    pivot_longer(
      -c(Cell.idx, Cell.type),
      names_to = "Factor",
      values_to = "Loading",
      values_drop_na = TRUE
    ) %>%
    mutate(Factor = as.numeric(str_extract(Factor, "[0-9]+")))
  
  return(tib)
}

log1p_tib <- make.heatmap.tib(FF_log1p)
heatmap.tib = log1p_tib

tib <- heatmap.tib %>%
  group_by(Cell.type, Cell.idx) %>%
  summarize()
`summarise()` has grouped output by 'Cell.type'. You can override using the
`.groups` argument.
cell_type_breaks <- c(1, which(tib$Cell.type[-1] != tib$Cell.type[-nrow(tib)]))
label_pos <- cell_type_breaks / 2 + c(cell_type_breaks[-1], nrow(tib)) / 2

plt <- ggplot(heatmap.tib, aes(x = Factor, y = -Cell.idx, fill = Loading)) +
  geom_tile() +
  scale_fill_gradient(low = "white", high = "firebrick") +
  labs(y = "") +
  scale_y_continuous(breaks = -label_pos,
                     minor_breaks = NULL,
                     labels = levels(cell.type)) +
  scale_x_continuous(breaks = seq(0, 30, 5)) +
  theme_minimal() +
  geom_hline(yintercept = -cell_type_breaks, size = 0.1) +
  theme(legend.position = "none", 
        strip.text = element_text(size = 16)) 
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
generated.
plt

Version Author Date
059e85c Matthew Stephens 2024-04-04

List driving genes:

for(k in 1:18){
  print(paste0("factor ",k))
  key = fit1$F_pm[,k]>1
  vals = fit1$F_pm[key,k]
  print(genes$symbol[key][order(vals,decreasing =TRUE)])
}
[1] "factor 1"
  [1] "MALAT1"    "RPL13"     "RPS2"      "RPL10"     "RPL13A"    "RPS6"     
  [7] "RPS18"     "B2M"       "RPS4X"     "RPL3"      "RPS27"     "RPS3"     
 [13] "RPS14"     "TMSB4X"    "RPL32"     "RPS19"     "RPL11"     "RPS12"    
 [19] "RPL18A"    "RPLP1"     "RPL19"     "RPLP2"     "RPL21"     "RPS3A"    
 [25] "RPS15"     "RPS15A"    "RPS27A"    "RPL15"     "RPL28"     "RPL12"    
 [31] "RPL23A"    "RPL18"     "RPL31"     "RPS8"      "TMSB10"    "RPL34"    
 [37] "RPS23"     "RPL27A"    "RPL26"     "RPS9"      "RPL6"      "RPL8"     
 [43] "RPL29"     "RPL7"      "RPL10A"    "RPS7"      "RPL9"      "RPL35A"   
 [49] "RPS5"      "RPS16"     "RPS25"     "RPL14"     "MT-CO1"    "RPS13"    
 [55] "RPL30"     "TPT1"      "RPL35"     "RPL5"      "RPL36"     "GNB2L1"   
 [61] "HLA-B"     "ACTB"      "RPL7A"     "EEF1A1"    "FAU"       "RPS28"    
 [67] "RPSA"      "FTL"       "PTMA"      "HLA-A"     "RPS20"     "UBA52"    
 [73] "RPLP0"     "RPL4"      "MT-CO3"    "RPL37A"    "FTH1"      "NACA"     
 [79] "RPS24"     "RPL37"     "RPL27"     "EIF1"      "EEF1D"     "MT-CO2"   
 [85] "PFN1"      "RPS26"     "HLA-C"     "RPL24"     "RPS11"     "MT-ND4"   
 [91] "MT-CYB"    "RPS10"     "EEF1B2"    "RPS21"     "COX4I1"    "ARHGDIB"  
 [97] "RPL38"     "CFL1"      "H3F3B"     "MT-ND1"    "RPS29"     "RPL36A"   
[103] "MT-ND2"    "ACTG1"     "PFDN5"     "BTF3"      "GLTSCR2"   "SERF2"    
[109] "LTB"       "SH3BGRL3"  "HNRNPA1"   "JUNB"      "NPM1"      "RPL23"    
[115] "RPL17"     "GAPDH"     "CD52"      "SLC25A6"   "PABPC1"    "UBC"      
[121] "CYBA"      "UBB"       "OAZ1"      "RPL22"     "RPL36AL"   "FXYD5"    
[127] "EEF2"      "LDHB"      "ATP5G2"    "S100A4"    "CD74"      "BTG1"     
[133] "ATP5E"     "ATP5L"     "DDX5"      "MYL6"      "RPL41"     "HLA-E"    
[139] "HINT1"     "MYL12A"    "MT-ATP6"   "TOMM7"     "EIF3K"     "CORO1A"   
[145] "YBX1"      "COX7C"     "CD37"      "PTPRCAP"   "VIM"       "COMMD6"   
[151] "S100A6"    "SRP14"     "ARPC3"     "GMFG"      "ZFAS1"     "IER2"     
[157] "CHCHD2"    "CIRBP"     "TMA7"      "SNRPD2"    "LIMD2"     "PSME1"    
[163] "EDF1"      "ITM2B"     "TMEM66"    "DUSP1"     "SRSF5"     "JUN"      
[169] "ARPC2"     "EIF3F"     "PPDPF"     "PPIA"      "C6orf48"   "RAC2"     
[175] "UQCRH"     "COX6B1"    "EIF3L"     "SSR2"      "HMGB1"     "HSP90AA1" 
[181] "CLIC1"     "EIF4A1"    "OST4"      "EIF3H"     "EMP3"      "ARPC1B"   
[187] "C19orf43"  "FOS"       "HNRNPA2B1" "GPSM3"     "TAGLN2"    "IFITM2"   
[193] "EIF3E"     "ATP5D"     "MYL12B"    "IL32"      "HLA-DRA"   "UQCR11"   
[199] "NAP1L1"    "MT-ND5"    "CALM1"     "HSPA8"     "HCST"      "MZT2B"    
[205] "NDUFA4"    "GYPC"      "EIF4A2"    "GSTP1"     "UXT"       "ALDOA"    
[211] "APRT"      "ENO1"      "CD3D"      "HSP90AB1"  "SSR4"      "ERP29"    
[217] "EIF3G"     "AES"       "CNBP"      "TXNIP"     "ATP5O"     "PNRC1"    
[223] "CD3E"      "LSP1"      "RBM3"      "PSMA7"     "GPX1"      "LAPTM5"   
[229] "SNHG7"     "VAMP8"     "CCNI"      "HMGN1"     "HNRNPDL"   "UBXN1"    
[235] "NOSIP"     "ATP6V1G1"  "SUMO2"     "CUTA"      "SOD1"      "HLA-DPB1" 
[241] "ARL6IP4"   "COX6C"     "PCBP2"     "TCEB2"     "HLA-DRB1"  "CD99"     
[247] "SERP1"     "COX5B"     "VAMP2"     "NDUFB11"   "HIGD2A"    "TPI1"     
[253] "S100A10"   "CD7"       "GPX4"      "CAPZB"     "ANP32B"    "SKP1"     
[259] "TSC22D3"   "UBL5"      "ZFP36L2"   "NEDD8"     "SF3B5"     "SLC25A3"  
[265] "CALM2"     "LAMTOR4"   "SLC25A5"   "EVL"       "C11orf31"  "SMDT1"    
[271] "NDUFS5"    "GIMAP7"    "C9orf16"   "ST13"      "SNHG8"     "NDUFA11"  
[277] "ANAPC16"   "AIF1"      "ATP5A1"    "PARK7"     "LSM7"      "ZFP36"    
[283] "COX6A1"    "COX7A2"    "PSME2"     "DRAP1"     "LY6E"      "HLA-DPA1" 
[289] "PRR13"     "SAP18"     "TSPO"      "ICAM3"     "NFKBIA"    "GSTK1"    
[295] "PEBP1"     "HNRNPA0"   "EID1"      "MIF"       "EIF3D"     "SRGN"     
[301] "RPSAP58"   "ATPIF1"    "SRSF3"     "UBE2D3"    "GTF3A"     "C19orf53" 
[307] "CD48"      "COPE"      "TMEM258"   "CD53"      "C12orf57"  "NDUFB9"   
[313] "NDUFA13"   "ATP6V0E1"  "TRAF3IP3"  "RPL39"     "LDHA"      "HNRNPK"   
[319] "MT-ND3"    "FBL"       "GUK1"      "JTB"       "ANXA1"     "NDUFB8"   
[325] "UCP2"      "COX5A"     "TRMT112"   "PSMB1"     "CCDC85B"   "PPP1CA"   
[331] "NDUFA1"    "UFC1"      "UQCRB"     "BRK1"      "TUBA1B"    "ATP5J"    
[337] "UBE2D2"    "COTL1"     "RSL1D1"    "POLR2L"    "IL2RG"     "RAN"      
[343] "RARRES3"   "YWHAB"     "NKG7"      "RNASET2"   "TRAPPC1"   "WDR83OS"  
[349] "SNX3"      "TPM3"      "ATP6V1F"   "GNLY"      "EIF3M"     "RHOA"     
[355] "PCBP1"     "KLF6"      "TALDO1"    "COX7A2L"   "NDUFB2"    "TUBA1A"   
[361] "PNISR"     "SERPINB1"  "SCAND1"    "HNRNPC"    "PPIB"      "SEPT7"    
[367] "UQCR10"    "TMBIM6"    "NBEAL1"    "MZT2A"     "ISCU"      "TSTD1"    
[373] "ATP5F1"    "ATP5G3"    "CTSW"      "ISG20"     "ATP5J2"    "SPCS1"    
[379] "UQCRQ"     "COX8A"     "SNRPB"     "MORF4L1"   "ACAP1"     "ATP5B"    
[385] "ATP5H"     "PRDX2"     "H2AFY"     "U2AF1"     "TBCA"      "TMEM59"   
[391] "ARPC5"     "BST2"      "SELL"      "SEC61B"    "RAC1"      "NHP2L1"   
[397] "RABAC1"    "MRPS21"    "CD63"      "DDT"       "PGK1"     
[1] "factor 2"
  [1] "AIF1"          "ZFAS1"         "RP11-620J15.3" "PRSS57"       
  [5] "SERPINB1"      "SNHG7"         "HSP90AB1"      "H2AFY"        
  [9] "TALDO1"        "SPINK2"        "CYTL1"         "SOX4"         
 [13] "EIF3E"         "TXN"           "UQCRB"         "GPX1"         
 [17] "TKT"           "SNHG8"         "EBPL"          "STMN1"        
 [21] "GSTP1"         "UQCRH"         "LYL1"          "HLA-DRA"      
 [25] "KIAA0125"      "MT-ND3"        "SNRPE"         "HMGA1"        
 [29] "LSM7"          "LST1"          "HINT1"         "CAT"          
 [33] "FCER1A"        "IMPDH2"        "EGFL7"         "LINC00493"    
 [37] "SNRPD1"        "NUCB2"         "LSMD1"         "RNF130"       
 [41] "C19orf77"      "HIST1H4C"      "APEX1"         "NGFRAP1"      
 [45] "ANP32B"        "HMGB1"         "COX6B1"        "RPL39"        
 [49] "SNRPF"         "C6orf48"       "TIMM13"        "HSD17B11"     
 [53] "COX5A"         "ENO1"          "DDAH2"         "NENF"         
 [57] "RPL22L1"       "IGFBP7"        "SH3BGRL"       "LINC00152"    
 [61] "EPB41L4A-AS1"  "SUMO2"         "EIF4A1"        "ESD"          
 [65] "NAP1L1"        "PRDX6"         "C14orf166"     "CD164"        
 [69] "COMT"          "EID1"          "SLC25A5"       "OSTC"         
 [73] "C14orf2"       "HSPD1"         "ATP5J"         "LSM2"         
 [77] "ATP5G3"        "VAMP8"         "PRDX1"         "RSL24D1"      
 [81] "TAF1D"         "SHFM1"         "ATP5C1"        "SLC25A3"      
 [85] "DYNLL1"        "HLA-DPB1"      "PSMA4"         "EIF3M"        
 [89] "TMEM256"       "TUBA1A"        "HIST1H1D"      "CLIC1"        
 [93] "ATP5A1"        "RSL1D1"        "YBX3"          "NDUFS4"       
 [97] "CD63"          "SF3B14"        "C7orf73"       "SNX3"         
[101] "NME4"          "HSBP1"         "SPINT2"        "CST3"         
[105] "RP11-354E11.2" "NDUFB4"        "HSP90AA1"      "HIST1H1C"     
[109] "DUT"          
[1] "factor 3"
  [1] "RPL13"   "RPL10"   "RPS2"    "RPL13A"  "RPS6"    "RPL3"    "MALAT1" 
  [8] "B2M"     "RPS3"    "TMSB4X"  "RPL32"   "RPS4X"   "RPL18A"  "RPS18"  
 [15] "RPL11"   "RPS27"   "RPS14"   "RPL21"   "EEF1A1"  "RPL19"   "RPS19"  
 [22] "RPS12"   "LTB"     "RPLP2"   "JUNB"    "RPS3A"   "RPL8"    "RPL18"  
 [29] "RPL15"   "RPS5"    "RPL12"   "RPL6"    "TMSB10"  "RPS15"   "RPS9"   
 [36] "RPL10A"  "RPL23A"  "HLA-B"   "RPS8"    "RPS25"   "RPL9"    "RPL14"  
 [43] "RPS27A"  "RPL31"   "RPS15A"  "RPL29"   "RPS16"   "RPL28"   "RPL4"   
 [50] "RPLP1"   "EEF1D"   "RPL5"    "RPL7"    "RPL27A"  "RPSA"    "RPS7"   
 [57] "RPL34"   "RPS13"   "TPT1"    "HLA-C"   "BTG1"    "ACTB"    "RPS23"  
 [64] "GNB2L1"  "RPL30"   "CD3E"    "CD3D"    "RPL26"   "CD52"    "RPL36"  
 [71] "RPL35A"  "HLA-A"   "RPL35"   "RPL7A"   "RPLP0"   "UBA52"   "MT-CO1" 
 [78] "FTL"     "FAU"     "GLTSCR2" "RPS28"   "RPS20"   "IL32"    "NOSIP"  
 [85] "PTMA"    "RPL17"   "NACA"    "TMEM66"  "RPS10"   "IER2"    "RPS26"  
 [92] "RPL22"   "CD27"    "GIMAP7"  "COX4I1"  "MT-CO3"  "PFN1"    "RPL27"  
 [99] "CORO1A"  "EEF1B2"  "FTH1"    "LDHB"   
[1] "factor 4"
 [1] "GNLY"      "NKG7"      "GZMB"      "GZMA"      "TYROBP"    "CCL5"     
 [7] "CST7"      "FCER1G"    "CLIC3"     "HCST"      "CTSW"      "KLRB1"    
[13] "FGFBP2"    "IFITM2"    "MALAT1"    "PRF1"      "CD7"       "HOPX"     
[19] "CYBA"      "B2M"       "PFN1"      "PLAC8"     "CD247"     "HLA-C"    
[25] "GZMH"      "CALM1"     "GZMM"      "FCGR3A"    "SPON2"     "HLA-B"    
[31] "KLRF1"     "HLA-A"     "MYL12A"    "SRGN"      "ACTB"      "TMSB4X"   
[37] "EFHD2"     "ITGB2"     "CCL4"      "PTPRCAP"   "IFITM1"    "KLRD1"    
[43] "RARRES3"   "HLA-E"     "CD63"      "ID2"       "SERF2"     "RAC2"     
[49] "UBB"       "ATP5E"     "ARPC2"     "JAK1"      "SNORD3B-2" "MT-CO2"   
[55] "MATK"      "RHOC"      "POLR2L"    "TMA7"      "MT-ATP6"   "KLRC1"    
[61] "RPS27"     "CFL1"      "CLIC1"     "C12orf75"  "RPL37A"    "DBI"      
[67] "S100A4"    "ALOX5AP"   "SH3BGRL3"  "SEPT7"     "IL2RB"    
[1] "factor 5"
 [1] "S100A9"    "S100A8"    "LYZ"       "CST3"      "TYROBP"    "HLA-DRB1" 
 [7] "S100A4"    "S100A6"    "CD74"      "FTL"       "LGALS1"    "HLA-DRA"  
[13] "HLA-DRB5"  "FTH1"      "LST1"      "AIF1"      "FCER1G"    "FCN1"     
[19] "HLA-DPB1"  "SAT1"      "PSAP"      "CYBA"      "GPX1"      "TYMP"     
[25] "S100A11"   "TSPO"      "GSTP1"     "CTSS"      "HLA-DPA1"  "FOS"      
[31] "COTL1"     "PYCARD"    "HLA-DQB1"  "CFD"       "S100A10"   "ATP5E"    
[37] "MYL6"      "HLA-DQA1"  "LGALS2"    "CEBPD"     "OAZ1"      "CD14"     
[43] "FCGRT"     "NEAT1"     "TMEM176B"  "KLF6"      "LINC00936" "GRN"      
[49] "NPC2"      "HLA-DMA"   "CFP"       "LAMTOR4"   "SERF2"     "ARPC1B"   
[55] "RAC1"      "SPI1"      "ANXA2"    
[1] "factor 6"
character(0)
[1] "factor 7"
 [1] "IL32"     "S100A4"   "ACTB"     "SH3BGRL3" "PFN1"     "LTB"     
 [7] "HLA-A"    "CD52"     "S100A10"  "CD3D"     "B2M"      "VIM"     
[13] "HLA-C"    "CORO1A"   "JUNB"     "ACTG1"    "HLA-B"    "UBC"     
[19] "S100A6"   "CD3E"     "CFL1"     "GAPDH"    "COTL1"    "AES"     
[25] "GSTK1"    "ARPC1B"   "ARHGDIB"  "EMP3"     "PTPRCAP"  "TMSB4X"  
[31] "CD99"     "IER2"     "CALM1"    "FXYD5"    "ANXA2"    "CD2"     
[37] "AQP3"     "EVL"      "IL2RG"    "LCK"      "CRIP1"    "LGALS1"  
[43] "HLA-E"    "MYL12A"   "HSPA8"    "UCP2"     "FTH1"     "ISG20"   
[49] "LAT"      "CD27"     "RAC2"     "CAPZB"    "S1PR4"    "MYL6"    
[55] "DOK2"     "PPDPF"    "TRAF3IP3" "SIT1"     "CORO1B"   "PKM"     
[61] "GIMAP7"   "LSP1"     "ITM2B"    "LDHB"     "S100A11"  "LY6E"    
[67] "OAZ1"     "ARPC2"    "PPP1CA"  
[1] "factor 8"
 [1] "CD74"      "HLA-DRA"   "HLA-DRB1"  "HLA-DPB1"  "CD79A"     "HLA-DPA1" 
 [7] "CD79B"     "HLA-DRB5"  "CD37"      "HLA-DQA1"  "MS4A1"     "HLA-DQA2" 
[13] "HLA-DQB1"  "LTB"       "CYBA"      "TCL1A"     "IGLL5"     "HLA-DMA"  
[19] "CD52"      "RPS11"     "HLA-DMB"   "MALAT1"    "NCF1"      "LY86"     
[25] "LINC00926" "VPREB3"    "ARPC3"     "OAZ1"      "MT-CO1"    "FCER2"    
[31] "BANK1"     "HVCN1"     "MT-CO3"   
[1] "factor 9"
 [1] "CD8B"          "RP11-291B21.2" "S100B"         "RPS29"        
 [5] "HCST"          "CD8A"          "RPL36A"        "RPS21"        
 [9] "RPL38"         "RPS28"         "CD7"           "CD3D"         
[13] "RPL37A"        "RPL37"         "RPL34"         "RGS10"        
[17] "MT-CO2"        "RPL41"         "NOSIP"         "CARS"         
[21] "MT-ND2"        "CTSW"          "RPL27"         "RPS26"        
[25] "RPS24"         "GZMM"          "RPL23"         "RPL22"        
[29] "RPS10"        
[1] "factor 10"
 [1] "SPINK2"   "KIAA0125" "CD74"     "HOPX"     "LST1"     "PRSS1"   
 [7] "IGJ"      "HLA-DRA"  "AIF1"     "ZFAS1"    "SNHG7"    "ITM2C"   
[13] "GSTP1"    "TSC22D1"  "ACY3"     "PRSS3"    "GPX1"     "HLA-DPB1"
[19] "HOXA9"    "C9orf89"  "CALM2"    "DNTT"     "GNG11"    "SOX4"    
[25] "HLA-DPA1" "ATP5E"    "MZB1"     "ATP5L"   
[1] "factor 11"
 [1] "BTG1"     "GIMAP7"   "TMEM66"   "LDHB"     "DDX5"     "PABPC1"  
 [7] "SELL"     "NOSIP"    "CD3E"     "JUNB"     "CCR7"     "CD7"     
[13] "CD27"     "LEF1"     "RPL4"     "LTB"      "GYPC"     "LIMD2"   
[19] "HSPA8"    "TXNIP"    "GPSM3"    "EEF1A1"   "EEF2"     "TRAF3IP3"
[25] "PIK3IP1"  "CNBP"     "AES"      "GLTSCR2"  "ARHGDIB"  "EEF1D"   
[1] "factor 12"
[1] "GZMK"  "CCL5"  "IL32"  "DUSP1" "GZMA"  "NKG7"  "JUN"   "DUSP2" "LYAR" 
[1] "factor 13"
 [1] "S100A8" "S100A9" "FTL"    "TMSB4X" "RPLP1"  "TMSB10" "S100A4" "RPS14" 
 [9] "RPS9"   "FTH1"   "RPS2"   "RPL13"  "S100A6" "RPL13A" "MT-CO1" "FAU"   
[17] "TYROBP" "RPS28"  "HLA-B"  "COX4I1" "RPL34" 
[1] "factor 14"
[1] "TPSAB1" "LMO4"   "S100A6" "APOC1"  "CD63"  
[1] "factor 15"
character(0)
[1] "factor 16"
[1] "CLC"
[1] "factor 17"
 [1] "MT-ND2"  "MT-CO2"  "RPL37A"  "RPL34"   "RPL37"   "RPL38"   "RPS24"  
 [8] "RPS21"   "RPS28"   "MT-ND4"  "MT-ATP6" "RPS29"   "MT-CYB"  "RPL27"  
[15] "RPL26"   "RPL35A"  "RPS27A"  "RPLP2"   "RPS23"   "RPS27"   "RPL36"  
[22] "MT-CO3"  "RPS15A"  "RPL36A"  "RPL35"   "RPS20"   "RPS26"   "RPL31"  
[29] "RPLP1"   "TOMM7"   "MT-ND1"  "RPL27A"  "RPL30"   "RPS12"   "FAU"    
[36] "RPL28"   "RPL24"   "RPS11"   "RPL23A"  "RPL23"   "RPS15"   "RPS19"  
[43] "UBA52"  
[1] "factor 18"
[1] "ZNF683" "CCL5"  

I tried backfitting but it gave a memory error. Setting extrapolate=FALSE fixes this (apparently extrapolation makes a copy of some big things so uses more memory).

fit2 = flash_backfit(fit1, extrapolate=FALSE)
Backfitting 18 factors (tolerance: 3.10e+01)...
  Difference between iterations is within 1.0e+06...
  Difference between iterations is within 1.0e+05...
  Difference between iterations is within 1.0e+04...
  Difference between iterations is within 1.0e+03...
  Difference between iterations is within 1.0e+02...
Wrapping up...
Done.
saveRDS(fit2,file='../output/fit2.nn.pbmc.purified.rds')

Same idea: plot the results using Eric’s code

FF_log1p = fit2$L_pm
FF_log1p <- scale(FF_log1p, center = FALSE, scale = apply(FF_log1p, 2, max))
colnames(FF_log1p) <- paste0("k", 1:ncol(FF_log1p))

FF_log1p <- FF_log1p[cell.idx, ]


log1p_tib <- make.heatmap.tib(FF_log1p)
heatmap.tib = log1p_tib

tib <- heatmap.tib %>%
  group_by(Cell.type, Cell.idx) %>%
  summarize()
`summarise()` has grouped output by 'Cell.type'. You can override using the
`.groups` argument.
cell_type_breaks <- c(1, which(tib$Cell.type[-1] != tib$Cell.type[-nrow(tib)]))
label_pos <- cell_type_breaks / 2 + c(cell_type_breaks[-1], nrow(tib)) / 2

plt <- ggplot(heatmap.tib, aes(x = Factor, y = -Cell.idx, fill = Loading)) +
  geom_tile() +
  scale_fill_gradient(low = "white", high = "firebrick") +
  labs(y = "") +
  scale_y_continuous(breaks = -label_pos,
                     minor_breaks = NULL,
                     labels = levels(cell.type)) +
  scale_x_continuous(breaks = seq(0, 30, 5)) +
  theme_minimal() +
  geom_hline(yintercept = -cell_type_breaks, size = 0.1) +
  theme(legend.position = "none", 
        strip.text = element_text(size = 16)) 

plt

List driving genes:

for(k in 1:18){
  print(paste0("factor ",k))
  key = fit2$F_pm[,k]>1
  vals = fit2$F_pm[key,k]
  print(genes$symbol[key][order(vals,decreasing =TRUE)])
}
[1] "factor 1"
  [1] "RPS12"    "RPS18"    "RPL13"    "RPS27"    "RPL32"    "RPL13A"  
  [7] "RPLP2"    "RPS14"    "RPL34"    "MALAT1"   "RPS2"     "RPS19"   
 [13] "RPLP1"    "RPS6"     "RPL10"    "RPS15A"   "RPL31"    "RPS27A"  
 [19] "RPL21"    "RPL11"    "RPS3A"    "RPS23"    "RPS3"     "RPS4X"   
 [25] "RPS15"    "RPL23A"   "RPL35A"   "RPL27A"   "RPL18A"   "RPL3"    
 [31] "RPL7"     "RPL28"    "RPL19"    "RPL26"    "RPL36"    "RPL12"   
 [37] "RPL9"     "RPL30"    "RPS8"     "RPS25"    "RPL18"    "RPL35"   
 [43] "RPS16"    "RPS13"    "RPL10A"   "RPS28"    "RPS9"     "RPS20"   
 [49] "RPS7"     "RPL15"    "RPL29"    "RPS5"     "FAU"      "RPL37A"  
 [55] "TPT1"     "RPL6"     "RPL37"    "RPL27"    "RPL14"    "RPL8"    
 [61] "RPL7A"    "RPL5"     "RPS24"    "UBA52"    "B2M"      "RPSA"    
 [67] "TMSB4X"   "RPS26"    "TMSB10"   "RPL24"    "RPS11"    "GNB2L1"  
 [73] "MT-CO2"   "RPLP0"    "NACA"     "RPS21"    "RPL38"    "RPL4"    
 [79] "MT-CO3"   "EEF1A1"   "RPL36A"   "MT-CO1"   "EEF1B2"   "RPS10"   
 [85] "PTMA"     "MT-ND2"   "MT-ND4"   "RPS29"    "MT-CYB"   "RPL23"   
 [91] "EEF1D"    "FTL"      "PFDN5"    "FTH1"     "EIF1"     "MT-ND1"  
 [97] "COX4I1"   "RPL22"    "RPL36AL"  "TOMM7"    "GLTSCR2"  "HLA-B"   
[103] "BTF3"     "RPL17"    "RPL41"    "NPM1"     "HNRNPA1"  "SERF2"   
[109] "ATP5L"    "COX7C"    "HLA-A"    "COMMD6"   "MT-ATP6"  "ATP5E"   
[115] "HINT1"    "ATP5G2"   "PABPC1"   "SLC25A6"  "FXYD5"    "H3F3B"   
[121] "EEF2"     "SNRPD2"   "ACTB"     "EIF3K"    "HLA-C"    "ZFAS1"   
[127] "TMA7"     "UBB"      "PFN1"     "OST4"     "C6orf48"  "EDF1"    
[133] "MT-ND5"   "UXT"      "EIF3E"    "CFL1"     "CIRBP"    "CD52"    
[139] "GAPDH"    "OAZ1"     "SRSF5"    "UQCRH"    "MYL12A"   "CD37"    
[145] "MZT2B"    "MYL6"     "UQCR11"   "SH3BGRL3" "EIF3F"    "SSR4"    
[151] "YBX1"     "ARHGDIB"  "COX6B1"   "NAP1L1"   "LDHB"     "CYBA"    
[157] "ACTG1"    "SRP14"    "EIF3H"    "EIF3L"    "IFITM2"   "GMFG"    
[163] "SSR2"     "VIM"      "JUN"      "S100A6"   "BTG1"     "CHCHD2"  
[169] "UBC"      "ATP5O"    "ATP5D"    "NDUFA4"   "ITM2B"    "PNRC1"   
[175] "SERP1"    "APRT"     "FOS"      "HSP90AB1" "HSP90AA1" "SMDT1"   
[181] "IER2"     "ERP29"    "JUNB"     "HLA-E"    "PSME1"    "PPDPF"   
[187] "C19orf43" "DDX5"     "COX6C"    "SNHG8"    "DUSP1"    "RPL39"   
[193] "EIF3G"    "C12orf57" "TCEB2"    "HMGB1"    "NDUFB11"  "ARPC3"   
[199] "CUTA"     "EIF4A2"   "TXNIP"    "HIGD2A"   "TMEM66"   "GPSM3"   
[205] "PPIA"     "SKP1"     "HMGN1"    "LAMTOR4"  "NDUFS5"   "VAMP2"   
[211] "UBL5"     "CCNI"     "COX7A2"   "SNHG7"    "COX5B"    "UBXN1"   
[217] "FBL"      "GPX4"     "MIF"      "TMEM258"  "S100A4"   "ATP6V1G1"
[1] "factor 2"
  [1] "CD74"          "ZFAS1"         "GAPDH"         "AIF1"         
  [5] "HLA-DRA"       "SERPINB1"      "SNHG7"         "ACTG1"        
  [9] "HINT1"         "HSP90AB1"      "SPINK2"        "EIF3E"        
 [13] "PRSS57"        "NPM1"          "ARHGDIB"       "LDHB"         
 [17] "H2AFY"         "BTF3"          "RP11-620J15.3" "TALDO1"       
 [21] "H3F3B"         "RPS24"         "ENO1"          "EIF4A1"       
 [25] "CLIC1"         "TKT"           "ATP5G2"        "UQCRH"        
 [29] "HLA-DPB1"      "VIM"           "GSTP1"         "SNHG8"        
 [33] "NAP1L1"        "GNB2L1"        "HNRNPA1"       "C6orf48"      
 [37] "EEF2"          "TAGLN2"        "UBB"           "HMGB1"        
 [41] "PABPC1"        "UQCRB"         "GMFG"          "ANXA1"        
 [45] "EBPL"          "TXN"           "HLA-DPA1"      "GPX1"         
 [49] "FOS"           "EEF1B2"        "MT-CO1"        "NUCB2"        
 [53] "VAMP8"         "RPLP0"         "EIF3L"         "COX6B1"       
 [57] "NACA"          "RPL5"          "LSM7"          "MT-ND3"       
 [61] "RPL7A"         "FTL"           "SUMO2"         "PRDX1"        
 [65] "PTMA"          "MT-ATP6"       "RPL15"         "MT-CO3"       
 [69] "ANP32B"        "EGFL7"         "SLC25A3"       "FTH1"         
 [73] "RPL23"         "KIAA0125"      "YBX1"          "RSL1D1"       
 [77] "MT-ND4"        "DUSP1"         "COX7C"         "HMGA1"        
 [81] "RPL29"         "IMPDH2"        "C19orf77"      "SELL"         
 [85] "LYL1"          "RPS21"         "TUBA1A"        "SOX4"         
 [89] "ARPC3"         "RPL24"         "CHCHD2"        "HLA-DRB1"     
 [93] "SLC25A5"       "ATP5A1"        "MT-CYB"        "ATP5L"        
 [97] "HSP90AA1"      "SNRPE"         "EIF1"          "HSD17B11"     
[101] "STMN1"         "EID1"          "BST2"          "APEX1"        
[105] "RPL38"         "EIF3H"         "RPL37A"        "SRP14"        
[109] "SNX3"          "RBM3"          "ZFP36L2"       "RPL39"        
[113] "SLC25A6"       "CYTL1"         "ALDOA"         "RPS4X"        
[117] "PRDX6"         "SRSF5"         "GYPC"          "LINC00493"    
[121] "CCNI"          "NGFRAP1"       "CAT"           "UXT"          
[125] "MT-ND1"        "FXYD5"         "COX5A"         "EIF3D"        
[129] "ST13"          "ATP5O"         "CD37"          "RPS8"         
[133] "PCBP2"         "HIST1H4C"      "EIF3M"         "CD164"        
[137] "EPB41L4A-AS1"  "ATP5C1"        "ARPC2"         "RPL36A"       
[141] "LST1"          "C14orf166"     "RPS11"         "SNRPD1"       
[145] "RPL10A"        "NDUFA4"        "RPL37"         "CD99"         
[149] "COMMD6"        "PSME1"         "RPS7"          "SH3BGRL"      
[153] "RPL12"         "EIF3F"         "MT-ND5"        "SRSF3"        
[157] "SNRPD2"        "CRHBP"         "ATP5G3"        "CIRBP"        
[161] "UFC1"          "MDK"           "ICAM3"         "HLA-A"        
[165] "LSM2"          "LDHA"          "RPS23"         "RAC2"         
[169] "ACTB"          "TUBA1B"        "PLAC8"         "DYNLL1"       
[173] "IGFBP7"        "RPL4"          "AVP"           "ATP5J"        
[177] "RPS5"          "PNRC1"         "MT-ND2"        "OAZ1"         
[181] "RSL24D1"       "TIMM13"        "SKP1"          "TPI1"         
[185] "PPIA"          "RPL14"         "RPS2"          "HNRNPA2B1"    
[189] "SH3BGRL3"      "MZT2B"         "PNISR"         "ATP5B"        
[193] "HSPB1"         "RPS9"          "TAF1D"         "CCT4"         
[197] "EIF3K"         "FBL"           "RPL3"          "RPL26"        
[201] "RPSA"          "MYL12B"        "UBC"           "MT-CO2"       
[205] "CFL1"          "TPT1"          "SRGN"          "RBMX"         
[209] "DDAH2"         "HIST1H1C"      "PFN1"          "PEBP1"        
[213] "RPL6"          "CCT8"          "COX6C"         "RPS13"        
[217] "SOD1"          "SNRPF"         "ATP6V1F"       "PARK7"        
[221] "SYPL1"         "EIF4A2"        "RPL35A"        "NDUFS5"       
[225] "HNRNPC"        "FKBP1A"        "MYL6"          "ATP5D"        
[229] "RPLP1"         "SERPINB6"      "ESD"           "PSMB1"        
[233] "SERP1"         "HSPD1"         "ARPC1B"        "RPS3"         
[237] "YBX3"          "RPS3A"         "RPS29"         "HIST1H1D"     
[241] "ID1"           "NDUFB4"        "HMGN1"         "NENF"         
[245] "TMEM59"        "GDI2"          "RPL8"          "RPL35"        
[249] "OSTC"          "COX5B"         "COX7A2"        "TBCA"         
[253] "MRPS21"       
[1] "factor 3"
 [1] "MALAT1"   "RPL13"    "RPL10"    "RPS2"     "B2M"      "RPL13A"  
 [7] "TMSB4X"   "RPS6"     "RPL3"     "RPS3"     "RPS4X"    "RPS18"   
[13] "RPL18A"   "RPL32"    "RPL11"    "RPS27"    "RPS14"    "RPS19"   
[19] "RPL19"    "HLA-B"    "RPL21"    "TMSB10"   "RPLP2"    "RPL15"   
[25] "RPS12"    "RPL8"     "RPS15"    "RPL12"    "RPS3A"    "ACTB"    
[31] "EEF1A1"   "RPL18"    "RPLP1"    "RPL6"     "RPS9"     "HLA-A"   
[37] "FTL"      "RPL23A"   "RPS8"     "RPL28"    "RPS27A"   "MT-CO1"  
[43] "HLA-C"    "RPL10A"   "RPL29"    "RPL14"    "RPS7"     "RPS5"    
[49] "RPS15A"   "RPL31"    "RPL9"     "RPL27A"   "GNB2L1"   "RPL26"   
[55] "FTH1"     "JUNB"     "RPS23"    "EEF1D"    "RPL5"     "RPS16"   
[61] "RPL7"     "RPS25"    "PTMA"     "TPT1"     "RPL7A"    "RPL35A"  
[67] "RPL30"    "RPSA"     "RPL4"     "RPS13"    "PFN1"     "RPL35"   
[73] "FAU"      "EIF1"     "RPL36"    "RPL34"    "LTB"      "RPLP0"   
[79] "MT-CO3"   "UBA52"    "RPS28"    "NACA"     "UBC"      "BTG1"    
[85] "SH3BGRL3" "CD52"     "RPS20"    "ARHGDIB"  "CFL1"     "GLTSCR2" 
[91] "RPS26"    "H3F3B"    "COX4I1"   "IL32"     "IER2"     "JUN"     
[97] "CYBA"    
[1] "factor 4"
  [1] "GNLY"      "NKG7"      "MALAT1"    "B2M"       "TYROBP"    "ACTB"     
  [7] "PFN1"      "TMSB4X"    "GZMB"      "GZMA"      "HLA-B"     "HLA-A"    
 [13] "CCL5"      "HLA-C"     "HCST"      "CST7"      "FCER1G"    "CYBA"     
 [19] "IFITM2"    "CTSW"      "CLIC3"     "CD7"       "TMSB10"    "MT-CO1"   
 [25] "KLRB1"     "FGFBP2"    "CFL1"      "RPS27"     "HOPX"      "MYL12A"   
 [31] "PTPRCAP"   "CALM1"     "ACTG1"     "PLAC8"     "PRF1"      "UBB"      
 [37] "MT-CO2"    "EIF1"      "ARHGDIB"   "SERF2"     "SH3BGRL3"  "HLA-E"    
 [43] "S100A4"    "SRGN"      "RAC2"      "H3F3B"     "ARPC2"     "CD247"    
 [49] "GZMM"      "RPL37A"    "MT-CO3"    "ATP5E"     "CLIC1"     "PTMA"     
 [55] "CORO1A"    "MYL6"      "RPL37"     "MT-ATP6"   "GZMH"      "ITGB2"    
 [61] "DDX5"      "RPS28"     "SPON2"     "FCGR3A"    "IFITM1"    "LSP1"     
 [67] "RPS26"     "RARRES3"   "UBC"       "TMA7"      "KLRF1"     "CD63"     
 [73] "RPS21"     "RPS29"     "RPL10"     "FTL"       "EMP3"      "GSTP1"    
 [79] "CD99"      "RPS24"     "RPS15A"    "PPIA"      "MYL12B"    "ID2"      
 [85] "EFHD2"     "PSME1"     "RPS27A"    "ARPC3"     "GAPDH"     "RPLP2"    
 [91] "MT-CYB"    "POLR2L"    "RPL26"     "CD53"      "RPL23A"    "MT-ND4"   
 [97] "EIF3G"     "CCL4"      "DUSP1"     "SEPT7"     "RPL27A"    "RPL28"    
[103] "FAU"       "TPT1"      "UQCR11"    "RPL36AL"   "RPLP1"     "JAK1"     
[109] "HSP90AA1"  "DBI"       "SRP14"     "RPL38"     "KLRD1"     "BTG1"     
[115] "RPL27"     "UBA52"     "RPL21"     "MT-ND2"    "TCEB2"     "RPS19"    
[121] "ANXA1"     "RPL31"     "HMGB1"     "CHCHD2"    "TXNIP"     "NDUFB2"   
[127] "RPL35"     "PPP1CA"    "HNRNPA2B1" "IL2RG"     "OAZ1"      "MATK"     
[133] "ITM2B"     "UBL5"      "RHOC"      "PTPRC"     "SNORD3B-2" "GIMAP7"   
[139] "PSMB9"     "GMFG"     
[1] "factor 5"
 [1] "CST3"     "HLA-DRA"  "CD74"     "LYZ"      "HLA-DPB1" "HLA-DRB1"
 [7] "HLA-DPA1" "HLA-DRB5" "HLA-DQA1" "LGALS1"   "CYBA"     "FCER1G"  
[13] "TYROBP"   "ACTB"     "S100A10"  "COTL1"    "VIM"      "HLA-DQB1"
[19] "GPX1"     "FTH1"     "GSTP1"    "S100A4"   "HLA-DQA2" "ARPC1B"  
[25] "S100A6"   "HLA-DMA"  "PFN1"     "MYL6"     "CFL1"     "LSP1"    
[31] "AIF1"     "ACTG1"    "SH3BGRL3" "LST1"     "PYCARD"   "OAZ1"    
[37] "FCGRT"    "ARPC3"    "SRGN"     "GAPDH"    "EIF4A1"   "CALM2"   
[43] "ARPC2"    "FOS"      "ANXA2"    "S100A11"  "TMSB4X"   "RAC1"    
[49] "SERF2"    "FTL"      "HLA-DMB"  "ATP5E"    "VAMP8"    "SPI1"    
[55] "TMSB10"   "GRN"      "CPVL"     "CORO1A"   "PSAP"     "SLC25A6" 
[61] "SAT1"     "ZFP36"    "AP2S1"    "TYMP"     "CTSS"     "NPC2"    
[67] "HLA-B"    "PSME2"    "PRELID1"  "SLC25A5"  "RNASET2"  "CLIC1"   
[73] "HLA-C"    "PGLS"     "ATP6V0B"  "TAGLN2"   "MT-CO1"   "TPI1"    
[79] "TUBA1B"   "YBX1"     "RNH1"     "CSTB"     "PPIA"     "EIF1"    
[85] "AMICA1"   "PARK7"    "B2M"     
[1] "factor 6"
[1] "TUBA1B"
[1] "factor 7"
 [1] "S100A4"   "IL32"     "ACTB"     "PFN1"     "SH3BGRL3" "LTB"     
 [7] "HLA-A"    "B2M"      "CD52"     "TMSB4X"   "HLA-C"    "HLA-B"   
[13] "S100A6"   "GAPDH"    "S100A10"  "ACTG1"    "VIM"      "CFL1"    
[19] "TMSB10"   "EMP3"     "ARPC1B"   "CD3D"     "PTPRCAP"  "UBC"     
[25] "ARHGDIB"  "CORO1A"   "JUNB"     "MYL6"     "FTH1"     "CD99"    
[31] "CYBA"     "FXYD5"    "MYL12A"   "LGALS1"   "EIF1"     "COTL1"   
[37] "CALM1"    "CLIC1"    "CRIP1"    "GSTK1"    "OAZ1"     "ARPC2"   
[43] "MT-CO1"   "TAGLN2"   "RAC2"     "HLA-E"    "IER2"     "DUSP1"   
[49] "H3F3B"    "AES"      "LSP1"     "CD3E"     "PSME1"    "SERF2"   
[55] "LDHB"     "PPDPF"    "ARPC3"    "PSMA7"    "CAPZB"    "GMFG"    
[61] "HSPA8"    "YBX1"     "ANXA2"    "IL2RG"    "MYL12B"  
[1] "factor 8"
 [1] "CD74"      "HLA-DRA"   "HLA-DRB1"  "HLA-DPB1"  "HLA-DPA1"  "CD79A"    
 [7] "CD79B"     "HLA-DRB5"  "LTB"       "CD37"      "HLA-DQA1"  "MALAT1"   
[13] "CD52"      "CYBA"      "HLA-DQA2"  "MT-CO1"    "MS4A1"     "HLA-DQB1" 
[19] "PTPRCAP"   "OAZ1"      "ARPC3"     "MT-CO3"    "RPL18A"    "TMSB4X"   
[25] "HLA-B"     "FTL"       "ACTB"      "LIMD2"     "RPL13A"    "RPS11"    
[31] "HLA-C"     "HLA-DMA"   "RPL8"      "TCL1A"     "RPS2"      "RPLP1"    
[37] "RPS5"      "RPL13"     "PTMA"      "HLA-A"     "RPL15"     "GNB2L1"   
[43] "UBC"       "ARHGDIB"   "IGLL5"     "EIF1"      "LAPTM5"    "CORO1A"   
[49] "FAU"       "RPL12"     "RPL10"     "TMSB10"    "RPL7A"     "RPL29"    
[55] "RPL18"     "HLA-DMB"   "RPL19"     "SLC25A6"   "RPS23"     "RPS8"     
[61] "FTH1"      "RPS19"     "TSC22D3"   "CLIC1"     "BTG1"      "LSP1"     
[67] "EEF1A1"    "NCF1"      "RPSA"      "MT-CO2"    "RPL23A"    "RPS18"    
[73] "RPL11"     "CD53"      "RPS9"      "YBX1"      "RAC2"      "SNX3"     
[79] "LY86"      "ARPC2"     "UBB"       "POLD4"     "RPS7"      "LINC00926"
[85] "ISG20"     "RPLP2"     "CFL1"      "RPL27A"    "VPREB3"    "B2M"      
[91] "RPS15"     "DDX5"      "PLAC8"     "PFN1"      "H3F3B"    
[1] "factor 9"
 [1] "CD8B"          "ACTB"          "CD3D"          "LTB"          
 [5] "JUNB"          "CD3E"          "HLA-C"         "PFN1"         
 [9] "HLA-B"         "HCST"          "CD7"           "ARHGDIB"      
[13] "CD52"          "TMSB10"        "HLA-A"         "CORO1A"       
[17] "NOSIP"         "TMSB4X"        "LDHB"          "BTG1"         
[21] "B2M"           "IL32"          "PTPRCAP"       "CFL1"         
[25] "GIMAP7"        "CD27"          "TMEM66"        "ACTG1"        
[29] "RGS10"         "RP11-291B21.2" "GYPC"          "LIMD2"        
[33] "RAC2"          "S100B"         "CTSW"         
[1] "factor 10"
 [1] "CD74"     "SPINK2"   "HLA-DRA"  "KIAA0125" "AIF1"     "ZFAS1"   
 [7] "ACTG1"    "LST1"     "GSTP1"    "SNHG7"    "HOPX"     "GPX1"    
[13] "MALAT1"   "HLA-DPB1" "H3F3B"    "ENO1"     "CALM2"    "PRSS1"   
[19] "RPS24"    "ATP5L"    "ATP5E"    "HLA-DPA1" "ITM2C"    "GAPDH"   
[25] "SOX4"     "LSP1"     "HCST"     "IGJ"      "EIF1"     "ARPC3"   
[31] "CIRBP"    "SRP14"    "CD99"     "HLA-DRB1" "FOS"      "PTMA"    
[37] "GNB2L1"   "FTH1"     "NDUFA4"   "TSC22D1"  "ACY3"     "BTF3"    
[43] "CLIC1"    "ACTB"     "EIF3E"    "ATP5G2"   "MT-CO1"   "MT-ND4"  
[49] "HLA-A"    "NAP1L1"   "SUMO2"    "UBB"      "NACA"     "SRSF5"   
[55] "CORO1A"   "UBC"      "COX7C"    "LTB"      "MT-ATP6" 
[1] "factor 11"
 [1] "LTB"     "ACTB"    "LDHB"    "JUNB"    "EEF1A1"  "ARHGDIB" "RPL4"   
 [8] "BTG1"    "PABPC1"  "DDX5"    "TMEM66"  "CD3E"    "RPL5"    "CORO1A" 
[15] "GIMAP7"  "ACTG1"   "PFN1"    "GNB2L1"  "NOSIP"   "RPL3"    "EEF1D"  
[22] "LIMD2"   "EEF2"    "NPM1"    "CFL1"   
[1] "factor 12"
 [1] "GZMK"   "CCL5"   "NKG7"   "GZMA"   "DUSP1"  "MALAT1" "IL32"   "B2M"   
 [9] "HLA-B"  "HCST"   "JUN"    "BTG1"   "HLA-C"  "CST7"   "TMSB4X" "DUSP2" 
[17] "HLA-A" 
[1] "factor 13"
 [1] "S100A8"   "S100A9"   "FTL"      "S100A4"   "TYROBP"   "FTH1"    
 [7] "S100A6"   "TMSB4X"   "TMSB10"   "RPLP1"    "CYBA"     "LYZ"     
[13] "CST3"     "AIF1"     "RPS14"    "RPS9"     "TSPO"     "HLA-DRB1"
[19] "RPS2"     "FCN1"     "GPX1"     "LGALS1"   "LST1"     "SAT1"    
[25] "COX4I1"   "SERF2"    "ATP5E"    "RPL13"    "RPL34"    "PSAP"    
[31] "MT-ND1"  
[1] "factor 14"
 [1] "RP11-620J15.3" "SERPINB1"      "HSP90AB1"      "GAPDH"        
 [5] "S100A4"        "PRSS57"        "LDHB"          "HMGB1"        
 [9] "ZFAS1"         "GPX1"          "FCER1A"       
[1] "factor 15"
character(0)
[1] "factor 16"
[1] "S100A6" "TPSAB1" "LMO4"   "CLC"   
[1] "factor 17"
character(0)
[1] "factor 18"
[1] "ZNF683" "CCL5"  

sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur ... 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_3.4.4  flashier_1.0.7 magrittr_2.0.3 ebnm_1.1-2     Matrix_1.6-4  
[6] stringr_1.5.1  purrr_1.0.2    tidyr_1.3.0    dplyr_1.1.4   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.12       horseshoe_0.2.0   invgamma_1.1      lattice_0.22-5   
 [5] rprojroot_2.0.4   digest_0.6.33     utf8_1.2.4        truncnorm_1.0-9  
 [9] R6_2.5.1          evaluate_0.23     highr_0.10        pillar_1.9.0     
[13] rlang_1.1.2       rstudioapi_0.15.0 irlba_2.3.5.1     whisker_0.4.1    
[17] jquerylib_0.1.4   rmarkdown_2.25    splines_4.2.1     Rtsne_0.17       
[21] munsell_0.5.0     mixsqp_0.3-54     compiler_4.2.1    httpuv_1.6.13    
[25] xfun_0.41         pkgconfig_2.0.3   SQUAREM_2021.1    htmltools_0.5.7  
[29] tidyselect_1.2.0  tibble_3.2.1      workflowr_1.7.1   fansi_1.0.6      
[33] crayon_1.5.2      withr_3.0.0       later_1.3.2       grid_4.2.1       
[37] jsonlite_1.8.8    gtable_0.3.4      lifecycle_1.0.4   git2r_0.33.0     
[41] scales_1.3.0      cli_3.6.2         stringi_1.8.3     cachem_1.0.8     
[45] farver_2.1.1      fs_1.6.3          promises_1.2.1    bslib_0.6.1      
[49] generics_0.1.3    vctrs_0.6.5       trust_0.1-8       tools_4.2.1      
[53] glue_1.6.2        softImpute_1.4-1  parallel_4.2.1    fastmap_1.1.1    
[57] yaml_2.3.8        colorspace_2.1-0  ashr_2.2-63       deconvolveR_1.2-1
[61] knitr_1.45        sass_0.4.8