# data for figure 3 recreation
dat3 <- read.csv("figure3_data_journal.pone.0253838.s005.csv")
#View(dat3)
# data for figure 4 recreation
dat4 <- read.csv("figure4_data_journal.pone.0253838.s006.csv")
#View(dat4)
#install.packages("png")
library(png)
## Warning: package 'png' was built under R version 4.5.3
#install.packages("grid")
library(grid)
original_fig3 <- readPNG("original_figure3.png")
grid.raster(original_fig3)
# library
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggrepel)
## Warning: package 'ggrepel' was built under R version 4.5.3
# Renaming columns because ggplot doesn't like the original names
data3 <- dat3 %>%
rename(
pep_score = Sum.PEP.Score,
psm = X..PSMs,
label = Description, # Text labels for proteins
size_variable = X..Peptides # Controls bubble size
)
# Create the plot
ggplot(data3, aes(x = pep_score, y = psm)) +
geom_point(
aes(size = size_variable), # change point size to the number of peptides
alpha = 0.25) +
# scale the points
scale_size(range = c(1, 25)) + # scales points vary from small (1) to large (25) for better visualization
# like using jitter for text
geom_text_repel(
data = data3,
aes(label = label),
size = 3) +
# theme
theme_minimal() +
theme(
legend.position = "none",) +
# labels
labs(title = "Figure 3 Recreation",
x = "Sum PEP Score",
y = "Number of PSMs")
original_fig4 <- readPNG("original_figure4.png")
grid.raster(original_fig4)
# library
library(ggplot2)
library(dplyr)
ggplot(dat4, aes(Site, Weight..g., fill = Site)) +
geom_boxplot() +
theme_minimal() +
labs(title = "Figure 4 Recreation",
x = "Site",
y = "Weight (g)")