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
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
2 answers
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.
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
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.
Log in to answer this question.
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:
if someone could confirm this, that would be great. thanks.