Skip to content

Instantly share code, notes, and snippets.

@hypercompetent
Last active April 17, 2019 22:16
Show Gist options
  • Save hypercompetent/2ad20c9a30dda4319b980a4b03525dad to your computer and use it in GitHub Desktop.
Save hypercompetent/2ad20c9a30dda4319b980a4b03525dad to your computer and use it in GitHub Desktop.
immune heritability replotting
# adding on to Mike Love's analysis of data here:
# https://twitter.com/mikelove/status/1118595655608483843
# Data source is:
# https://www.cell.com/cms/10.1016/j.cell.2014.12.020/attachment/fb539453-989f-49e5-b880-34cf88151add/mmc5.xlsx
library(readxl)
x <- read_excel("mmc5.xlsx", skip = 1)
names(x)[12:13] <- c("ci_95_low","ci_95_high")
names(x) <- sub(" ","_",names(x))
x$cell <- sub("_p.+","",x[[1]])
x$TF <- sub(".+(pSTAT.)_.+","\\1",x[[1]])
x$cytokine <- sub(".+_","",x[[1]])
library(ggplot2)
ggplot(data = x) +
geom_tile(aes(x = cell,
y = cytokine,
fill = corr_h)) +
facet_wrap(~ TF, nrow = 1) +
scale_fill_viridis_c() +
theme_bw() +
theme(axis.text.x = element_text(angle = 90,
hjust = 1,
vjust = 0.3))
x$mean[x$cytokine == "unstim"] <- 1
ggplot(data = x) +
geom_point(aes(x = cell,
y = cytokine,
fill = corr_h,
size = mean),
pch = 21) +
facet_wrap(~ TF, nrow = 1) +
scale_size_area() +
scale_fill_viridis_c() +
theme_bw() +
theme(axis.text.x = element_text(angle = 90,
hjust = 1,
vjust = 0.3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment