Deseq2 design matrix
1
0
Entering edit mode
Neha • 0
@d0e941a2
Last seen 4 months ago
United Kingdom

I am executing the deseq2 for two conditions sick and healthy. Each condition has 4 cell types defined as group (a1, b1, c1 and d1, a2, b2, c2, d2). each group has 3 replicates. (a1:3...d2:3). condition_group is third column (sick_a1, sick_a2...so ) I want to compare different contrasts like

Sample Condition Group 11 healthy a2 13 sick b1 14 sick c1 15 sick d1 17 sick a1 19 healthy b2 1 sick b1 20 healthy c2 21 healthy d2 32 healthy c2 23 healthy a2 33 healthy d2 25 sick b1 35 healthy a2 26 sick c1 3 sick d1 27 sick d1 5 sick a1 29 sick a1 7 healthy b2 2 sick c1 8 healthy c2 31 healthy b2 9 healthy d2

my code is:

> metadata_sorted$Group <- factor(metadata_sorted$Group)
> metadata_sorted$Condition <- factor(metadata_sorted$Condition)
> col_data_sorted <- DataFrame(
+     Condition = metadata_sorted$Condition,
+     Group = metadata_sorted$Group,
+     row.names = metadata_sorted$Sample
+ )
> col_data_correct_order <- col_data_sorted[match(colnames(filtered_count_matrix), rownames(col_data_sorted)),]
> if(!all(rownames(col_data_correct_order) == colnames(filtered_count_matrix))) {
+     stop("There is still a mismatch between the colData and countData columns.")
+ }
> 
> dds <- DESeqDataSetFromMatrix(countData = filtered_count_matrix,
+                               colData = col_data_correct_order,
+                               design = ~ Condition + Group)
> dds <- DESeq(dds)
> rlog_transformed <- rlog(dds, blind = FALSE) 
> vst_transformed <- vst(dds, blind = FALSE) 
> head(assay(rlog_transformed))
resultsNames(dds)
res <- results(dds, contrast=c("ConditionNormal.Groupa1", "ConditionHealthy.Groupa1"))

Error:
Error in checkContrast(contrast, resNames) : 
  all elements of the contrast as a list of length 2 should be elements of 'resultsNames(object)'

I will be heartily thankful to you to help me to correct the design and perform ...

In limma it is showing same error for contrasts

DESeq2 Designmatrix limma • 307 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 13 hours ago
United States

The error is telling you that the contrast elements you specify are not in resultsNames(dds). You need to choose contrast elements that are in resultsNames(dds)

Login before adding your answer.

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