Install any skill in seconds. Free to start, no credit card required.
Get Started Free →DepMap CRISPR gene effect (Chronos) analysis: sign convention for essentiality, per-gene NaN-safe Spearman correlation, data loading/alignment. For general NaN-safe correlation see nan-safe-correlation; for quality filtering see degenerate-input-filtering.
.claude/skills/jaechang-hits-depmap-crispr-essentiality/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 71% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 90% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 144% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 9% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 77% | 0% |
This guide covers the correct interpretation and analysis of DepMap CRISPR gene effect (Chronos) data. The most critical and common error in DepMap analyses is failing to negate the CRISPR scores when computing correlations with "essentiality." A secondary but equally damaging mistake is using bulk correlation shortcuts that mishandle per-gene NaN patterns. This guide provides the mandatory sign convention, the correct per-gene NaN-safe Spearman correlation implementation, and data loading/alignment procedures.
The CRISPR gene effect score (produced by the Chronos algorithm) quantifies how gene knockout affects cell viability:
The DepMap portal distributes these scores in the file CRISPRGeneEffect.csv. Each row is a cell line (DepMap ID, e.g., ACH-000001) and each column is a gene in the format GENE_NAME (ENTREZ_ID), e.g., A1BG (1).
Because negative raw scores indicate essentiality, any analysis that asks about "essentiality" or "dependency" requires negating the raw CRISPR scores:
-CRISPRGeneEffect (negated)If you correlate expression with raw CRISPR scores and find 3 genes with correlation <= -0.6 and 0 genes with correlation >= 0.6, then the correct answer for "genes with strong positive correlation with essentiality" is 3, not 0. The negative correlations with raw scores ARE the positive correlations with essentiality.
The standard DepMap data files use a consistent structure:
ACH-XXXXXX)GENE_NAME (ENTREZ_ID) formatOmicsExpressionProteinCodingGenesTPMLogp1BatchCorrected.csv) uses the same index/column format, enabling direct alignmentDifferent genes have different patterns of missing data across cell lines. This is because not all genes are screened in all cell lines, and quality control may remove specific gene-cell line combinations.
Question: How should I compute correlations with DepMap CRISPR data?
├── Does the question mention "essentiality" or "dependency"?
│ ├── Yes → Negate CRISPR scores before correlating (see Best Practices #1)
│ └── No (raw gene effect) → Use raw scores directly
├── How should I compute correlations?
│ ├── Per-gene correlation → scipy.stats.spearmanr in a loop (see Best Practices #2)
│ └── Matrix-wide correlation → AVOID; use per-gene loop instead
└── How should I handle missing data?
├── Pairwise NaN removal → CORRECT (see Best Practices #3)
└── Global row/column dropping → INCORRECT; loses too much data| Scenario | Recommended Approach | Rationale | |----------|---------------------|-----------| | Correlating expression with "essentiality" | Negate CRISPR scores, then per-gene Spearman | Sign convention requires negation; per-gene handles NaN correctly | | Correlating expression with raw gene effect | Per-gene Spearman on raw scores | No negation needed, but NaN-safe per-gene loop still required | | Ranking genes by essentiality across cell lines | Rank by most negative mean raw score | More negative = more essential across the panel | | Identifying selectively essential genes | Compare score distributions across subgroups | Use per-subgroup mean/median of raw scores, then compare | | Filtering genes before correlation | Require minimum 10 valid cell line pairs | Genes with too few observations yield unreliable correlations |
DataFrame.corrwith, DataFrame.rank().corrwith()) handle NaN inconsistently across columns. The only reliable method is to compute Spearman correlation gene by gene using scipy.stats.spearmanr with pairwise-complete observations.# Negate: in DepMap, negative = essential.DataFrame.corrwith(method='spearman') or DataFrame.rank().corrwith() silently mishandle NaN values, potentially shifting correlations enough to push genes above or below significance thresholds.scipy.stats.spearmanr. See the reference implementation in the Workflow section below.dropna() on the entire DataFrame before correlation removes all cell lines that have any NaN in any gene, drastically reducing sample size.mask = ~(np.isnan(x) | np.isnan(y)). This preserves the maximum number of observations per gene.if mask.sum() < 10: continue. Adjust the threshold upward (e.g., 20) for more conservative analysis.common_lines = expr.index.intersection(crispr.index) and common_genes = expr.columns.intersection(crispr.columns), then subset both DataFrames before any computation.GENE_NAME (ENTREZ_ID). Attempting to match against plain gene symbols (e.g., TP53 instead of TP53 (7157)) will produce empty intersections.python import pandas as pd
# Load CRISPR gene effect data crispr = pd.read_csv('CRISPRGeneEffect.csv', index_col=0)
# Load expression data expr = pd.read_csv( 'OmicsExpressionProteinCodingGenesTPMLogp1BatchCorrected.csv', index_col=0 )
# Column format: "GENE_NAME (ENTREZ_ID)" e.g., "A1BG (1)" # Index: DepMap cell line IDs e.g., "ACH-000001"
python # Find common cell lines and genes common_lines = crispr.index.intersection(expr.index) common_genes = crispr.columns.intersection(expr.columns)
print(f"Common cell lines: {len(common_lines)}") print(f"Common genes: {len(common_genes)}")
# Subset to common crispr_aligned = crispr.loccommon_lines, common_genes] expr_aligned = expr.loccommon_lines, common_genes]
python expr_nan = expr_aligned.isna().sum().sum() crispr_nan = crispr_aligned.isna().sum().sum() print(f"Expression NaN count: {expr_nan}") print(f"CRISPR NaN count: {crispr_nan}")
python # Negate: in DepMap, negative raw score = essential # After negation, positive = essential essentiality = -crispr_aligned
python from scipy.stats import spearmanr import numpy as np
def compute_per_gene_spearman(expression_df, crispr_df, negate_crispr=True): """Compute Spearman correlation per gene with proper NaN handling.
Args: expression_df: DataFrame (cell_lines x genes) crispr_df: DataFrame (cell_lines x genes) negate_crispr: If True, negate CRISPR scores to represent essentiality
Returns: Series of Spearman correlations indexed by gene name """ # Align cell lines and genes common_lines = expression_df.index.intersection(crispr_df.index) common_genes = expression_df.columns.intersection(crispr_df.columns)
expr = expression_df.loccommon_lines, common_genes] crispr = crispr_df.loccommon_lines, common_genes]
if negate_crispr: crispr = -crispr
# Print NaN summary BEFORE analysis expr_nan = expr.isna().sum().sum() crispr_nan = crispr.isna().sum().sum() print(f"Expression NaN count: {expr_nan}") print(f"CRISPR NaN count: {crispr_nan}") print(f"Common cell lines: {len(common_lines)}") print(f"Common genes: {len(common_genes)}")
# Per-gene Spearman correlation with pairwise NaN removal correlations = {} for gene in common_genes: x = exprgene].values y = crisprgene].values
# Remove pairs where either value is NaN mask = ~(np.isnan(x) | np.isnan(y)) if mask.sum() < 10: # Skip genes with too few valid pairs continue
rho, pval = spearmanr(xmask], ymask]) correlationsgene] = rho
return pd.Series(correlations).sort_values(ascending=False)
python correlations = compute_per_gene_spearman(expr_aligned, crispr_aligned, negate_crispr=True)
threshold = 0.6 strong_positive = correlationscorrelations >= threshold] strong_negative = correlationscorrelations <= -threshold]
print(f"Genes with correlation >= {threshold}: {len(strong_positive)}") print(f"Genes with correlation <= -{threshold}: {len(strong_negative)}") print(f"\nNote: CRISPR scores were negated so that positive correlation") print(f"indicates higher expression associated with greater essentiality.")
Verify that none of these bulk shortcuts were used anywhere in the analysis:
python # WRONG: Bulk rank-then-correlate shortcut ranked_expr = expression_df.rank() ranked_crispr = crispr_df.rank() correlations = ranked_expr.corrwith(ranked_crispr) # NaN handling is unreliable
# WRONG: Bulk corrwith with method='spearman' correlations = expression_df.corrwith(crispr_df, method='spearman') # Same issue
If any of these patterns appear in the code, replace them with the per-gene loop from Step 5.
nan-safe-correlation -- General techniques for NaN-safe correlation computation across omics datasets; this guide applies those principles specifically to DepMap CRISPR datadegenerate-input-filtering -- Upstream data quality filtering to remove low-variance or degenerate features before correlation analysis; recommended as a preprocessing step before DepMap essentiality correlation| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-13 | pass→pass | 17,475 | 12,729 | -27% | 1 | 1 | 0% | 3,386 | 6,037 | +78% | 0 | 0 | — |
case-01 | fail→pass | 20,723 | 19,391 | -6% | 1 | 1 | 0% | 3,733 | 6,390 | +71% | 0 | 0 | — |
case-02 | fail→pass | 18,263 | 17,710 | -3% | 1 | 1 | 0% | 3,692 | 7,010 | +90% | 0 | 0 | — |
case-03 | fail→pass | 16,446 | 19,544 | +19% | 1 | 1 | 0% | 3,147 | 7,685 | +144% | 0 | 0 | — |
case-04 | pass→pass | 18,521 | 8,167 | -56% | 1 | 1 | 0% | 3,527 | 5,275 | +50% | 0 | 0 | — |
case-05 | pass→pass | 11,367 | 6,602 | -42% | 1 | 1 | 0% | 2,071 | 4,549 | +120% | 0 | 0 | — |
case-06 | pass→pass | 10,475 | 6,150 | -41% | 1 | 1 | 0% | 1,860 | 4,599 | +147% | 0 | 0 | — |
case-07 | fail→pass | 32,681 | 17,072 | -48% | 1 | 1 | 0% | 6,187 | 6,713 | +9% | 0 | 0 | — |
case-08 | pass→pass | 17,907 | 11,194 | -37% | 1 | 1 | 0% | 2,964 | 5,645 | +90% | 0 | 0 | — |
case-09 | pass→pass | 24,216 | 15,246 | -37% | 1 | 1 | 0% | 4,842 | 6,800 | +40% | 0 | 0 | — |
case-10 | pass→pass | 18,530 | 12,316 | -34% | 1 | 1 | 0% | 3,188 | 5,803 | +82% | 0 | 0 | — |
case-11 | pass→pass | 21,494 | 15,149 | -30% | 1 | 1 | 0% | 4,074 | 6,288 | +54% | 0 | 0 | — |
case-12 | fail→pass | 23,717 | 21,136 | -11% | 1 | 1 | 0% | 4,516 | 7,990 | +77% | 0 | 0 | — |
case-14 | fail→pass | 18,908 | 8,889 | -53% | 1 | 1 | 0% | 3,272 | 5,307 | +62% | 0 | 0 | — |
case-15 | pass→pass | 12,983 | 11,200 | -14% | 1 | 1 | 0% | 2,499 | 5,662 | +127% | 0 | 0 | — |
case-16 | fail→pass | 18,822 | 16,087 | -15% | 1 | 1 | 0% | 3,278 | 6,650 | +103% | 0 | 0 | — |
case-17 | fail→pass | 14,498 | 15,543 | +7% | 1 | 1 | 0% | 2,557 | 6,752 | +164% | 0 | 0 | — |
case-18 | fail→pass | 15,461 | 12,739 | -18% | 1 | 1 | 0% | 2,881 | 5,888 | +104% | 0 | 0 | — |
case-19 | pass→pass | 16,083 | 15,851 | -1% | 1 | 1 | 0% | 3,078 | 6,478 | +110% | 0 | 0 | — |
case-20 | pass→pass | 15,587 | 13,618 | -13% | 1 | 1 | 0% | 2,936 | 6,075 | +107% | 0 | 0 | — |
case-21 | pass→pass | 17,058 | 11,637 | -32% | 1 | 1 | 0% | 3,118 | 5,574 | +79% | 0 | 0 | — |
case-22 | pass→pass | 8,132 | 6,258 | -23% | 1 | 1 | 0% | 1,345 | 4,597 | +242% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +41 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.