Graphing Average Expression of Group of Genes
2
0
Entering edit mode
11 months ago
cthangav ▴ 100

I'm trying to plot the expression of a group of genes over time. My starting dataframe is in TPM like below.

V1              MEF             DAY3            DAY6            DAY9            DAY12         IPSC
Arhgef12    48.9061752  76.001558   64.294236   61.0208545  66.4678191  25.11639309
Arnt2           8.6570850   11.341789   22.613930   35.2099605  36.0336247  1.30568627
Atf3            12.3444246  35.844574   17.887655   35.5792577  141.7997036 7.67626153
Bach2           2.1672173   8.311551    12.918229   14.2654167  17.2227704  0.84742111
Bbx         33.7248954  70.522302   59.295483   49.3389741  46.8598894  39.80204016

I tried doing K-Means clustering which yielded a graph with many lines, which is close to what I want.

K-Means

But I'm really only interested in the average expression of this one group (not sure which method I should use to capture the trend). I tried doing a box plot instead, but this is the median, rather than the average. Ideally, I'd like to have the boxplots with centers on the averages, with each center connected by a line (like in red). And if the boxplots could be smaller that would be better.

box plot

Box Plot with line

Boxplot R • 494 views
ADD COMMENT
1
Entering edit mode
ADD REPLY
4
Entering edit mode
11 months ago
ATpoint 82k

You can plot the points and then use a connecting line for the means.

d <- data.table::fread(text="V1              MEF             DAY3            DAY6            DAY9            DAY12         IPSC
Arhgef12    48.9061752  76.001558   64.294236   61.0208545  66.4678191  25.11639309
Arnt2           8.6570850   11.341789   22.613930   35.2099605  36.0336247  1.30568627
Atf3            12.3444246  35.844574   17.887655   35.5792577  141.7997036 7.67626153
Bach2           2.1672173   8.311551    12.918229   14.2654167  17.2227704  0.84742111
Bbx         33.7248954  70.522302   59.295483   49.3389741  46.8598894  39.80204016", data.table=FALSE)

d %>%
  reshape2::melt() %>% 
  magrittr::set_colnames(c("gene", "group", "value")) %>%
  ggplot(aes(x=group, y=log2(value+1))) +
  geom_point() +
  stat_summary(aes(group=1), fun=mean, geom="line")

enter image description here

ADD COMMENT

Login before adding your answer.

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