I am a relatively novice bioinformatician and want to perform differential expression on my RNASeq data (12 treatment groups with 6 replicates of each). I have built a sample table:
Sample_Table <- data.frame(Sample = samples, FileName = files, Treatment = Treatment, Cell = Cell, Type = Type, Replicate = Replicate)
and then the DESeq dataset from my HTSeqcount outputs:
dds <- DESeqDataSetFromHTSeqCount(sampleTable = Sample_Table, directory = directory, design = ~Treatment)
Then, I have tried to filter, subset my dataset and run differential expression on the subset:
dds_V <- dds[,dds$Treatment=="Vehicle"] keep <- rowSums (counts (dds_V, normalized = TRUE)>=50) >=3 dds_V <- dds_V[keep,] dds_V$Treatment <- droplevels(dds_V$Treatment) dds_V$Cell <- relevel(dds_V$Cell,ref = "T") dds_V <- DESeq(dds_V)
Unfortunately this returns the message: 'Error in
*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels'.
I have also tried:
dds_V <- dds[,dds$Treatment=="Vehicle"] keep <- rowSums (counts (dds_V, normalized = TRUE)>=50) >=3 dds_V <- dds_V[keep,] dds_V$Cell <- factor(dds_V$Cell, levels = c("T","M")) dds_V <- DESeq(dds_V)
which returns this: 'Error in designAndArgChecker(object, betaPrior) : full model matrix is less than full rank'.
I understand there seems to be a problem with recognising the 2 factors but I can't seem to find a way round it. I'd be really grateful if anyone has any suggestions on how to proceed.
Thanks so much for this, Michael.
The 'vehicle' samples actually comprise 2 different cell types, which are what I'd like to look at the differential expression of. I labelled my sample table as follows:
The output I get for:
So ddsV contains 12 samples, T1-6 and M1-6 (all vehicle-treated) as I'd expect. But how do I then perform DE on ddsV (i.e. between vehicle-treated samples T1-6 and M1-6)?
Thank you again
I'd recommend working with a statistician on the design part. I can help with software usage questions but how to specify the correct design is beyond the level of support I can provide. I just don't have extra time in my schedule to work out statistical analysis plans.
You told DESeq2 the design is
~treatmentbut then you only give samples belonging to one level of treatment, so DESeq2 can't "see" the other aspects of the variables that are of interest for modeling differences.
Ok, thank you for your help