ScRNA sequencing data _Seurat_Object_DESEQ2_Analayis_DGE
1
0
Entering edit mode
Jehan • 0
@d549d403
Last seen 2.2 years ago
United States

Hello everyone,

I have Single-cell RNA seq data consisting of 5 samples, untreated (day 0) and treated (day 1, 3, 5, and 10). I want to see the see DGE of the selected cluster between treated and untreated groups. I am using the following codes but it gives me an error, I am new to R and can not figure out where is the problem, I will really appreciate help in this regard.
(Note: Computer RAM 20GB)

######Libraries loaded##########
library(Seurat)
library(DESeq2)
library(ggplot2)
library(pheatmap)
library(patchwork)
library(dittoSeq)
library(parallel)
seurat <- readRDS("H:/Manuscripts/DS-Model_ScRNA_Seq_Analysis/DS_model_DR20.rds")
seurat$days <- plyr::mapvalues(seurat$orig.ident, from = c("S1_NS","S2_DS1","S3_DS3","S4_DS5","S5_DS10"), to = c(0, 1, 3, 5, 10))
  # Load dataset
counts <- seurat@assays$RNA@counts
metadata <- seurat@meta.data

  # Run DESeq2
dds <- DESeqDataSetFromMatrix(countData = round(counts),
                                colData = metadata,
                                design = ~days)
dds <- scran::computeSumFactors(dds)
#> dds <- DESeq(dds, test="LRT", reduced = ~1, useT=TRUE, minmu=1e-6, minReplicatesForReplace=Inf)
using pre-existing size factors
estimating dispersions
gene-wise dispersion estimates
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'obj' in selecting a method for function 'unname': error in evaluating the argument 'x' in selecting a method for function 'rowSums': cannot allocate vector of size 5.5 Gb



sessionInfo( )

R version 4.1.2 (2021-11-01) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages: [1] glmGamPoi_1.6.0 BiocManager_1.30.16 limma_3.50.0
[4] SeuratObject_4.0.4 DESeq2_1.34.0 SummarizedExperiment_1.24.0 [7] Biobase_2.54.0 MatrixGenerics_1.6.0 matrixStats_0.61.0
[10] GenomicRanges_1.46.1 GenomeInfoDb_1.30.0 IRanges_2.28.0
[13] S4Vectors_0.32.3 BiocGenerics_0.40.0 Matrix_1.3-4

loaded via a namespace (and not attached): [1] httr_1.4.2 edgeR_3.36.0 BiocSingular_1.10.0
[4] bit64_4.0.5 splines_4.1.2 scuttle_1.4.0
[7] DelayedMatrixStats_1.16.0 assertthat_0.2.1 statmod_1.4.36
[10] dqrng_0.3.0 blob_1.2.2 GenomeInfoDbData_1.2.7
[13] pillar_1.6.5 RSQLite_2.2.10 lattice_0.20-45
[16] glue_1.6.1 beachmat_2.10.0 RColorBrewer_1.1-2
[19] XVector_0.34.0 colorspace_2.0-2 plyr_1.8.6
[22] XML_3.99-0.9 pkgconfig_2.0.3 genefilter_1.76.0
[25] zlibbioc_1.40.0 purrr_0.3.4 xtable_1.8-4
[28] scales_1.1.1 ScaledMatrix_1.2.0 BiocParallel_1.28.3
[31] tibble_3.1.6 annotate_1.72.0 KEGGREST_1.34.0
[34] generics_0.1.1 ggplot2_3.3.5 ellipsis_0.3.2
[37] cachem_1.0.6 survival_3.2-13 magrittr_2.0.1
[40] crayon_1.4.2 memoise_2.0.1 fansi_1.0.2
[43] bluster_1.4.0 tools_4.1.2 lifecycle_1.0.1
[46] munsell_0.5.0 locfit_1.5-9.4 cluster_2.1.2
[49] DelayedArray_0.20.0 irlba_2.3.5 AnnotationDbi_1.56.2
[52] Biostrings_2.62.0 compiler_4.1.2 rsvd_1.0.5
[55] rlang_0.4.12 grid_4.1.2 RCurl_1.98-1.5
[58] BiocNeighbors_1.12.0 rstudioapi_0.13 SingleCellExperiment_1.16.0 [61] igraph_1.2.11 bitops_1.0-7 gtable_0.3.0
[64] DBI_1.1.2 R6_2.5.1 dplyr_1.0.7
[67] fastmap_1.1.0 bit_4.0.4 utf8_1.2.2
[70] metapod_1.2.0 parallel_4.1.2 Rcpp_1.0.8
[73] scran_1.22.1 vctrs_0.3.8 geneplotter_1.72.0
[76] png_0.1-7 tidyselect_1.1.1 sparseMatrixStats_1.6.0

DESeq2 • 1.1k views
ADD COMMENT
0
Entering edit mode

You don't think the bit about "Cannot allocate vector of size 5.5 Gb " is perhaps a hint as to the problem?

ADD REPLY
0
Entering edit mode

May be as I mentioned, I am very new to R and analysis so need help in this regards.

ADD REPLY
0
Entering edit mode
@mikelove
Last seen 23 hours ago
United States

What is the dimension of dds: dim(dds)?

You may want to do some minimal filtering before running DESeq2. Likely many genes have too low total count here.

Also, for single cell analysis we recommend fitType="glmGamPoi", see the current vignette.

ADD COMMENT
0
Entering edit mode

Thanks Michael for looking into this, here is the dim: dim(dds) [1] 17052 43239

Could you suggest a code to do filtration for the low count removal.

ADD REPLY
0
Entering edit mode

keep <- rowSums(counts(dds)) >= 10 dds <- dds[keep,]

Here is the default >= 10, I can go up to which number ? 20, 30,.........?

ADD REPLY
0
Entering edit mode

I think with 43k cells you should use a different framework, try the glmGamPoi infrastructure for example:

https://github.com/const-ae/glmGamPoi#example

I will first load an example dataset using the TENxPBMCData package. The dataset has 33,000 genes and 4340 cells. It takes roughly 1.5 minutes to fit the Gamma-Poisson model on the full dataset.

ADD REPLY

Login before adding your answer.

Traffic: 351 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6