Hi,
I am not sure if my "action" is against the rules of biostar, and if so, please cancel my post.
My question has been discussed on bioconductor but I have realized that I may not get an an answer so I decided to open a new question and ask it here. Again, if this is against the rule, I apologies and please feel free to cancel my post.
I am doing Deseq2
on 6 samples (control vs treatment):
dds <- DESeqDataSetFromTximport(txi, sampleTable, design = ~condition)
dds <- dds[rowSums(counts(dds)) >= 10,]
dds$condition <- relevel(dds$condition, ref = "Control")
dds <- DESeq(dds)
and I got the DEGs (FDR < 0.05 and FC +/- 1.5, getting 193 up and 158down regulated genes respectively) using this code:
cond1 <- results(dds, contrast=c("condition","Treatment","Control"), alpha = 0.05, lfcThreshold = 0.585)
summary(cond1)
and I get:
out of 22695 with nonzero total read count
adjusted p-value < 0.05
LFC > 0.58 (up) : 193, 0.85%
LFC < -0.58 (down) : 158, 0.7%
outliers [1] : 21, 0.093%
low counts [2] : 1760, 7.8%
(mean count < 3)
[1] see 'cooksCutoff' argument of ?results
[2] see 'independentFiltering' argument of ?results
But I cannot export an excel/csv file with ONLY those genes. Indeed, I get basically the whole dataset (> 21000 genes - I don't know the exact number).
However when I try to export it write.csv(cond1, file="test.csv")
I got the whole dataset (22695 rows). On the note following the bioconductor post, if I do:
sum(cond1$padj < 0.05 & cond1$log2FoldChange > 0.585, na.rm=TRUE)
sum(cond1$padj < 0.05 & cond1$log2FoldChange < -0.585, na.rm=TRUE)
I have concordance between the summary table and these sums.
I have also trying to remove NA
doing:
resFilt <- subset(cond1, !is.na(padj < 0.05))
and I get 20915 genes (so less than before but still way too many that my DEG). What am I doing wrong in exporting the file?
Thank you!
Camilla
What does
dim(as.data.frame(cond1))
give you?It's a
large DESeqResults
. I got the same results even doing itwrite.csv(as.data.frame(cond1), file="Detst.csv")
.the dimension is
[1] 22695 6
You can separate up and down regulated results like this, save then in table and merge them later.
Thanks, I tried but it says
Error: logical subscript contains NAs
. and if I try:and then run your code substituting cond1 with tes I got :
Error: subscript is a logical vector with out-of-bounds TRUE values