DESeq2 Pre-filtering and Subsetting
1
1
Entering edit mode
3.8 years ago
pthom010 ▴ 40

I have a dds object in DEseq2 and I wanted to do row means filtering on my object. I have 30 total samples, therefore I have 30 total columns in the count table. I'd like to filter all read counts lower than 30 for each treatment (for rows 1-15 and rows 16-30). I've tried the following code:

keep = rowMeans(counts(dds[,c(1:15,16:30)])) >=30
dds_30=dds[keep,]

but I do not think this is working. Would anybody be able to help?

RNA-Seq R • 3.7k views
ADD COMMENT
5
Entering edit mode
3.8 years ago

I'm not sure what your dds variable looks like, but this should work judging by your current code.

dds_30 <- dds[rowMeans(counts(dds)[, 1:15]) >= 30 & rowMeans(counts(dds)[, 16:30]) >= 30, ]
ADD COMMENT
0
Entering edit mode

Thanks but I wanted to filter the row means by treatment (only filtering out those with row means less than 30 between samples 1 - 15 and 16-30, separately). Would I just do:

dds_30 <- dds[rowMeans(counts(dds)[, 1:15;16:30]) >= 30, ]
ADD REPLY
0
Entering edit mode

In your original post, you had c(1:15,16:30), which is the same as 1:30.

I'm still a bit confused what you are trying to do. Can you describe it in a little more detail?

ADD REPLY
0
Entering edit mode

My apologies. My dds variable is two plant genotypes over a period of time and each sample 1 - 30 in my dds object belongs to a genotype. Columns 1 - 15 belong to one genotype (Three replicates for 5 time points) and columns 16 - 30 belong to another. What I would like to do is row means filter by treatment (remove all row means less than 30 for samples 1-15 even though they might be = 45 in samples 16 - 30, and vice versa). That way I would only get row means in the DDS object that are >=30 when you subset rows 1 - 15 and rows 16 - 30. I know it's more complicated than is usual in DEseq2 and might be advised against but our lab uses a specific protocol in DEseq. Thanks for your help.

ADD REPLY
1
Entering edit mode

I think I know what you mean now. Both the row means of columns 1:15, and the row means of columns 16:30 need to be equal to or greater than 30 to keep the row. I edited the answer to reflect this.

ADD REPLY
0
Entering edit mode

That works. Thanks!!!

ADD REPLY

Login before adding your answer.

Traffic: 2617 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6