Hi, I'm doing differential expression analysis by using DESeq2. I want to sort the top 100 upregulated and downregulated genes. So how can i identify the top 100 genes? does it based on log2fold change or adjusted p-value?
# get up and down reulated genes
up_OE<- res[which({res$log2FoldChange > 0 & res$padj < .05}),]
do_OE<- res[which({res$log2FoldChange < 0 & res$padj < .05}),]
#get top 100 genes
resOrderedDF <- as.data.frame(up_OE)[seq_len(100),]
write.csv(up_OE, file="top100.csv")
This is the code I'm using. is it correct?
R can index using logical vectors, you don't need the
which
. Do you want just the top 100 genes' symbols or the logFC etc details as well?