Is this generated from multiple replicates of each T[1-6] sample? Or are T[1-6] different conditions? I think OP has a single data point per sample, which is why a bar plot is relevant.
Hi Biostars,
I looked for kind of plot use log2FC to visualize gene expression of only one gene but could not find out. Would you please have a suggestion? Simply as bar plot for gene expression to know gene A express higher in sample 1 vs sample 2. Volcano plot or heat map show all the gene. Even though I can label one gene in those plots but the biologist only want to focus on genes of interest. Thank you so much!
1 answer
you can also get the normalized counts as a dataframe from DESeq2 and then work with it using ggplot2 (use geom_boxplot and geom_point). you can make a figure like this one.
norm_counts <-(counts(se_star2, normalized = TRUE)+1)
norm_counts.df <- as.data.frame(norm_counts)
Thank you! The plot looks nice. Would you share the code with geom_boxplot and geom_point? I have 2 data points for a sample.
T1 to T6 are different conditions for 8 samples. if you have much simpler data, then you can do as @Ram suggested with barplot.
however, the code is given below. I am still learning R, so my codes are quite rudimentary. But you should be able to achieve your figures with ggplot and even create a loop for several genes.
norm_counts <-(counts(se_star2, normalized = TRUE)+1)
norm_counts.df <- as.data.frame(norm_counts)
df <- data.frame(t(norm_counts.df), check.names = FALSE)
df$timepoints <- c("T1", "T2", "T3", "T4", "T5", "T6")
ggplot(df, aes(x=timepoints, y= `ITGA4`, fill=timepoints))+
geom_boxplot(color="black", width=0.3)+
geom_point(size=2.5) +theme_classic() +
theme(plot.margin = margin(10,150, 10, 150))+
theme(legend.position="none")+
labs(y = "normalized counts", x = "ITGA4", face = "bold")+
theme(axis.text = element_text(size = 30, color = "black"))+
theme(axis.title = element_text(size = 40, face = "bold"))+
theme(panel.border = element_rect(color = "black",fill = NA, linewidth = 0.5))
Log in to answer this question.
Why not use barplots like you mention for a single gene and heatmaps or grouped barplots for multiple genes? RNA-seq yields relative metrics and cannot strictly be compared between samples using any of the RPKM/FPKM/TPM measures but it doesn't stop people from comparing anyway. I think if the samples were sequenced at comparable library depths, upper-quartile normalize the raw counts, scale per-gene and compare Z-scores.
Because I don't find out code or tutorial doing that in RNA-seq analysis. Most of them use heatmap or volcano plot.
DESeq has a simple built-in function to plot a single gene:
https://www.rdocumentation.org/packages/DESeq2/versions/1.12.3/topics/plotCounts
Thank you! Is there any way we could add color to the dot to distinguish between conditions or adjust the size of the dot? This one has color but I am not sure how to get it. https://r.acidgenomics.com/packages/deseqanalysis/reference/plotCounts.html
Yes, you can do anything in ggplot. But this is a super simple, don't have to learn anything about plotting solution.
It's a vector of numbers and a bar plot. Don't overthink it :-)
Is it ok if i directly plot the expression of my gene of interest from the deseq2 normalized counts? or it needs any scaling?