For loop for DESeq2
1
0
Entering edit mode
@neurogeneticsboy-22866
Last seen 4.8 years ago

Hi everyone,

I'm fairly new to coding and I've recently run into some trouble with my for loop for DESeq2 in R. Apologies if this is a dumb question!

To give some background, I have many different columns in my colData that I want to loop through one at a time for DESeq2 design, however, whenever I try to, it gives me an error "Error in validObject(object) : invalid class “DESeqDataSet” object: all variables in design formula must be columns in colData"

I would appreciate any insight if possible. Thank you so much. Not the best coder in the world.. (but I'm enjoying learning :) )

edit: colnames is this, where X1, X2, X3..n are different columns in the colData:

   colnames
1 x1
2 x2 
3 x3

For loop:

test <- for (i in colnames$colnames) {
  variable <- i 
  dds_del <- DESeqDataSet(del, design = ~ variable) #also tried [i] but it doesn't work
  design(dds_del) = ~ print(variable) #also tried this but doesn't work
  dds_del <- estimateSizeFactors(dds_del)
  dssvaLRT = DESeq(ddssva)
  shuffledres = list(results(ddssvaLRT_dup))
}

loop deseq2 rnaseq • 1.5k views
ADD COMMENT
1
Entering edit mode
@neurogeneticsboy-22866
Last seen 4.8 years ago

I figured it out! I just made a list of dataframes with each unique column instead and changed the input for DESeq as opposed to trying to change the design.

ADD COMMENT
0
Entering edit mode

what is the solution?

ADD REPLY

Login before adding your answer.

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