不積跬步续镇,無以至千里
本期我們嘗試復(fù)現(xiàn)2023年3月31日發(fā)表在Nature Communications上的TRABID overexpression enables synthetic lethality to PARP inhibitor via prolonging 53BP1 retention at double-strand breaks文章中的Fig1b
筒溃。
以下是原圖:
數(shù)據(jù)可以自行下載,也可評論區(qū)留言我私發(fā)給你。
代碼
dir.create('Fig')
#-- install packages
if (!requireNamespace('ggbeeswarm')){
install.packages('ggbeeswarm')
}
library(ggplot2)
library(ggbeeswarm)
library(dplyr)
library(tidyr)
library(magrittr)
library(forcats)
library(readr)
#-- load data
data <- read_csv(file = 'data.csv',
col_names = TRUE)
head(data)
#clean data
data <- data %>%
pivot_longer(cols = starts_with('sh'),
names_to = 'class')
head(data)
upper.75 <- function(x)mean(x) + sd(x)
lower.75 <- function(x)mean(x) - sd(x)
segment.data <- data %>%
group_by(class) %>%
summarise(mean = mean(value)) %>%
mutate(xmin = 1:5 - 0.3,
xmax = 1:5 + 0.3)
data %>%
mutate(class = fct_relevel(class, c('shControl', 'shUSP16', 'shUSP19', 'shUSP32', 'shZRANB1'))) %>%
ggplot(aes(x = class, y = value)) +
geom_beeswarm(aes(color = class), size = 0.1) +
scale_color_manual(values = c('#5659EA', '#11B77D', '#FEA647', '#F98180', '#DF8DFB')) +
stat_summary(color = 'black',
geom = 'errorbar',
fun.min = lower.75,
fun.max = upper.75,
width = .3,
linewidth = .3) +
geom_segment(data = segment.data,
aes(x = xmin, xend = xmax, y = mean, yend = mean),
linewidth = .7) +
scale_y_continuous(limits = c(0, 100),
expand = c(0, 0),
breaks = seq(from = 0, to = 100, by = 20)) +
scale_x_discrete(labels = c('shControl', 'shUSP16#2', 'shUSP19#2', 'shUSP32#2', 'shTRABID#1')) +
labs(x = NULL, y = '53BP1 foci number per U2OS cell') +
theme_classic() +
annotate(geom = 'text', label = 'n.s.', x = 2.5, y = 98, family = 'sans', color = 'black', size = 4) +
annotate(geom = 'text', label = 'P<0.0001', x = 5, y = 57, family = 'sans', color = 'black', size = 3.4) +
annotate(geom = 'segment', x = .95, xend = 4.05, y = 92, yend = 92, linewidth = .8) +
theme(legend.position = 'none',
axis.text = element_text(family = 'sans',
color = 'black',
size = 12),
axis.text.x = element_text(angle = 45,
hjust = 1,
vjust = 1),
axis.title.y = element_text(family = 'sans',
color = 'black',
size = 12),
axis.ticks = element_line(colour = 'black', linewidth = .8),
axis.ticks.length = unit(0.05, 'in'),
axis.line = element_line(colour = 'black', linewidth = .8))
ggsave(filename = 'Fig/Fig1b.jpeg', width = 3, height = 3.6, dpi = 5000)
最終效果
寫在最后
原始圖中
errorbar
只顯示了一半,這可以通過geom_segment()
來實現(xiàn),但在這里我沒有做晚岭。關(guān)于原圖中的
P
如何顯示成為P
,目前我還沒有找到一個好辦法勋功。