Question: adding batch variable in colData(dds)
0
gravatar for Mozart
12 weeks ago by
Mozart140
Mozart140 wrote:

Dear all, I am quite struggling with some sort of coding here. Essentially, what I am trying to do is to simply add the batch variable to my design in DESeq2. Thus, I am doing:

dds$batch = factor(c('1','1','2','2','3','3'))
dds <- DESeqDataSetFromTximport(txi.kallisto.tsv, table, ~batch+condition)

but it returns an error message

Error in DESeqDataSet(se, design = design, ignoreRank) : all variables in design formula must be columns in colData

perfect, but when I type

colData(dds)

it returns, as expected, two columns:

> colData(dds)
DataFrame with 6 rows and 2 columns
          condition    batch
           <factor> <factor>
sample_1      wt        1
sample_2      ko        1
sample_3      wt        2
sample_4      ko        2
...

any ideas?

Thanks in advance

deseq2 • 215 views
ADD COMMENTlink modified 11 weeks ago by prabin.dm160 • written 12 weeks ago by Mozart140

It really seems that you need to create the same identical column in sample table, too. Thus, by doing this you should mange to solve the problem:

sampletable$batch=factor(c('1','1','2','2','3','3'))

if someone could confirm this, that would be great. thanks.

ADD REPLYlink written 12 weeks ago by Mozart140
2
gravatar for prabin.dm
11 weeks ago by
prabin.dm160
USA/Amherst/Umass
prabin.dm160 wrote:

Have a look at the DESeq2 vignette

library("DESeq2")
ddsTxi <- DESeqDataSetFromTximport(txi,
                                   colData = samples,
                                   design = ~ condition)

As the error msg says, the colData should have the batch variables as a column, that is your table. So instead adding a column to dds if you add your batch column to your table which is your colData, it should work.

ADD COMMENTlink written 11 weeks ago by prabin.dm160

Thanks so much for your reply; soon thereafter my thread I tried to add by myself this other column to my table and your reply comes as a confirmation for me. Thanks

ADD REPLYlink written 11 weeks ago by Mozart140
0
gravatar for swbarnes2
12 weeks ago by
swbarnes26.2k
United States
swbarnes26.2k wrote:

You need to stop and think and understand what your commands are doing, not make things up. It does no good to add things to dds when your next command is trying (and failing) to remake it from scratch. You need to find some tutorials and walk through them step by step so that you can understand what each command is doing

ADD COMMENTlink written 12 weeks ago by swbarnes26.2k

Hi and thanks for your reply. Literally I got confounded by the double approach to deal with batch effect in DESeq2 because, reading the manual and other posts on bioconductor and here, apparently dds$batch is required once you have your counts transformed (e.g. vsd) for visualisation purposes. So, correct myself if I am doing something wrong here, please.

ADD REPLYlink written 11 weeks ago by Mozart140

Hi Mozart, did you figure it out? cause I have the same problem

thanks

ADD REPLYlink written 4 weeks ago by Morris_Chair120

see here: link

ADD REPLYlink written 4 weeks ago by Mozart140
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 823 users visited in the last hour