DESeq2 effect of interaction when using a grouping variable
1
0
Entering edit mode
@suprunmaria-7729
Last seen 16 months ago
United States

Hi, I am interested in the interaction effect using a grouping variable. For example, using a classic DESeq2 example, is the difference in conditions A vs B differs by genotypes I vs II?

dds <- makeExampleDESeqDataSet(n=100,m=18)
dds$genotype <- factor(rep(rep(c("I","II","III"),each=3),2))
dds$group <- factor(paste0(dds$genotype, "_", dds$condition))
design(dds) <- ~  group
dds <- DESeq(dds)
resultsNames(dds)

# Comparison of interest: (I_A vs I_B) vs (II_A vs_B)
# Code below doesn't work, but is there a solution for this? 
results(dds, contrast=list(c("group", "I_A", "I_B"),
                           c("group", "II_A", "II_B")))


sessionInfo( )
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 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=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] biomaRt_2.50.3              ggplot2_3.3.6               edgeR_3.36.0                DESeq2_1.34.0              
 [5] SummarizedExperiment_1.24.0 Biobase_2.54.0              MatrixGenerics_1.6.0        matrixStats_0.62.0         
 [9] GenomicRanges_1.46.1        GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.4           
[13] BiocGenerics_0.40.0         limma_3.50.3                stringr_1.4.1               readxl_1.4.1               
[17] tximport_1.22.0             plyr_1.8.7                 

loaded via a namespace (and not attached):
 [1] bitops_1.0-7           bit64_4.0.5            filelock_1.0.2         RColorBrewer_1.1-3     progress_1.2.2        
 [6] httr_1.4.4             tools_4.1.2            utf8_1.2.2             R6_2.5.1               DBI_1.1.3             
[11] colorspace_2.0-3       withr_2.5.0            tidyselect_1.1.2       prettyunits_1.1.1      bit_4.0.4             
[16] curl_4.3.2             compiler_4.1.2         textshaping_0.3.6      cli_3.4.1              xml2_1.3.3            
[21] DelayedArray_0.20.0    labeling_0.4.2         scales_1.2.1           genefilter_1.76.0      rappdirs_0.3.3        
[26] systemfonts_1.0.4      digest_0.6.29          rmarkdown_2.16         XVector_0.34.0         pkgconfig_2.0.3       
[31] htmltools_0.5.3        dbplyr_2.2.1           fastmap_1.1.0          rlang_1.0.6            rstudioapi_0.14       
[36] RSQLite_2.2.18         farver_2.1.1           generics_0.1.3         BiocParallel_1.28.3    dplyr_1.0.10          
[41] RCurl_1.98-1.9         magrittr_2.0.3         GenomeInfoDbData_1.2.7 Matrix_1.5-1           Rcpp_1.0.9            
[46] munsell_0.5.0          fansi_1.0.3            lifecycle_1.0.2        stringi_1.7.8          yaml_2.3.5            
[51] zlibbioc_1.40.0        BiocFileCache_2.2.1    grid_4.1.2             blob_1.2.3             parallel_4.1.2        
[56] crayon_1.5.2           lattice_0.20-45        Biostrings_2.62.0      splines_4.1.2          annotate_1.72.0       
[61] hms_1.1.2              KEGGREST_1.34.0        locfit_1.5-9.6         knitr_1.40             pillar_1.8.1          
[66] geneplotter_1.72.0     XML_3.99-0.11          glue_1.6.2             evaluate_0.16          png_0.1-7             
[71] vctrs_0.4.2            cellranger_1.1.0       gtable_0.3.1           purrr_0.3.4            assertthat_0.2.1      
[76] cachem_1.0.6           xfun_0.33              xtable_1.8-4           ragg_1.2.3             survival_3.4-0        
[81] tibble_3.1.8           AnnotationDbi_1.56.2   memoise_2.0.1          statmod_1.4.37         ellipsis_0.3.2

Thank you!

DESeq2 • 299 views
ADD COMMENT
0
Entering edit mode
swbarnes2 ★ 1.3k
@swbarnes2-14086
Last seen 1 day ago
San Diego

Keep reading the interaction section of the vignette. I think you do not want the group method this time. I think you want Genotype + Condition + Genotype:Condition design.

ADD COMMENT

Login before adding your answer.

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