multiple condition issue running DESeq
1
0
Entering edit mode
Kelly • 0
@16bdd42f
Last seen 10 days ago
United States

Hi y'all. I am VERY new to code, and I am trying to get the results of three conditionals that I need to run against each other. The conditions are "old", "young" and "adult". I am running a basic code of:

Code should be placed in three backticks as shown below

res_age <- results(dds, contrast = c("age", "old" "young", "adult"))
res_age

write.csv(res_age, "deseq_age.csv")

but I get an error since I cannot run more than 2 conditionals together at once. However, when I attempt to run the code doing two at a time such as old and young, young and adult, and adult and old, none of my code seems to be working. I have tried setting up a code like this:

##results for age
res_age <- results(dds, contrast = c("age", "young", "adult"))
res_age

write.csv(res_age, "deseq_age.csv")

##results for age 2
res_age_2 <- results(dds, contrast = c("age", "old", "young"))
res_age_2

write.csv(res_age_2, "deseq_age_2.csv")

##results for age 3
res_age_3 <- results(dds, contrast = c("age", "old", "adult"))
res_age_3

write.csv(res_age_3, "deseq_age_3.csv")

but I get an error after the first line saying

Error in cleanContrast(object, contrast, expanded = isExpanded, listValues = listValues,  : 
  as adult is the reference level, was expecting age_young_vs_adult to be present in 'resultsNames(object)

how would I go about running each of these three conditions against each other so that I will have old vs young, young vs adult, and adult vs old. Thank you!!!!

DESeq2 • 133 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 13 hours ago
United States

but I get an error

Yes, R functions are strict and with Bioc functions, if the argument expects three things, with the right checks it will give an error.

If you type

?results

you will get the man page (help page) that says:

results: this argument specifies what comparison to extract from the object to build a results table. one of either: a character vector with exactly three elements: the name of a factor in the design formula, the name of the numerator level for the fold change, and the name of the denominator level for the fold change (simplest case)...

So since it is a character vector but has more than three elements you get the error (good! we don't want software doing unexpected things with unexpected input, it shouldn't guess what you meant by something)

With the other error you post, it gives you a clue to look at resultsNames(dds), have you done that?

ADD COMMENT

Login before adding your answer.

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