This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract gene ids from DESeq2 result dataframe for specific comparison based on vennDiagram

Hi everyone,

I have used the code mentioned here to generate Venn diagram from DESeq2 pairwise analysis.

1) I can see 124 genes specific to OPvsLL.33 from the venn diagram (Figure 2) and would like to extract them from DESeq2 result dataframe (already annotated with ensembl) by using entrezgene as filter.

2) How can I construct venn diagram representing three circles corresponding to OP, LL.33, M?

Please guide.

Thank you.

deseq2 venndiagram rna-seq limma venn

1 answer

1) I can see 124 genes specific to OPvsLL.33 from the venn diagram (Figure 2) and would like to extract them from DESeq2 result dataframe (already annotated with ensembl) by using entrezgene as filter.

Convert the Ensembl genes to Entrez and then filter:

require(biomaRt)
mart <- useMart("ENSEMBL_MART_ENSEMBL")
mart <- useDataset("hsapiens_gene_ensembl", mart)
annots <- getBM(mart=mart, attributes=c("ensembl_gene_id", "entrezgene"), filter="ensembl_gene_id", values=res_OPvsLL.5.genes, uniqueRows=TRUE)

You mentioned Entrez, but if instead you meant the RefSeq or HGNC gene symbols, then use hgnc_symbol in place of entrezgene

You will have to modify this further to do exactly what you want.


2) How can I construct venn diagram representing three circles corresponding to OP, LL.33, M?

For treatment 33, you would have to do something like:

res_OPvsLL.33 <- results(dds, test = "Wald", name="cond33.popOP")
res_OPvsLL.33 <- subset(res_OPvsLL.33, res_OPvsLL.33$padj <= 0.05)
res_OPvsLL.33.genes <- row.names(res_OPvsLL.33)

res_MvsLL.33 <- results(dds, test = "Wald", name = "cond33.popM")
res_MvsLL.33 <- subset(res_MvsLL.33, res_MvsLL.33$padj <= 0.05)
res_MvsLL.33.genes <- row.names(res_MvsLL.33)

# Combining the two above..
comb <- c(res_OPvsLL.33.genes,res_MvsLL.33.genes)

# Comparing comb with the above two
res_OPvsLL.33.genes.2 <- comb %in% res_OPvsLL.33.genes
res_MvsLL.33.genes.2 <- comb %in% res_MvsLL.33.genes  

# Generating venn counts to plot venn diagram
counts.33 <- cbind(res_OPvsLL.33.genes.2, res_MvsLL.33.genes.2)
results.33 <- vennCounts(counts.33)
vennDiagram(results.33, cex = 1,names = c("OPvsLL.33","MvsLL.33"), circle.col = c("red", "blue"))

Log in to answer this question.