This is a test version of Biostars. For the public version, visit https://www.biostars.org.
assign conditions in DESeq2

Hi everyone,

I have one question about the command line for assigning conditions in DESeq2. The following are the count table I got. I want to assign WT6A, WT6B and WT6C as controls (3 replicates) and KO6A, KO6B and KO6C (3 replicates) as treated samples. column 1 is the gene name. column2-4 will be controls and column5-7 will be the treated samples.

  • WT6A WT6B WT6C KO6A KO6B KO6C
  • dnaA 6594 7412 3401 9067 7344 3803
  • dnaN 4274 5048 3680 7368 7300 6571

How should I write the command line for this?

Thanks, Yong

rna-seq r deseq2

you can change the original question from the edit button down the question instead of rewrite it as an answer, after editing your question you can remove the answer below from moderate

Thanks for the information! Yong

Do you already have everything in a single file or data.frame? If so, see help(DESeqDataSetFromMatrix).

Thanks Ryan! I'm really bad at coding. I checked the website. I still cannot figure out. My experiment is pretty straight forward. It's two-group comparison between control and treatment. Each group has 3 replicates. This is the code I typed in R:

coldata=data.frame(row.names=c('WT6A', 'WT6B', 'WT6C','KO6A','KO6B','KO6C'),
                   group=rep(c("WT6","KO6"),3,each=3),
                   treatment=rep(c("control","treated"),each=3)).

However, there is an error: Error in data.frame(row.names = c("WT6A", "WT6B", "WT6C", "KO6A", "KO6B", : row names supplied are of the wrong length.

Could you please let me know how to fix this problem?

coldata=data.frame(row.names=c('WT6A', 'WT6B', 'WT6C','KO6A','KO6B','KO6C'),
               treatment=rep(c("control","treated"),each=3))

The "group" part is redundant and was producing a vector of length 18 (rather than 6) anyway, due to having an extra 3 in there.

Thanks! I have another mistake in the code.

> library("DESeq2")
> countMatrix <- read.table ("file.txt", header=TRUE, row.names=1)
> coldata=data.frame(row.names=c('WT6A', 'WT6B', 'WT6C','KO6A','KO6B','KO6C'),treatment=rep(c("control","treated"),each=3))
> coldata
     treatment
WT6A   control
WT6B   control
WT6C   control
KO6A   treated
KO6B   treated
KO6C   treated
> dds=DESeqDataSetFromMatrix(countData=countMatrix,colData=coldata,design=~treatment)
**Error** in DESeqDataSet(se, design = design, ignoreRank) : 
  some values in assay are not integers.

How can I fix this? and How can I set the control group as the basal level if I want to compare treated samples with control samples? Is the following code right?

> coldata$treatment<-relevel(coldata$treatment,ref='control')

Thanks a lot!

The control group is already the base level, "control" is lexicographically before "treated".

The error is due to there being non-integer values in countMatrix. Figure out what that is and fix it.

0 answers

No answers yet.

Log in to answer this question.