DESeq2 Error: Error: $ operator is invalid for atomic vectors
0
0
Entering edit mode
4.5 years ago
Ulduz ▴ 20

Hi, I am using Salmon+DEseq2 for differential expression analysis. No matter wha I change, I always get the same error running the following DEseq command:

    > dds <- DESeq(ddsTxi, parallel = TRUE, BPPARAM = 7)
estimating size factors
using 'avgTxLength' from assays(dds), correcting for library size
Error: $ operator is invalid for atomic vectors

Here is my sample table:

> samples
     sample condition
0h-1   0h-1        0h
0h-2   0h-2        0h
0h-3   0h-3        0h
6h-1   6h-1        6h
6h-2   6h-2        6h
6h-3   6h-3        6h

And I use tximport to import the count data:

> txi.salmon <- tximport(files, type = "salmon", tx2gene = tx2gene,  dropInfReps=TRUE)
reading in files with read_tsv
1 2 3 4 5 6 
transcripts missing from tx2gene: 109962
summarizing abundance
summarizing counts
summarizing length
> head(txi.salmon$counts)
                       0h-1      0h-2     0h-3      6h-1     6h-2    6h-3
ENSG00000000003.14  0.00000  0.000000  0.00000  2.269590 2.131460 0.00000
ENSG00000000005.5   0.00000  0.000000  0.00000  0.000000 2.000003 2.00000
ENSG00000000419.12  0.00000  2.834260  4.93908  2.395780 5.990420 2.60801
ENSG00000000457.13  7.93432 18.139500 16.71350 31.386900 4.790690 7.84324
ENSG00000000938.12  0.00000  0.000000  0.00000  0.000000 0.000000 0.00000
ENSG00000000971.15 12.89304  4.227141  6.21801  0.713425 1.000000 5.41967

And I get the atomic vector error, when I try to use DESeq command...

> ddsTxi <- DESeqDataSetFromTximport(txi.salmon,
+                                    colData = samples,
+                                    design = ~ condition)
using counts and average transcript lengths from tximport
> dds <- DESeq(ddsTxi, parallel = TRUE, BPPARAM = 7)
estimating size factors
using 'avgTxLength' from assays(dds), correcting for library size
Error: $ operator is invalid for atomic vectors

and here is my session info:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=tr_TR.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=tr_TR.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=tr_TR.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=tr_TR.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] RColorBrewer_1.1-2          gplots_3.0.1.1              readr_1.3.1                 tximport_1.12.3             lattice_0.20-38            
 [6] DESeq2_1.24.0               SummarizedExperiment_1.14.1 DelayedArray_0.10.0         BiocParallel_1.18.1         matrixStats_0.55.0         
[11] Biobase_2.44.0              GenomicRanges_1.36.1        GenomeInfoDb_1.20.0         IRanges_2.18.3              S4Vectors_0.22.1           
[16] BiocGenerics_0.30.0        

loaded via a namespace (and not attached):
 [1] bit64_0.9-7            splines_3.6.1          gtools_3.8.1           Formula_1.2-3          assertthat_0.2.1       latticeExtra_0.6-28   
 [7] blob_1.2.0             GenomeInfoDbData_1.2.1 pillar_1.4.2           RSQLite_2.1.2          backports_1.1.4        glue_1.3.1            
[13] digest_0.6.21          XVector_0.24.0         checkmate_1.9.4        colorspace_1.4-1       htmltools_0.3.6        Matrix_1.2-17         
[19] XML_3.98-1.20          pkgconfig_2.0.3        genefilter_1.66.0      zlibbioc_1.30.0        purrr_0.3.2            xtable_1.8-4          
[25] scales_1.0.0           gdata_2.18.0           htmlTable_1.13.2       tibble_2.1.3           annotate_1.62.0        ggplot2_3.2.1         
[31] nnet_7.3-12            lazyeval_0.2.2         survival_2.44-1.1      magrittr_1.5           crayon_1.3.4           memoise_1.1.0         
[37] foreign_0.8-72         tools_3.6.1            data.table_1.12.2      hms_0.5.1              stringr_1.4.0          locfit_1.5-9.1        
[43] munsell_0.5.0          cluster_2.1.0          AnnotationDbi_1.46.1   compiler_3.6.1         caTools_1.17.1.2       rlang_0.4.0           
[49] grid_3.6.1             RCurl_1.95-4.12        rstudioapi_0.10        htmlwidgets_1.3        bitops_1.0-6           base64enc_0.1-3       
[55] gtable_0.3.0           DBI_1.0.0              R6_2.4.0               gridExtra_2.3          knitr_1.25             dplyr_0.8.3           
[61] bit_1.1-14             zeallot_0.1.0          Hmisc_4.2-0            KernSmooth_2.23-15     stringi_1.4.3          Rcpp_1.0.2            
[67] vctrs_0.2.0            geneplotter_1.62.0     rpart_4.1-15           acepack_1.4.1          tidyselect_0.2.5       xfun_0.9

I am still learning... and I would be grateful if you could help.

RNA-Seq DESeq2 deseq2 tximport • 2.3k views
ADD COMMENT
0
Entering edit mode

How are you getting tx2gene? Your counts matrix is annotated with transcript versions (i.e. they are ENSTXXXXXXX.YY - the YY here is the transcript version). Most methods for getting tx2gene will give you annotations without the versions, so the annotations won't' match up.

ADD REPLY
0
Entering edit mode

For this one I used tx2gene with tximport data. Which has the transcript version... (the YY part)

ADD REPLY

Login before adding your answer.

Traffic: 2460 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