🧬 Sample Information


📊 FRiP (Fraction of Reads in Peaks)

frip_dt <- fread(params$frip_file)
if (!dir.exists("figures")) dir.create("figures", recursive = TRUE)

FRiP Summary Statistics

summary(frip_dt$frip)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## 0.000e+00 0.000e+00 0.000e+00 1.220e-06 0.000e+00 3.333e-01

FRiP Distribution Plot

frip_plot <- ggplot(frip_dt, aes(x = frip)) +
  geom_histogram(fill = "steelblue", bins = 50) +
  labs(title = "FRiP Score Distribution", x = "FRiP Score", y = "Number of Cells") +
  theme_minimal()
ggsave("../../figures/example_frip_plot.png", frip_plot, width = 6, height = 4, bg = "white")
frip_plot

Top Cells by FRiP

top_frip <- frip_dt[order(-frip)][1:20]
datatable(top_frip, options = list(pageLength = 10))
png("../../figures/frip_top_table.png", width = 800, height = 400)
grid.table(top_frip)
dev.off()
## quartz_off_screen 
##                 2

📌 CAR Insertion Site Coverage

insert_dt <- fread(params$insert_file)

Insertion Site Coverage Heatmap

insert_heatmap <- ggplot(insert_dt, aes(x = site, y = barcode, fill = insert_reads)) +
  geom_tile() +
  scale_fill_gradient(low = "white", high = "firebrick") +
  labs(title = "Per-cell CAR Insertion Site Coverage", x = "Insertion Site", y = "Cell Barcode") +
  theme_minimal() +
  theme(
    axis.text.x = element_text(angle = 45, hjust = 1, size = 8),
    axis.text.y = element_blank(),
    axis.ticks.y = element_blank()
  )
ggsave("../../figures/car_coverage_heatmap.png", insert_heatmap, width = 7, height = 5, bg = "white")
insert_heatmap

Top Sites by Total Read Count

top_sites <- insert_dt[, .(total_reads = sum(insert_reads)), by = site][order(-total_reads)][1:10]
print(top_sites)
##                    site total_reads
##                  <char>       <int>
##  1:   B2M_KO_CAR_Target          91
##  2: TRAC_CAR_Eyquem2017          53
##  3:   RAB11A_CAR_Target          24
##  4:     CCR5_CAR_Target          18
##  5:    AAVS1_CAR_Common           4
##  6:                <NA>          NA
##  7:                <NA>          NA
##  8:                <NA>          NA
##  9:                <NA>          NA
## 10:                <NA>          NA
png("../../figures/car_site_table.png", width = 800, height = 400)
grid.table(top_sites)
dev.off()
## quartz_off_screen 
##                 2

✅ Summary