← All examples
43

Canonical Grid model

Variant Review — Passed and Unfiltered

Review synthetic VCF filter states and called-allele frequencies.

Scale
Small
Source
biology-variant-review.grid
Length
36 lines
Collection
Advanced language
Level
Intermediate
Runtime
Portable
Version
1.1.0
biology-variant-review.grid
Get Grid
MODEL "Variant Review — Passed and Unfiltered"
DESCRIPTION "Review synthetic VCF filter states and called-allele frequencies."
VERSION "1.1.0"
TAGS "biology", "bioinformatics"

# Study inputs
input MinimumQuality = 30
  VALIDATE BETWEEN 0 AND 100 MESSAGE "Choose a quality threshold from 0 to 100."

# Synthetic variants: identical empty failure lists do not imply identical status
VcfText = "##fileformat=VCFv4.5\n#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSample_A\tSample_B\nchrToy\t10\tpassed\tA\tG\t60\tPASS\t.\tGT\t0/1\t1/1\nchrToy\t20\tunfiltered\tC\tT\t99\t.\t.\tGT\t0/1\t0/0\nchrToy\t30\tfailed\tG\tA\t10\tLowQual\t.\tGT\t./.\t./.\n"
Variants = BIO_PARSE_VCF(VcfText)
PassedMask = MAP(Variants.records, (variant) => AND(variant.filter_status = "passed", variant.quality >= MinimumQuality))

# Results
output VariantDataToPaste = VcfText
output WorkbenchInstructions = "In Variant, open Paste scientific data, paste VariantDataToPaste as VCF, use the data and import it. Compare all records with the Passed-only view. Change MinimumQuality from 30 to 70 in Inputs, then save and reopen the study; the formula selects no candidates at 70."
output PassedIds = FILTER(MAP(Variants.records, (variant) => variant.id), PassedMask, "No candidates")
output PassedCount = SUM(MAP(PassedMask, (passes) => IF(passes, 1, 0)))
output FirstAlternateFrequency = BIO_VARIANT_AF(Variants, 1, 1)
output FilterStates = MAP(Variants.records, (variant) => variant.filter_status)
output StudyNotes = "The baseline selects only passed and its ALT frequency is 0.75. Raising MinimumQuality to 70 selects none. Unfiltered is not passed. These synthetic calls demonstrate review rules, not clinical interpretation."

A1 = "Passing variant count"
B1 = PassedCount
A2 = "First variant ALT frequency"
B2 = FirstAlternateFrequency

Variant_1!type = "variant"
Variant_1!config = <toml>
  version = 1
  kind = "variant"
  title = "Review passed and unfiltered variants"
</toml>

END MODEL