DESeq2: Error: $ operator is invalid for atomic vectors using DESeqDataSetFromMatrix
1
1
Entering edit mode
9.5 years ago

Hi,

I want to use DESeq2 to perform some differential expression analysis. I've an expression matrix a2 (raw read count computed using featureCounts) and a design table d2 with two variables (a and b). When I try to create a deseq2 object using DESeqDataSetFromMatrix, an error appears:

> dds <- DESeqDataSetFromMatrix(a2,d2,"~a+b")
Error: $ operator is invalid for atomic vectors

I don't understand why it didn't work. I tried with the pasilla data and it worked perfectly...

Anyone has an idea of the origin of the problem?

Here are a subset of a2 and d2

a2: count Table

a2[1:10,]
                  a_1  a_2  a_3  a_4   a_5  a_6  a_7  a_8 a_9 a_10 a_11 a_12  a_13  a_14  a_15  a_16  a_17 a_18 a_19 a_20  a_21  a_22  a_23  a_24 a_25
ENSG00000006459   752 2883 3088  860  2854 1673 4303 2013   0 4345 1863 4743  2474  5609  5741   893  3559    2 2103 1708  6320  4545  2597  1406 1144
ENSG00000015153   287 1101 1448  607  1470 1748 2130  805   0 1347  717 2186  1014  2402  1714   856  1848    2  484  666  1594  1519   580  1499  548
ENSG00000208892    56  438  418  190   787 1022  712  370   0 1410  447  519   292   509  1432   167   173    1  768  340   520   407   147   229  139
ENSG00000110911   231 1072 1478  681  1094 1073 2035  614   0  653  524  873   799  1669  2815   551  1207    1  630  392  1219  1013   957   531  423
ENSG00000127914  1809 4610 4400 3296 10421 7276 7133 3693   0 9658 4708 9817  5072 14495 14322  4699  4222    5 5790 3964 11958  8508  5991  4912 1621
ENSG00000201367     0   23   25    6    52   42   94   43   0   18   16   92     8    40    17    11    10    0   13   11     8     9     8    20   19
ENSG00000221491    68  361  684  184   465  684  524  196   0  631  208  218   408   584  1908   210   260    2  431  174   469   373   217   368  121
ENSG00000271204    51  488  293  177  1150  696 1183  637   0  627 1186  824   356   423   175   135   148    0  330  173   250   339   156   474  385
ENSG00000067560 17478 9436 4175 9112  7122 4130 5550 2073   0 4584 4954 5485 17002 24242 19505 13329 12473    4 2723 2414 10176 22690 23568 15524 2610
ENSG00000136044   427  709  617  559   826 1253 1098  460   0  689  634 1087   787  1859  1485   469   906    2  651  340  1210  1216   744  1014  442

d2: design table with tow variables

d2
             a   b
a_1    treated old
a_2  untreated old
a_3  untreated old
a_4    treated new
a_5  untreated old
a_6  untreated old
a_7  untreated new
a_8  untreated old
a_9  untreated old
a_10 untreated old
a_11 untreated old
a_12 untreated old
a_13   treated old
a_14 untreated old
a_15 untreated new
a_16   treated new
a_17 untreated old
a_18 untreated old
a_19 untreated old
a_20 untreated old
a_21 untreated old
a_22   treated old
a_23   treated old
a_24 untreated old
a_25 untreated old

sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows XP (build 2600) Service Pack 3

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                   LC_TIME=French_France.1252

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

other attached packages:
 [1] pasilla_0.5.1             DESeq_1.18.0              lattice_0.20-30           locfit_1.5-9.1            Biobase_2.26.0            DESeq2_1.6.3              RcppArmadillo_0.5.100.1.0 Rcpp_0.11.6
 [9] GenomicRanges_1.18.4      GenomeInfoDb_1.2.5        IRanges_2.0.1             S4Vectors_0.4.0           BiocGenerics_0.12.1       BiocInstaller_1.16.4

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3      annotate_1.44.0      AnnotationDbi_1.28.2 base64enc_0.1-2      BatchJobs_1.6        BBmisc_1.9           BiocParallel_1.0.3   brew_1.0-6           checkmate_1.5.2      cluster_2.0.1        codetools_0.2-10
[12] colorspace_1.2-6     DBI_0.3.1            digest_0.6.8         fail_1.2             foreach_1.4.2        foreign_0.8-63       Formula_1.2-1        genefilter_1.48.1    geneplotter_1.44.0   ggplot2_1.0.1        grid_3.1.3
[23] gridExtra_0.9.1      gtable_0.1.2         Hmisc_3.16-0         iterators_1.0.7      latticeExtra_0.6-26  magrittr_1.5         MASS_7.3-39          munsell_0.4.2        nnet_7.3-9           plyr_1.8.2           proto_0.3-10
[34] RColorBrewer_1.1-2   reshape2_1.4.1       rpart_4.1-9          RSQLite_1.0.0        scales_0.2.4         sendmailR_1.2-1      splines_3.1.3        stringi_0.4-1        stringr_1.0.0        survival_2.38-1      tools_3.1.3
[45] XML_3.98-1.1         xtable_1.7-4         XVector_0.6.0
deseq2 DESeqDataSetFromMatrix • 9.3k views
ADD COMMENT
3
Entering edit mode
9.5 years ago

Try it without quotes around the design.

ADD COMMENT
0
Entering edit mode
dds <- DESeqDataSetFromMatrix(a2,d2,~a+b)
Warning message:
In DESeqDataSet(se, design = design, ignoreRank) :
  some variables in design formula are characters, converting to factors
ADD REPLY
2
Entering edit mode

That looks better. The warning is about the dataframe (d2), which apparently is using characters rather than factors.

ADD REPLY
0
Entering edit mode

thanks it works

ADD REPLY

Login before adding your answer.

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