Scenarios to test

Test several cases of custom, missing or incomplete data

NA values in grouping variables

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@meta.data$sample[sample(seq(nrow(pbmc_Seurat_copy@meta.data)), 1000, replace = FALSE)] <- NA
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = TRUE
)

No experiment info

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$experiment <- list()
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

No cell cycle assignments

exportFromSeurat(
  pbmc_Seurat,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

No phylogenetic trees

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$trees <- list()
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Most expressed genes

Data is missing

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$most_expressed_genes <- NULL
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Marker genes

Data is missing

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$marker_genes <- NULL
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

No marker genes found

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$marker_genes$cerebro_seurat$sample <- "no_markers_found"
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Custom table

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$marker_genes$test <- list(
  "test1" = tibble(
    a = "this",
    b = "is",
    c = "a",
    d = "test"
  )
)

exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)
# class: Cerebro_v1.3
# cerebroApp version: 1.3.0
# experiment name: pbmc_Seurat
# organism: hg
# date of analysis: 2020-02-19
# date of export: 2020-08-30
# number of cells: 5,697
# number of genes: 15,907
# grouping variables (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main
# cell cycle variables (1): cell_cycle_seurat
# projections (2): UMAP, UMAP_3D
# trees (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main
# most expressed genes: sample, seurat_clusters, cell_type_singler_blueprintencode_main
# marker genes:
#   - cerebro_seurat (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main,
#   - test (1): test1
# enriched pathways:
#   - cerebro_seurat_enrichr (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main,
#   - cerebro_GSVA (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main,
# trajectories:
#   - monocle2 (1): highly_variable_genes

Enriched pathways

Data is missing

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$enriched_pathways <- NULL
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Enrichr: No marker genes found or no pathways enriched

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$enriched_pathways$cerebro_seurat_enrichr$sample <- "no_markers_found"
pbmc_Seurat_copy@misc$enriched_pathways$cerebro_seurat_enrichr_2 <- list(
  sample = "no_pathways_found"
)
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

GSVA: No gene sets enriched

pbmc_Seurat_copy <- pbmc_Seurat
pbmc_Seurat_copy@misc$enriched_pathways$cerebro_GSVA$sample <- "no_gene_sets_enriched"
exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Custom table

pbmc_Seurat_copy <- pbmc_Seurat

pbmc_Seurat_copy@misc$enriched_pathways$test <- list(
  "test2" = tibble(
    a = "this",
    b = "is",
    c = "a",
    d = "test"
  )
)

exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)
# class: Cerebro_v1.3
# cerebroApp version: 1.3.0
# experiment name: pbmc_Seurat
# organism: hg
# date of analysis: 2020-02-19
# date of export: 2020-08-30
# number of cells: 5,697
# number of genes: 15,907
# grouping variables (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main
# cell cycle variables (1): cell_cycle_seurat
# projections (2): UMAP, UMAP_3D
# trees (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main
# most expressed genes: sample, seurat_clusters, cell_type_singler_blueprintencode_main
# marker genes:
#   - cerebro_seurat (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main,
# enriched pathways:
#   - cerebro_seurat_enrichr (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main,
#   - cerebro_GSVA (3): sample, seurat_clusters, cell_type_singler_blueprintencode_main,
#   - test (1): test2
# trajectories:
#   - monocle2 (1): highly_variable_genes

No trajectories

pbmc_Seurat_copy <- pbmc_Seurat

pbmc_Seurat_copy@misc$trajectories <- NULL

exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Extra material

Table

pbmc_Seurat_copy <- pbmc_Seurat

custom_table <- tibble(
  a = "this",
  b = "is",
  c = "a",
  d = "test"
)

pbmc_Seurat_copy@misc$extra_material$tables <- list(
  "test" = custom_table
)

exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Plot

library(ggplot2)

pbmc_Seurat_copy <- pbmc_Seurat

custom_plot <- ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point()

pbmc_Seurat_copy@misc$extra_material$plots <- list(
  "iris" = custom_plot
)

exportFromSeurat(
  pbmc_Seurat_copy,
  assay = 'SCT',
  slot = 'data',
  file = '~/Dropbox/Cerebro_development/pbmc_Seurat_dgCMatrix.crb',
  experiment_name = 'pbmc_Seurat',
  organism = 'hg',
  groups = c('sample','seurat_clusters','cell_type_singler_blueprintencode_main'),
  cell_cycle = c('cell_cycle_seurat'),
  nUMI = 'nCount_RNA',
  nGene = 'nFeature_RNA',
  add_all_meta_data = TRUE,
  verbose = FALSE
)

Format of expression data

dgCMatrix

cerebro_seurat <- readRDS('~/Dropbox/Cerebro_development/pbmc_Seurat.crb')
str(cerebro_seurat$expression)
cell_names <- colnames(cerebro_seurat$expression)
gene_names <- rownames(cerebro_seurat$expression)
cerebro_seurat$expression <- as(cerebro_seurat$expression, 'dgCMatrix')
str(cerebro_seurat$expression)
colnames(cerebro_seurat$expression) <- cell_names
rownames(cerebro_seurat$expression) <- gene_names
str(cerebro_seurat$expression)
saveRDS(cerebro_seurat, '~/Dropbox/Cerebro_development/pbmc_Seurat.crb')


romanhaa/cerebroApp documentation built on Nov. 25, 2021, 5:29 p.m.