Search
Question: Receiving error trying to import matrix into DESeq2
0
6 months ago by
rbronste60
rbronste60 wrote:

I am trying the following code and getting an error I am unsure how to fix:

countData<-read.csv("p14_binding.csv")
rownames(countData) <- countData[,1]
countData[,1] <- NULL

sampleNames<-c("MB1",    "MB2",    "MB3",    "FB1",    "FB2",    "FB3",    "MM1",    "MM2",    "MM3",    "FM1",    "FM2",    "FM3")
sampleSex<-c("male", "male", "male", "female", "female", "female", "male", "male", "male", "female", "female", "female")
sampleAge<-c("p14", "p14", "p14", "p14", "p14", "p14", "p14", "p14", "p14", "p14", "p14", "p14")
colData<-data.frame(sampleName=sampleNames, sex=sampleSex, age=sampleAge)

dds<-DESeqDataSetFromMatrix(countData = countData,
colData = colData,
design = ~ sex + age + age:sex)

Receiving the following error, I think having something to do with the way my input matrix is designed - as it was imported from diffbind so is not a list of genes but rather a list of binding counts from which I cut the chromosome start-end sites:

Error in DESeqDataSet(se, design = design, ignoreRank) :
design contains one or more variables with all samples having the same value,
remove these variables from the design

Thanks for your help!

LANGUAGE_DETECTION = []
modified 6 months ago by Andy9150 • written 6 months ago by rbronste60
2
6 months ago by
Andy9150
Netherlands
Andy9150 wrote:

I cannot say anything about your count matrix as you would have to provide an example of it (i.e. head(countData)).

The error seems to suggest that your provided design matrix ("colData") is not well designed. If the provided example is what you are using, the issue would be that the "Age" object contains only one level: "p14". Assuming this covariate represents age, one cannot properly correct for age as all your samples are obtained from the same age, you cannot say something about a "p15" or "p16" for example. The same goes for the interaction between "Age" and "Sex". Try removing "Age" and "Age:Sex" and see whether that works.