deseq2 nested multifactorial analysis
Entering edit mode
jd • 0
Last seen 6 months ago

I would like to do a meta analysis where I subtract control from treatment, and then compare treatments:

I initially did these pairwise comparisons: Control A v Treatment A Control B v Treatment B Control C v Treatment C Control D v Treatment D

But I would like to do these two meta comparisons:

  1. A (Control A - Treatment A) v B (Control B - Treatment B)
  2. C (Control C - Treatment C) v D (Control D - Treatment D)

I have tried like this:

deseqFile1 <- "B3_v_B8.csv"
countData1 <- read.table(deseqFile1, header = T, sep = ",", row.names = 1)
sampleNames1 <- colnames(countData1)
sampleCondition1 <- c("Control_1","Control_1","Control_1","Treatment_1", "Treatment_1","Treatment_1", "Control_2", "Control_2", "Control_2", "Treatment_2", "Treatment_2", "Treatment_2")
sampleCondition2<- c("A","A","A","A","A","A","B","B","B","B","B","B")
colData1<- data.frame(condition=sampleCondition1, genotype=sampleCondition2)

row.names(colData1) = sampleNames1
all(rownames(colData1) == colnames(countData1))
dds1 <- DESeqDataSetFromMatrix(countData = countData1,
                               colData = colData1,
                               design = ~ condition+genotype)

But I get the following error:

Error in checkFullRank(modelMatrix) : the model matrix is not full rank, so the model cannot be fit as specified. One or more variables or interaction terms in the design formula are linear combinations of the others and must be removed.

Please read the vignette section 'Model matrix not full rank':


Is there a way to do design the analysis without getting this error?



# include your problematic code here with any corresponding output 
# please also include the results of running the following in an R session 

sessionInfo( )
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] EnhancedVolcano_1.16.0      KEGGREST_1.38.0             gage_2.48.0                
 [4] clusterProfiler_4.6.0       Cairo_1.6-0                 PCAtools_2.10.0            
 [7] ggrepel_0.9.3               devtools_2.4.5              usethis_2.1.6              
[10] viridis_0.6.2               viridisLite_0.4.1           scales_1.2.1               
[13] apeglm_1.20.0               DESeq2_1.38.3               SummarizedExperiment_1.28.0
[16] Biobase_2.58.0              MatrixGenerics_1.10.0       matrixStats_0.63.0         
[19] GenomicRanges_1.50.2        GenomeInfoDb_1.34.9         IRanges_2.32.0             
[22] S4Vectors_0.36.1            BiocGenerics_0.44.0         party_1.3-11               
[25] strucchange_1.5-3           sandwich_3.0-2              zoo_1.8-11                 
[28] modeltools_0.2-23           mvtnorm_1.1-3               randomForest_4.7-1.1       
[31] knitr_1.42                  skimr_2.1.5                 forcats_1.0.0              
[34] stringr_1.5.0               dplyr_1.1.0                 purrr_1.0.1                
[37] readr_2.1.3                 tidyr_1.3.0                 tibble_3.1.8               
[40] ggplot2_3.4.1               tidyverse_1.3.2             wesanderson_0.3.6
DESeq2 multifactorial nested • 220 views
Entering edit mode
Basti ▴ 720
Last seen 1 day ago

The information on genotype is included in the condition : all Control_1 are A, all Control_2 are B The condition variable is sufficient to perform the contrasts you need


Login before adding your answer.

Traffic: 601 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6