Error in cleanContrast
1
0
Entering edit mode
@laurenfitch-11575
Last seen 3.9 years ago

I have run DESeq2 successfully on my dataset with several different contrasts; however, when I try to run this one I get the following error:

> dds <- DESeqDataSetFromMatrix(
+     countData = countdata.strict,
+     colData = samples.strict,
+     design = ~ group
+ )
converting counts to integer mode
> dds <- DESeq(dds)
estimating size factors
estimating dispersions
gene-wise dispersion estimates
mean-dispersion relationship
final dispersion estimates
fitting model and testing
-- replacing outliers and refitting for 1279 genes
-- DESeq argument 'minReplicatesForReplace' = 7
-- original counts are preserved in counts(dds)
estimating dispersions
fitting model and testing
> res <- results(dds, contrast = c("group", "HDGSE85", "HDGSE86"))
Error in cleanContrast(object, contrast, expanded = isExpanded, listValues = listValues,  :
  groupHDGSE85 and groupHDGSE86 are expected to be in resultsNames(object)

> resultsNames(dds)
[1] "Intercept"     "groupHDGSE86"  "groupHDGSE87"  "groupHDSGSE85"
> 

"group" in this case indicates sequencing batch. I have run a contrast using "state" already with no problem. Here's what my sample data looks like:

> samples.strict
               group genealine state sex filter.strict filter.relaxed replicate observationid EffectiveAlignmentCount
G002.R1.CTL HDSGSE85      G002   CTL   M         FALSE          FALSE         1  G002_CD140_a               151040648
G002.R2.CTL HDSGSE85      G002   CTL   M         FALSE          FALSE         2  G002_CD140_b               142144646
G002.R3.CTL HDSGSE85      G002   CTL   M         FALSE          FALSE         3  G002_CD140_c               128589118
G002.R4.CTL HDSGSE85      G002   CTL   M         FALSE          FALSE         4  G002_CD140_d               152415461
G002.R5.CTL HDSGSE85      G002   CTL   M         FALSE          FALSE         5  G002_CD140_e               135059579
G002.R6.CTL HDSGSE85      G002   CTL   M         FALSE          FALSE         6  G002_CD140_f               121105092
G017.R1.HD   HDGSE86      G017    HD   M         FALSE          FALSE         1         SG17a                44082945
G017.R2.HD   HDGSE86      G017    HD   M         FALSE          FALSE         2         SG17b                43321404
G017.R3.HD   HDGSE86      G017    HD   M         FALSE          FALSE         3         SG17c                39897764
G017.R4.HD   HDGSE86      G017    HD   M         FALSE          FALSE         4         SG17e                55759593
G017.R5.HD   HDGSE86      G017    HD   M         FALSE          FALSE         5         SG17f                40662631
G018.R1.HD   HDGSE86      G018    HD   F         FALSE          FALSE         1         SG18a                47275799
G018.R3.HD   HDGSE86      G018    HD   F         FALSE          FALSE         3         SG18c                44562212
G018.R4.HD   HDGSE86      G018    HD   F         FALSE          FALSE         4         SG18d                48443633
G018.R5.HD   HDGSE86      G018    HD   F         FALSE          FALSE         5         SG18f                47221901
G019.R6.CTL  HDGSE87      G019   CTL   F         FALSE          FALSE         6       SG-G19d                23390368
G020.R3.HD   HDGSE87      G020    HD   F         FALSE          FALSE         3       SG-G20a                20107140
>

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

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

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

other attached packages:
[1] calibrate_1.7.2            MASS_7.3-45                genefilter_1.56.0          RColorBrewer_1.1-2       
[5] gplots_3.0.1               DESeq2_1.14.0              SummarizedExperiment_1.4.0 Biobase_2.34.0           
[9] GenomicRanges_1.26.1       GenomeInfoDb_1.10.0        IRanges_2.8.0              S4Vectors_0.12.0         
[13] BiocGenerics_0.20.0       

loaded via a namespace (and not attached):
[1] Rcpp_0.12.7          plyr_1.8.4           XVector_0.14.0       bitops_1.0-6         tools_3.3.1        
[6] zlibbioc_1.20.0      rpart_4.1-10         RSQLite_1.0.0        annotate_1.52.0      gtable_0.2.0       
[11] lattice_0.20-33      Matrix_1.2-6         DBI_0.5-1            gridExtra_2.2.1      cluster_2.0.4      
[16] caTools_1.17.1       gtools_3.5.0         locfit_1.5-9.1       grid_3.3.1           nnet_7.3-12        
[21] data.table_1.9.6     AnnotationDbi_1.36.0 XML_3.98-1.4         survival_2.39-5      BiocParallel_1.8.0 
[26] foreign_0.8-67       gdata_2.17.0         latticeExtra_0.6-28  Formula_1.2-1        geneplotter_1.52.0 
[31] ggplot2_2.1.0        Hmisc_3.17-4         scales_0.4.0         splines_3.3.1        colorspace_1.2-7   
[36] xtable_1.8-2         KernSmooth_2.23-15   acepack_1.4.0        RCurl_1.95-4.8       munsell_0.4.3      
[41] chron_2.3-47

 

deseq2 r error • 5.3k views
ADD COMMENT
0
Entering edit mode

I was able to run the contrast successfully using this code. I'm still not sure why the original doesn't work, though.

 

> resultsNames(dds)
[1] "Intercept"     "groupHDGSE86"  "groupHDGSE87"  "groupHDSGSE85"
> res <- results(dds, contrast = c(0, -1, 0, 1))
> 
ADD REPLY
1
Entering edit mode
@mikelove
Last seen 5 hours ago
United States

Took me some looking until i saw it:

results(dds, contrast = c("group", "HDGSE85", "HDGSE86"))

But you have labelled one of the groups with an extra 'S': HDSGSE85

This is also why they are in non-alphabetic level order in colData(dds).

ADD COMMENT
0
Entering edit mode

Sometimes you just need another pair of eyes - thank you!

ADD REPLY

Login before adding your answer.

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