-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBcellaggregate.R
More file actions
30 lines (26 loc) · 856 Bytes
/
Bcellaggregate.R
File metadata and controls
30 lines (26 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(dplyr)
library(ggplot2)
library(stringr)
df <- read_csv(file = "bcellagg_results.csv", locale=locale(encoding="latin1"))
# Filter for only rows with BcellAggregate
df_bcell <- df %>%
filter(Name == "BcellAggregate")
# Extract week number from Image column (e.g., WK1 -> 1)
df_bcell <- df_bcell %>%
mutate(
Week = str_extract(Image, "WK\\d+") %>% str_remove("WK") %>% as.integer()
)
# Summarize total B cell aggregate area per week
area_summary <- df_bcell %>%
group_by(Week) %>%
summarise(TotalArea = sum(`Area µm^2`, na.rm = TRUE))
# Plot
ggplot(area_summary, aes(x = Week, y = TotalArea)) +
geom_line(group = 1, color = "blue") +
geom_point(size = 3, color = "darkblue") +
labs(
title = "Total Area of B Cell Aggregates Over Time",
x = "Week",
y = expression("Total Area ("*µm^2*")")
) +
theme_minimal()