Skip to content

Guide count quality

A count table can have adequate total depth while losing individual guides. This page examines the complete deposited guide set before the main filter. It counts zero observations, measures count inequality, and compares profiles on the same log2 count scale.

Examine representation and culture agreement

Section titled “Examine representation and culture agreement”

The Gini coefficient summarizes count inequality within one profile. Zero means equal counts; larger values mean more concentration in fewer guides. It is a descriptive statistic here, not an automatic culture exclusion rule. Selection itself can change representation.

Pearson correlations use log2(count + 1) across every guide. A large correlation can coexist with a biologically important subset of changed guides. The two DMSO and two drug profiles must be assessed within their intended groups, rather than selecting cultures because their removal improves a result.

The heat map also contains baseline and day-seven profiles. These profiles supply context without becoming extra day-14 replicates. The unresolved Brunello Library material keeps its deposited label.

library(ggplot2)
library(jsonlite)
dir.create("outputs", showWarnings = FALSE)
input <- gzfile("/fixtures/all_counts.tsv.gz", open = "rt")
source_names <- strsplit(readLines(input, n = 1), "\t", fixed = TRUE)[[1]]
counts <- read.delim(input, header = FALSE, col.names = source_names,
check.names = FALSE)
close(input)
metadata <- read.delim("/fixtures/samples.tsv")
values <- as.matrix(counts[, metadata$source_label])
summary <- data.frame(sample = metadata$sample,
total = colSums(values), zeros = colSums(values == 0),
zero_fraction = colMeans(values == 0),
gini = rep(0, ncol(values)))
for (i in seq_len(ncol(values))) {
ordered <- sort(as.double(values[, i]))
n <- length(ordered)
summary$gini[i] <- sum((2 * seq_len(n) - n - 1) * ordered) /
(n * sum(ordered))
}
stopifnot(all(is.finite(summary$gini)))
correlations <- cor(log2(values + 1), method = "pearson")
colnames(correlations) <- rownames(correlations) <- metadata$sample
correlation_table <- as.data.frame(as.table(correlations))
names(correlation_table) <- c("sample_a", "sample_b", "correlation")
write.table(summary, "outputs/summary_r.tsv", sep = "\t",
quote = FALSE, row.names = FALSE)
write.table(correlation_table, "outputs/correlations_r.tsv", sep = "\t",
quote = FALSE, row.names = FALSE)
metrics <- list(total = sum(values), zeros = sum(values == 0),
mean_gini = mean(summary$gini),
dmso_correlation = correlations["C1D14", "C2D14"],
drug_correlation = correlations["P1D14", "P2D14"])
write_json(metrics, "outputs/metrics_r.json", auto_unbox = TRUE, digits = 16)
print(summary, row.names = FALSE, digits = 5)
cat(sprintf("Day-14 DMSO correlation: %.6f\n", metrics$dmso_correlation))
cat(sprintf("Day-14 drug correlation: %.6f\n", metrics$drug_correlation))
figure <- ggplot(summary, aes(sample, 100 * zero_fraction)) +
geom_col(fill = "#176B87") + coord_flip() + theme_bw(base_size = 12) +
labs(x = "Deposited profile", y = "Guides with zero counts, percent")
ggsave("outputs/zero_counts_r.png", figure, width = 7, height = 4.6,
dpi = 160)
figure <- ggplot(correlation_table, aes(sample_a, sample_b,
fill = correlation)) +
geom_tile() + scale_fill_viridis_c(limits = c(0, 1)) +
coord_equal() + theme_bw(base_size = 10) +
theme(axis.text.x = element_text(angle = 60, hjust = 1)) +
labs(x = NULL, y = NULL, fill = "Pearson r")
ggsave("outputs/correlations_r.png", figure, width = 7.5, height = 6,
dpi = 160)
sample total zeros zero_fraction gini
Brunello_Library 47494107 17 0.00021952 0.30752
D0 43454275 325 0.00419674 0.38444
C1D7 36129429 661 0.00853553 0.45097
C2D7 30593199 677 0.00874214 0.44791
P1D7 26921192 353 0.00455831 0.40892
P2D7 29348316 435 0.00561718 0.41024
C1D14 28923093 936 0.01208662 0.50235
C2D14 27101092 824 0.01064036 0.49974
P1D14 34152512 801 0.01034336 0.70973
P2D14 35371217 900 0.01162175 0.75292
Day-14 DMSO correlation: 0.868073
Day-14 drug correlation: 0.706593

Bars show the percentage of guides with zero counts in each deposited profile.

The heatmap shows pairwise Pearson correlations after the log2 count transformation.

The drug cultures show lower guide-wise agreement than the DMSO cultures and more concentrated counts. Selection and population bottlenecks can both produce that pattern; these archived counts do not separate them. All four cultures remain in the declared comparison, and the result retains the shared transduction limit. These checks do not estimate editing efficiency or prove that no bottleneck occurred. The normalization lesson uses controls that pass the prespecified comparator count filter.

Goh et al. 2021 describe the source screen. The version 2 deposit supplies the archived counts under CC BY 4.0.

The version 2 count deposit supplies the complete workbook behind the zero-count and correlation summaries. Read the methods in Goh and colleagues’ study alongside the profile labels to distinguish treatment cultures, collection times, and the shared transduction.