The A375 count dataset
The complete workbook provides ten profiles and 77,441 guide identifiers. The versioned source contains archived integer counts, while the gene inference in this section comes from fresh MAGeCK runs. The preparation checks the workbook SHA-256 and the complete guide set against the Brunello depositor file.
The Brunello guide table comes from the Doench and Root laboratory deposit at Addgene. Addgene’s content terms permit informational, noncommercial use while retaining copyright and proprietary notices. This educational comparison uses the table to check guide identifiers and controls. The displayed counts and identifiers come from the Goh study deposit, version 2, under CC BY 4.0; that license does not replace Addgene’s terms for its separate table.
Check the count and design identities
Section titled “Check the count and design identities”The examples retain the original sample labels, including the trailing space
in D0 . The single Brunello Library profile has unresolved source material.
Its role is representation, not a replicated baseline treatment group.
The MLE design has an intercept and a drug coefficient. DMSO defines the baseline. The rows follow the four day-14 count columns exactly, and the examples require full column rank. No pairing term is inferred from sample suffixes.
Both tabs use the complete compressed count fixture. The companion preparation preserves the source workbook, checksum, control identities, and all exclusion reasons. Run the R tab before the Python parity check, or use the page runner, which executes them in that order.
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", check.names = FALSE)stopifnot(identical(names(counts)[-(1:2)], metadata$source_label))stopifnot(!anyDuplicated(counts$sgRNA), nrow(counts) == 77441L)values <- as.matrix(counts[, metadata$source_label])stopifnot(all(is.finite(values)), all(values >= 0))stopifnot(all(values == floor(values)))main_samples <- c("C1D14", "C2D14", "P1D14", "P2D14")design <- cbind(baseline = 1, drug = c(0, 0, 1, 1))stopifnot(qr(design)$rank == 2L)recorded <- read.delim("/fixtures/design.tsv", check.names = FALSE)stopifnot(identical(recorded$Samples, main_samples))stopifnot(all(as.matrix(recorded[, -1]) == design))summary <- data.frame(sample = metadata$sample, total = colSums(values), zeros = colSums(values == 0))write.table(summary, "outputs/summary_r.tsv", sep = "\t", quote = FALSE, row.names = FALSE)metrics <- list(guides = nrow(counts), samples = ncol(values), total = sum(values), zeros = sum(values == 0), controls = sum(counts$Gene == "Control"), design_rank = 2)write_json(metrics, "outputs/metrics_r.json", auto_unbox = TRUE, digits = 16)cat(sprintf("Guides: %d; profiles: %d; controls: %d\n", metrics$guides, metrics$samples, metrics$controls))cat("The main design has rank 2 and two residual degrees of freedom.\n")print(recorded, row.names = FALSE)print(summary, row.names = FALSE)figure <- ggplot(summary, aes(reorder(sample, total), total / 1e6)) + geom_col(fill = "#176B87") + coord_flip() + theme_bw(base_size = 12) + labs(x = "Deposited profile", y = "Assigned counts, millions")ggsave("outputs/design_totals_r.png", figure, width = 7, height = 4.6, dpi = 160)Guides: 77441; profiles: 10; controls: 1000The main design has rank 2 and two residual degrees of freedom. Samples baseline drug C1D14 1 0 C2D14 1 0 P1D14 1 1 P2D14 1 1 sample total zeros Brunello_Library 47494107 17 D0 43454275 325 C1D7 36129429 661 C2D7 30593199 677 P1D7 26921192 353 P2D7 29348316 435 C1D14 28923093 936 C2D14 27101092 824 P1D14 34152512 801 P2D14 35371217 900
import jsonfrom pathlib import Path
import matplotlib.pyplot as pltimport numpy as npimport pandas as pd
output = Path("outputs")output.mkdir(exist_ok=True)counts = pd.read_csv("/fixtures/all_counts.tsv.gz", sep="\t")metadata = pd.read_csv("/fixtures/samples.tsv", sep="\t")assert counts.columns[2:].tolist() == metadata["source_label"].tolist()assert counts["sgRNA"].is_unique and len(counts) == 77441values = counts[metadata["source_label"]].to_numpy()assert np.isfinite(values).all() and (values >= 0).all()assert np.array_equal(values, np.floor(values))main_samples = ["C1D14", "C2D14", "P1D14", "P2D14"]design = np.column_stack([np.ones(4), [0, 0, 1, 1]])assert np.linalg.matrix_rank(design) == 2recorded = pd.read_csv("/fixtures/design.tsv", sep="\t")assert recorded["Samples"].tolist() == main_samplesnp.testing.assert_array_equal(recorded.iloc[:, 1:], design)summary = pd.DataFrame({"sample": metadata["sample"], "total": values.sum(axis=0), "zeros": (values == 0).sum(axis=0)})reference = pd.read_csv(output / "summary_r.tsv", sep="\t")pd.testing.assert_frame_equal(summary, reference, check_dtype=False, check_exact=True)summary.to_csv(output / "summary_python.tsv", sep="\t", index=False)metrics = {"guides": len(counts), "samples": values.shape[1], "total": int(values.sum()), "zeros": int((values == 0).sum()), "controls": int(counts["Gene"].eq("Control").sum()), "design_rank": int(np.linalg.matrix_rank(design))}(output / "metrics_python.json").write_text(json.dumps(metrics))print(f"Guides: {len(counts)}; profiles: {values.shape[1]}; " f"controls: {metrics['controls']}")print("The main design has rank 2 and two residual degrees of freedom.")print(recorded.to_string(index=False))print(summary.to_string(index=False))plot_data = summary.sort_values("total")fig, ax = plt.subplots(figsize=(7, 4.6))ax.barh(plot_data["sample"], plot_data["total"] / 1e6, color="#176B87")ax.set(xlabel="Assigned counts, millions", ylabel="Deposited profile")fig.tight_layout()fig.savefig(output / "design_totals_python.png", dpi=160)plt.close(fig)Guides: 77441; profiles: 10; controls: 1000The main design has rank 2 and two residual degrees of freedom.Samples baseline drug C1D14 1 0 C2D14 1 0 P1D14 1 1 P2D14 1 1 sample total zerosBrunello_Library 47494107 17 D0 43454275 325 C1D7 36129429 661 C2D7 30593199 677 P1D7 26921192 353 P2D7 29348316 435 C1D14 28923093 936 C2D14 27101092 824 P1D14 34152512 801 P2D14 35371217 900
The count totals describe sequencing representation. They do not measure the number of surviving cells. The quality lesson checks zero counts and agreement before the normalization lesson uses the frozen control set.
Further reading
Section titled “Further reading”The version 2 count deposit provides the workbook, file identities, and data license for the ten profiles. The Brunello depositor page describes the knockout library and links its guide table. Use the workbook and guide table together to check identifiers before you construct a design matrix.