Test filters and collection time
Sensitivity analysis changes a declared choice and records the consequence. It does not search for whichever version returns the most appealing gene list. Each comparison here corrects its own complete non-control family. None adds findings to the primary day-14 RRA discovery list.
Identify what each comparison changes
Section titled “Identify what each comparison changes”| Comparison | Change from the primary analysis |
|---|---|
| Median normalization | The normalization reference changes. Count rows, control null guides, sample order, and permutations stay fixed. |
| Restored targeting guides | Every excluded targeting guide returns. The original control rows and control normalization remain fixed. |
| Day seven | The collection time changes. Targeting guides use the day-seven DMSO count threshold, while the frozen main control rows remain present. |
The day-seven comparison is exploratory. It has its own gene universe and cannot act as an independent validation cohort because the cultures come from the same experiment. The restored-guide comparison also changes the gene universe, which can affect a multiple testing correction as well as a rank.
The table below reports the full family size, discoveries, overlap with the primary list, and effect rank correlation over shared genes. The overlap uses sets of discoveries. It is not a pooled false discovery estimate.
Keep unmeasured bias outside the claim
Section titled “Keep unmeasured bias outside the claim”This knockout dataset can contain cutting effects, guide efficiency variation, and population bottlenecks. Matched A375 copy-number data were not established by the source audit, so no executable copy-number correction is claimed. A correction would require a verified profile and compatible genomic coordinates. These sensitivity runs cannot substitute for those inputs.
library(ggplot2)library(jsonlite)dir.create("outputs", showWarnings = FALSE)analyses <- c("rra_primary", "rra_median", "rra_restored", "rra_day7")primary <- read.delim(gzfile("/fixtures/rra_primary_genes.tsv.gz"), check.names = FALSE)primary_q <- p.adjust(primary[["pos|p-value"]], "BH")primary_hits <- primary$id[primary_q <= 0.05]summary <- data.frame(analysis = analyses, genes = 0L, discoveries = 0L, shared_primary = 0L, jaccard = 0, rank_agreement = 0)for (i in seq_along(analyses)) { path <- paste0("/fixtures/", analyses[i], "_genes.tsv.gz") result <- read.delim(gzfile(path), check.names = FALSE) p <- result[["pos|p-value"]] stopifnot(!anyDuplicated(result$id), all(result$id != "Control")) stopifnot(all(is.finite(p)), all(p >= 0 & p <= 1)) q <- p.adjust(p, "BH") hits <- result$id[q <= 0.05] common <- intersect(primary$id, result$id) summary$genes[i] <- nrow(result) summary$discoveries[i] <- length(hits) summary$shared_primary[i] <- length(intersect(hits, primary_hits)) summary$jaccard[i] <- length(intersect(hits, primary_hits)) / length(union(hits, primary_hits)) summary$rank_agreement[i] <- cor( primary[["pos|lfc"]][match(common, primary$id)], result[["pos|lfc"]][match(common, result$id)], method = "spearman")}write.table(summary, "outputs/summary_r.tsv", sep = "\t", quote = FALSE, row.names = FALSE)metrics <- list(primary_hits = summary$discoveries[1], median_hits = summary$discoveries[2], restored_hits = summary$discoveries[3], day7_hits = summary$discoveries[4], day7_overlap = summary$shared_primary[4], day7_rank_agreement = summary$rank_agreement[4])write_json(metrics, "outputs/metrics_r.json", auto_unbox = TRUE, digits = 16)print(summary, row.names = FALSE, digits = 6)plot_data <- data.frame( analysis = rep(analyses, 2), membership = rep(c("Shared with primary", "Other findings"), each = 4), genes = c(summary$shared_primary, summary$discoveries - summary$shared_primary))figure <- ggplot(plot_data, aes(analysis, genes, fill = membership)) + geom_col() + geom_text(data = summary, aes(analysis, discoveries, label = discoveries), inherit.aes = FALSE, hjust = -0.1) + scale_y_continuous(expand = expansion(mult = c(0, 0.15))) + coord_flip() + theme_bw(base_size = 12) + scale_fill_manual(values = c("#B7C8CE", "#176B87")) + labs(x = "Separate RRA family", y = "BH discoveries", fill = NULL)ggsave("outputs/sensitivity_r.png", figure, width = 8, height = 4.6, dpi = 160) analysis genes discoveries shared_primary jaccard rank_agreement rra_primary 19111 28 28 1.0000000 1.000000 rra_median 19111 28 27 0.9310345 0.999974 rra_restored 19114 49 28 0.5714286 0.978790 rra_day7 19114 1845 28 0.0151762 0.454303
import jsonfrom pathlib import Path
import matplotlib.pyplot as pltimport numpy as npimport pandas as pdfrom scipy.stats import spearmanrfrom statsmodels.stats.multitest import multipletests
output = Path("outputs")output.mkdir(exist_ok=True)
analyses = ["rra_primary", "rra_median", "rra_restored", "rra_day7"]primary = pd.read_csv("/fixtures/rra_primary_genes.tsv.gz", sep="\t")primary_q = multipletests(primary["pos|p-value"], method="fdr_bh")[1]primary_hits = set(primary.loc[primary_q <= 0.05, "id"])records = []for analysis in analyses: result = pd.read_csv(f"/fixtures/{analysis}_genes.tsv.gz", sep="\t") p = result["pos|p-value"].to_numpy() assert result["id"].is_unique and result["id"].ne("Control").all() assert np.isfinite(p).all() and ((p >= 0) & (p <= 1)).all() q = multipletests(p, method="fdr_bh")[1] hits = set(result.loc[q <= 0.05, "id"]) common = primary.loc[primary["id"].isin(result["id"]), "id"].tolist() left = primary.set_index("id").loc[common, "pos|lfc"] right = result.set_index("id").loc[common, "pos|lfc"] records.append({ "analysis": analysis, "genes": len(result), "discoveries": len(hits), "shared_primary": len(hits & primary_hits), "jaccard": len(hits & primary_hits) / len(hits | primary_hits), "rank_agreement": float(spearmanr(left, right).statistic), })summary = pd.DataFrame(records)reference = pd.read_csv(output / "summary_r.tsv", sep="\t")pd.testing.assert_frame_equal(summary, reference, check_dtype=False, atol=1e-8, rtol=0)summary.to_csv(output / "summary_python.tsv", sep="\t", index=False)metrics = {"primary_hits": int(summary.loc[0, "discoveries"]), "median_hits": int(summary.loc[1, "discoveries"]), "restored_hits": int(summary.loc[2, "discoveries"]), "day7_hits": int(summary.loc[3, "discoveries"]), "day7_overlap": int(summary.loc[3, "shared_primary"]), "day7_rank_agreement": float(summary.loc[3, "rank_agreement"])}(output / "metrics_python.json").write_text(json.dumps(metrics))print(summary.to_string(index=False, float_format="%.6f"))fig, ax = plt.subplots(figsize=(8, 4.6))ax.barh(summary["analysis"], summary["shared_primary"], color="#176B87", label="Shared with primary")other_findings = summary["discoveries"] - summary["shared_primary"]other_bars = ax.barh(summary["analysis"], other_findings, left=summary["shared_primary"], color="#B7C8CE", label="Other findings")ax.bar_label(other_bars, labels=summary["discoveries"].astype(str), padding=3)ax.set_xlim(0, summary["discoveries"].max() * 1.15)ax.set(xlabel="BH discoveries", ylabel="Separate RRA family")ax.legend()fig.tight_layout()fig.savefig(output / "sensitivity_python.png", dpi=160)plt.close(fig) analysis genes discoveries shared_primary jaccard rank_agreement rra_primary 19111 28 28 1.000000 1.000000 rra_median 19111 28 27 0.931034 0.999974rra_restored 19114 49 28 0.571429 0.978790 rra_day7 19114 1845 28 0.015176 0.454303
A stable discovery across these changes still belongs to one shared transduction experiment. The interpretation lesson connects the statistical result to the independent experiments needed for a mechanistic claim.
Further reading
Section titled “Further reading”The version 2 count deposit preserves the profiles used for the day-seven and day-fourteen comparisons. The methods in Goh and colleagues’ study describe the shared transduction and duplicate cultures, which determine why the later profiles are not independent validation experiments. The MAGeCK 0.5.9.5 archive contains the normalization implementation used by the sensitivity runs.