VCF PASS Count
When to Use
- Count filtered variants in VCF files
- Analyze VCF FILTER column
- Calculate pass/fail variant statistics
Input
/root/input.vcf: VCF v4.2 format
Variant Classification
A variant PASSES if:
- FILTER column is "PASS", OR
- FILTER column is missing/empty
A variant FAILS if:
- FILTER column has any other value
Field check for raw VCF rows:
- Column 6 / index 5 =
QUAL - Column 7 / index 6 =
FILTER - Classify from
FILTERonly; never fromQUAL.
Important: apply the task definition literally when counting.
- Treat
PASSas pass. - Treat an empty/missing FILTER value as pass.
- In standard VCF text, a FILTER value of
.means no filters applied, so count.as pass when it appears in the file. - Any other non-empty FILTER value (for example
q10orLowQual) is fail. - Do not narrow the pass rule to only
PASSand.if the task also says empty/missing counts as pass. - Do not add extra interpretation rules beyond the task definition and the values actually present in the file.
Output Format
To /root/output.txt:
Total variants: N
Passed variants: M
Failed variants: K
- Write
/root/output.txtin the exact three-line format shown above, with labels, order, and line breaks unchanged.
VCF Structure
A VCF data row uses the 7th column (FILTER) for pass/fail classification:
#CHROM POS ID REF ALT QUAL FILTER INFO
chr1 100 . A G . PASS ...
chr2 200 . C T . . ...
- Confirm from the
#CHROMheader or a sample row thatFILTERis the 7th column (index 6). - Dot (
.) inFILTERmeans no filters applied = PASS.
Verification
Verification
- Inspect
/root/input.vcfdirectly before writing final counts; do not rely only on a precomputed summary. - Skip header lines beginning with
#, then classify each variant from the 7th column (FILTER). - Verify the final numbers satisfy
Total = Passed + Failed.
#CHROM POS ID REF ALT QUAL FILTER INFO
chr1 100 . A G . PASS ...
chr2 200 . C T . . ...