plotting top 10 Differentially expressed genes
1
0
Entering edit mode
3.7 years ago
kmmistr1 ▴ 10

hello everyone, I am running DESeq2 step for my RNAseq analysis in R, I have extracted the Differentially expressed genes with padj<0.01. There are total 46 DEGs with padj<0.01. Now I would like to plot top 10 or 15 DEGs in the same plot. Can anyone suggest me the type of plot and the way to do the plot. I tried ggplot in few different ways but I kept getting different errors all the time. So please If yany one can show me the correct way of showing the top 10 genes expressed differentially in between different ages (Condition in coldata) shown below.

My output (5 rows out of 46):

              baseMean         log2FoldChange     lfcSE        stat        pvalue       padj
LOC101702367  173.1315            -5.35793     0.618876      -8.65751    4.82171e-18   8.72344e-14
Kif20b         35.6792            - 4.08212    0.563018      -7.25043   4.15444e-13   3.75811e-09
Kif11          49.8418            -2.67824     0.373186      -7.17668   7.14258e-13   4.30745e-09
Mki67         264.7270            -6.20142     0.888265      -6.98150   2.92050e-12   1.32094e-08
Rrm2           33.7083             -5.43636    0.796027      -6.82937   8.52909e-12   3.08617e-08

And my coldata: I would like to plot DEGs for "condition" in all the tissue types

                  condition tissue
SRR306394        NB    Liver
SRR306395      four     Liver
SRR306396    twenty   Liver
SRR306397        NB    Kidney
SRR306398      four     Kidney
SRR306399    twenty   Kidney
SRR306400        NB    Brain
SRR306401      four     Brain
SRR306402    twenty   Brain

Thank you for your time.

RNA-Seq DEGs plot R Rstudio • 2.5k views
ADD COMMENT
1
Entering edit mode

What information are you trying to get across with the plot?

ADD REPLY
0
Entering edit mode

seconding that plus:

I tried ggplot in few different ways but I kept getting different errors all the time

Which errors did you get? What did you try?

ADD REPLY
0
Entering edit mode

It gave me didfferent errors all the time with the same code later I realised it all started after I installed Rtools 40. I could neither run any of the existing package nor install new package including ggplot or heatmap and everytime it gave me different types of errors. But as of now I have reinstalled R version 4.

ADD REPLY
1
Entering edit mode
3.7 years ago
caggtaagtat ★ 1.9k

Hi,

one way to visualize differential expression could be via a heatmap, like so:

#Import DESeqDataSet
ds_txi <- DESeqDataSetFromTximport(txi = txi_salmon,
                                   colData = meta,
                                   design = ~ group )
#Execute DESeq2
ds_txi_KO_vs_WT <- DESeq(ds_txi)

#Generate DESeq2 results file and reorder it by adjusted p-value
results_df <- results(ds_txi_KO_vs_WT,contrast=c("group","KO","WT"))
results_df <- results_df[order(results_df$padj),]

#Create file for count visualization by vst normalization
vsd <- vst(ds_txi)

#
mat <- assay(vsd)[head( match(row.names(results_df ), row.names(vsd)) , 30), ]
mat <- mat - rowMeans(mat)
df <- as.data.frame(colData(vsd)[, c("group")])
df <- data.frame(sample=df$`colData(vsd)[, c("group")]`)
rownames(df) <- colnames(mat)

#Reorder sample column for heatmap
#                   WT                 KO   
mat <- mat[,c( 5, 6, 7, 8,     1, 2, 3, 4)]

#Produce heatmap
pheatmap(mat, annotation_col = df, cluster_rows = F , cluster_cols = F ,show_colnames = F)
ADD COMMENT
0
Entering edit mode

Thanks @caggtaagtat it worked.

ADD REPLY
0
Entering edit mode

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.
Upvote|Bookmark|Accept

ADD REPLY

Login before adding your answer.

Traffic: 2726 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