Repository navigation
Description
Summary
Somatic SNV/InDel variants that are matched to a gene-level biomarker (BM_MATCH = by_gene_mut) can silently disappear from the SOMATIC_SNV_INDEL sheet of the Excel report while still appearing — with full evidence rows and tier — in SOMATIC_SNV_INDEL_BIOMARKER. In the affected rows, SAMPLE_ALTERATION is also blank in the biomarker sheet itself.
Confirmed on 2 of 294 real-world xlsx reports by unzipping the raw xlsx XML and grepping the underlying sheet data directly (bypassing readxl), and by checking the raw somatic VCF: both are real PASS somatic calls with solid tumor support.
TP53,chr17:7673802 C>T(rs28934576, ENTREZGENE 7157) — tumor DP=100, VAF=0.24, control VAF=0. 18 biomarker evidence rows (16× TIERT1, 2× TIERR1), allBM_MATCH = by_gene_mut. Present inSOMATIC_SNV_INDEL_BIOMARKER, absent from the 888-rowSOMATIC_SNV_INDELsheet for the same sample.NF1,chr17:31325814 C>T(rs1311255132, ENTREZGENE 4763) — tumor DP=211, VAF=0.10, control VAF=0.044. 3 biomarker evidence rows (OncoKB, TIERT2). Present inSOMATIC_SNV_INDEL_BIOMARKER, absent from the 13-rowSOMATIC_SNV_INDELsheet for the same sample.
Root cause
load_somatic_snv_indel() in pcgrr/R/input_data.R calls load_dna_variants() once (input_data.R:214-223). That call computes both callset$variant and callset$bm_evidence$eitems (gene-level biomarker matching) from the same raw, freshly-annotated variant table, before any further filtering.
After that call returns, load_somatic_snv_indel() keeps filtering callset$variant further:
- input_data.R:252-264 —
filter_read_support()drops rows failing configuredtumor_dp_min/tumor_af_min/tumor_ad_min/control_dp_min/control_af_max/control_ad_maxthresholds (pcgrr/R/utils.R:432). - input_data.R:267-361 — for tumor-only runs, further drops rows classified as likely-germline, and (if
exclude_nonexonicis set) drops non-exonic rows.
callset$bm_evidence is never referenced again anywhere in load_somatic_snv_indel() after the initial load_dna_variants() call (verified: zero occurrences of bm_evidence in the function body after line 223). So callset$bm_evidence$eitems stays frozen at its pre-filter state.
Downstream, in pcgrr/R/output_data.R:
SOMATIC_SNV_INDEL(output_data.R:651-666) is built from the final, filteredcallsets$snv_indel$variant.SOMATIC_SNV_INDEL_BIOMARKER(output_data.R:679-726) is built straight from the untouched, originalcallsets$snv_indel$bm_evidence[[clnsig]]$eitems.
Nothing reconciles the two. Any variant dropped from callset$variant by a post-load filter, but already matched to a gene-level biomarker before that filtering ran, becomes an orphaned row: it stays in the biomarker sheet (with its TIER) but disappears from the main variant sheet — and SAMPLE_ALTERATION is blank in the orphaned biomarker rows too, since that field is populated via a left-join against the same final, filtered variant set.
This likely explains both cases above: NF1's control VAF of 0.044 in particular looks like a plausible near-threshold hit for control_af_max in filter_read_support().
Suggested fix
After load_somatic_snv_indel() finalizes callset$variant (i.e. after filter_read_support() and, for tumor-only runs, the germline/non-exonic filters), re-sync callset$bm_evidence$eitems (and classification, per clnsig) against the final VAR_ID/ENTREZGENE/VARIANT_CLASS keys with a semi_join(), dropping evidence items for variants no longer present in the reported variant set.
Activity
sigven commentedon Aug 10, 2026
Fixed in version 2.3.2