produce torchbiggraph embeddings for discretized single-cell RNA-seq measures in a SingleCellExperiment

sce_to_embeddings(
  sce,
  workdir,
  N_EPOCHS,
  N_GENES,
  N_GPUS = 1L,
  BATCH_SIZE = 100000L,
  pbg,
  palib
)

Arguments

sce

SingleCellExperiment instance that includes `disc` among its assays, intended to hold output of `disc_mat` applied to normalized log counts

workdir

character(1) folder for interim computations, must exist prior to call

N_EPOCHS

numeric(1)

N_GENES

numeric(1)

N_GPUS

numeric(1)

BATCH_SIZE

integer

pbg

reference to torchbiggraph

palib

reference to pathlib

Value

a list with elements `cemb` and `gemb` (matrix representations of embeddings of cells and genes respectively), `cents` and `gents` (vectors of names of cells and genes as ordered in the returned matrices), stats (a data.frame of training statistics), call (the match.call) and config (a python reference, not useful after the session in which object was produced ends).

Examples

pbg = reticulate::import("torchbiggraph")
palib = reticulate::import("pathlib")
data(t3k)
testd = paste0(tempdir(), "/testse")
dir.create(testd)
nn2 = sce_to_embeddings(t3k, testd, N_EPOCHS=2L, BATCH_SIZE=1000L,
   N_GENES=500L, N_GPUS=0L, pbg=pbg, palib=palib)
#> ......................................................
dir(testd, full.names=TRUE)
#> [1] "/home/vincent/TEMP/Rtmpf7vh4D/testse/basic.tsv"
#> [2] "/home/vincent/TEMP/Rtmpf7vh4D/testse/cp2"      
#> [3] "/home/vincent/TEMP/Rtmpf7vh4D/testse/ents2"    
#> [4] "/home/vincent/TEMP/Rtmpf7vh4D/testse/tr"