- Last column name doesn't match between your code and the data you pasted here (Control2 Vs Control.2)
Following part of your code is creating 6 empty columns and is this what you want? This would create 6 additional columns in countTableFilt table (with column names Fast, Fast.1, Fast.2, Slow, Slow.1 and Slow.2)
countTableFilt$Fast<-as.integer(countTableFilt$Treat)
countTableFilt$Fast.1<-as.integer(countTableFilt$Treat.1)
countTableFilt$Fast.2<-as.integer(countTableFilt$Treat.2)
countTableFilt$Slow<-as.integer(countTableFilt$Control)
countTableFilt$Slow.1<-as.integer(countTableFilt$Control.1)
countTableFilt$Slow.2<-as.integer(countTableFilt$Control.2)
Following command in your code should throw an error. This is because there are 6 conditions and your column numbers are now 12 after running above command. I am not sure why it didn't
(coldata <- data.frame(row.names=colnames(countTableFilt), conds))
To reproduce the issue, I did following things to cross check if your code works and it seems code has no problems:
1) I created a tsv with the values you furnished with name "rsem.txt":
Treat Treat.1 Treat.2 Control Control.1 Control.2
comp0_c0_seq1 4 0 1 0 1 0
comp0_c1_seq1 1 0 3 1 2 1
comp100000_c0_seq1 0 0 1 1 2 2
comp100001_c0_seq1 1 0 0 4 3 4
comp100002_c0_seq1 5 1 4 0 1 4
comp100003_c0_seq1 3 0 1 1 1 1
2) I copy/pasted your code and ran the code. It didn't give me any error. Please note that I modified rs value (from 180 to 1) so that values are not filtered out and modified code not to create any new columns. In my opinion, "as.integer" code is not necessary (for all the 6 cols). I ran the code with and without "as.integer" arguments, code works in either case.
library(DESeq2)
countdata<-read.table("rsem.txt",sep="\t",header=TRUE,row.names=1)
rs<-rowSums(countdata)
rs
use<-(rs>1)
use
countTableFilt<-countdata[use,]
countTableFilt
colnames(countTableFilt)
dim(countTableFilt)
colnames(countTableFilt)
countTableFilt$Treat<-as.integer(countTableFilt$Treat)
countTableFilt$Treat.1<-as.integer(countTableFilt$Treat.1)
countTableFilt$Treat.2<-as.integer(countTableFilt$Treat.2)
countTableFilt$Control<-as.integer(countTableFilt$Control)
countTableFilt$Control.1<-as.integer(countTableFilt$Control.1)
countTableFilt$Control.2<-as.integer(countTableFilt$Control.2)
conds<-factor(c("Treat","Treat","Treat","Control","Control","Control"))
data.frame(conds)
colnames(countTableFilt)
coldata <- data.frame(row.names=colnames(countTableFilt), conds)
countTableFilt
dds<-DESeqDataSetFromMatrix(countData=countTableFilt,colData=coldata,design=~conds)
Please check your object properties and also the package versions you are using. I would suggest to post session info and few header lines from your data?
I simulated a small data set using the information provided above. It worked fine on my machine. Script I ran:
My session info:
Hi cpad0112,
I am sorry about that. Here is my session info:
And here are the first lines of my data:
Thank you very much.
Mina
Version 1.0.19 is from 2013 (or 2012?), you might want to upgrade your version of R and the packages.