This function allows to export a SingleCellExperiment (SCE) object to visualize in Cerebro.

exportFromSCE(
  object,
  assay = "logcounts",
  file,
  experiment_name,
  organism,
  groups,
  cell_cycle = NULL,
  nUMI = "nUMI",
  nGene = "nGene",
  add_all_meta_data = TRUE,
  use_delayed_array = FALSE,
  verbose = FALSE
)

Arguments

object

SingleCellExperiment (SCE) object.

assay

Assay to pull expression values from; defaults to logcounts. It is recommended to use sparse data (such as log-transformed or raw counts) instead of dense data (such as the 'scaled' slot) to avoid performance bottlenecks in the Cerebro interface.

file

Where to save the output.

experiment_name

Experiment name.

organism

Organism, e.g. hg (human), mm (mouse), etc.

groups

Names of grouping variables in meta data (colData(object)), e.g. c("sample","cluster"); at least one must be provided; defaults to NULL.

cell_cycle

Names of columns in meta data (colData(object)) that# contain cell cycle information, e.g. c("Phase"); defaults to NULL.

nUMI

Column in colData(object) that contains information about number of transcripts per cell; defaults to nUMI.

nGene

Column in colData(object) that contains information about number of expressed genes per cell; defaults to nGene.

add_all_meta_data

If set to TRUE, all further meta data columns will be extracted as well.

use_delayed_array

When set to TRUE, the expression matrix will be stored as an RleMatrix (see DelayedArray package). This can be useful for very large data sets, as the matrix won't be loaded into memory and instead values will be read from the disk directly, at the cost of performance. Note that it is necessary to install the DelayedArray package. If set to FALSE (default), the expression matrix will be copied from the input object as is. It is recommended to use a sparse format, such as dgCMatrix from the Matrix package.

verbose

Set this to TRUE if you want additional log messages; defaults to FALSE.

Value

No data returned.

Examples

pbmc <- readRDS(system.file("extdata/v1.3/pbmc_SCE.rds", package = "cerebroApp")) exportFromSCE( object = pbmc, file = 'pbmc_SCE.crb', experiment_name = 'PBMC', organism = 'hg', groups = c('sample','cluster'), nUMI = 'nUMI', nGene = 'nGene', use_delayed_array = FALSE, verbose = TRUE )
#> Loading required package: SingleCellExperiment
#> Loading required package: SummarizedExperiment
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> #> Attaching package: ‘MatrixGenerics’
#> The following objects are masked from ‘package:matrixStats’: #> #> colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse, #> colCounts, colCummaxs, colCummins, colCumprods, colCumsums, #> colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, #> colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats, #> colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds, #> colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads, #> colWeightedMeans, colWeightedMedians, colWeightedSds, #> colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet, #> rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods, #> rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps, #> rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins, #> rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks, #> rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars, #> rowWeightedMads, rowWeightedMeans, rowWeightedMedians, #> rowWeightedSds, rowWeightedVars
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> Loading required package: parallel
#> #> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:parallel’: #> #> clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, #> clusterExport, clusterMap, parApply, parCapply, parLapply, #> parLapplyLB, parRapply, parSapply, parSapplyLB
#> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’: #> #> anyDuplicated, append, as.data.frame, basename, cbind, colnames, #> dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep, #> grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget, #> order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, #> rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply, #> union, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> #> Attaching package: ‘S4Vectors’
#> The following object is masked from ‘package:base’: #> #> expand.grid
#> Loading required package: IRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: Biobase
#> Welcome to Bioconductor #> #> Vignettes contain introductory material; view with #> 'browseVignettes()'. To cite Bioconductor, see #> 'citation("Biobase")', and for packages 'citation("pkgname")'.
#> #> Attaching package: ‘Biobase’
#> The following object is masked from ‘package:MatrixGenerics’: #> #> rowMedians
#> The following objects are masked from ‘package:matrixStats’: #> #> anyMissing, rowMedians
#> [17:53:23] Initializing Cerebro object...
#> Warning: the condition has length > 1 and only the first element will be used
#> [17:53:23] Collecting available meta data...
#> [17:53:23] Extracting all meta data columns...
#> [17:53:23] Extracting dimensional reductions...
#> [17:53:23] Will export the following dimensional reductions: UMAP
#> [17:53:23] No trajectories to extract...
#> [17:53:23] Overview of Cerebro object:
#> class: Cerebro_v1.3 #> cerebroApp version: 1.3.1 #> experiment name: PBMC #> organism: hg #> date of analysis: #> date of export: 2021-03-12 #> number of cells: 80 #> number of genes: 230 #> grouping variables (2): sample, cluster #> cell cycle variables (0): #> projections (1): UMAP #> trees (0): #> most expressed genes: #> marker genes: #> enriched pathways: #> trajectories: #> extra material:
#> [17:53:23] Saving Cerebro object to: pbmc_SCE.crb
#> [17:53:23] Done!