Overview This report analyzes swelling and germination of Aspergillus spores exposed to Cysteine and its analogus, using live-imaging microscopy (oCelloScope). The analysis includes classification into resting, swelling, and germ tube formation stages based on morphological changes.

Species analyzed: r params$species

๐Ÿ” Data Processing

# Load CSV using param
df <- read.csv(params$data_file)

# Filter for selected species
df_clean <- df %>%
  filter(species == params$species) %>%
  select(ObjectId, time, Area, Circularity, well, species) %>%
  group_by(ObjectId) %>%
  mutate(
    InitialArea = first(na.omit(Area)),
    InitialCircularity = first(na.omit(Circularity)),
    PercentIncrease = ((Area - InitialArea) / InitialArea) * 100,
    CircularityChange = abs(Circularity - InitialCircularity) / InitialCircularity,
    R = ifelse(CircularityChange < 0.1 & PercentIncrease < 10, 1, 0),
    S = ifelse(CircularityChange < 0.1 & PercentIncrease >= 10, 1, 0),
    G = ifelse(CircularityChange >= 0.1 & PercentIncrease >= 50, 1, 0)
  ) %>%
  mutate(
    R = na_if(R, 0), S = na_if(S, 0), G = na_if(G, 0),
    R = na.locf0(R), S = na.locf0(S), G = na.locf0(G),
    status = case_when(
      G == 1 ~ 2,
      S == 1 & is.na(G) ~ 1,
      TRUE ~ 0
    ),
    S = ifelse(status > 0, 1, 0),
    G = ifelse(status > 1, 1, 0)
  ) %>%
  ungroup() %>%
  mutate(time = as.integer(time / 60) + 1)

๐Ÿ“Š Summary of Germination States

summary_df <- df_clean %>%
  group_by(well, time, species) %>%
  summarise(
    Total = n_distinct(ObjectId),
    Swelling = sum(S, na.rm = TRUE),
    Germination = sum(G, na.rm = TRUE),
    .groups = "drop"
  ) %>%
  mutate(
    SwellingPercent = Swelling / Total * 100,
    GerminationPercent = Germination / Total * 100
  )

๐ŸŽจ Plotting: Group 1 โ€“ Cysteine vs Controls

condition_labels <- c(
  "niger/C" = "Control",
  "niger/C-K" = "Killed Spores",
  "niger/Cys" = "Cysteine",
  "niger/Acy-Cys" = "N-acetyl Cys",
  "niger/Met-Cys" = "S-methyl Cys"
)

condition_colors <- c(
  "Control" = "navy",
  "Killed Spores" = "black",
  "Cysteine" = "red3",
  "N-acetyl Cys" = "darkorange2",
  "S-methyl Cys" = "darkgreen"
)

group1_wells <- names(condition_labels)

plot_metric <- function(data, group, metric, ylab) {
  data <- data %>%
    filter(well %in% group) %>%
    mutate(Condition = condition_labels[well])
  
  ggplot(data, aes(x = time, y = .data[[metric]], color = Condition)) +
    geom_line(linewidth = 1.3) +
    scale_color_manual(values = condition_colors) +
    labs(x = "Time (h)", y = ylab, color = "Condition") +
    theme_classic(base_size = 16) +
    ylim(0, 100) +
    scale_x_continuous(breaks = seq(0, 14, 2)) +
    theme(legend.position = "bottom")
}

plot_metric(summary_df, group1_wells, "SwellingPercent", "Swelling (%)")

plot_metric(summary_df, group1_wells, "GerminationPercent", "Germination (%)")

๐Ÿงช Plotting: Group 2 โ€“ Proline + Pre-treatment + Cysteine

group2_labels <- c(
  "niger/pro" = "Proline",
  "niger/pre-pro 2 h" = "Pre-Pro 2h + Cys",
  "niger/pre-pro 4 h" = "Pre-Pro 4h + Cys",
  "niger/pre-pro 6 h" = "Pre-Pro 6h + Cys",
  "niger/pre-pro 8 h" = "Pre-Pro 8h + Cys",
  "niger/pre-pro 10 h" = "Pre-Pro 10h + Cys",
  "niger/Cys" = "Cysteine"
)

group2_colors <- c(
  "Proline" = "hotpink",
  "Pre-Pro 2h + Cys" = "darkgreen",
  "Pre-Pro 4h + Cys" = "navy",
  "Pre-Pro 6h + Cys" = "gold",
  "Pre-Pro 8h + Cys" = "pink1",
  "Pre-Pro 10h + Cys" = "skyblue",
  "Cysteine" = "red3"
)

group2_wells <- names(group2_labels)

# Update labels and colors for group 2
condition_labels <- group2_labels
condition_colors <- group2_colors

# Plots
plot_metric(summary_df, group2_wells, "SwellingPercent", "Swelling (%)")

plot_metric(summary_df, group2_wells, "GerminationPercent", "Germination (%)")

๐Ÿ’พ Export Summary Data

# Uncomment to save summary
# write.csv(summary_df, paste0("summary_", params$species, ".csv"), row.names = FALSE)