From 7f018b5cb70f5df2e9cbab07938a73661fbfe4c0 Mon Sep 17 00:00:00 2001 From: Biowilko Date: Tue, 12 Nov 2024 16:24:33 +0000 Subject: [PATCH] properly put low quality variants in mask --- artic/vcf_filter.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/artic/vcf_filter.py b/artic/vcf_filter.py index f2025cfd..302465ed 100644 --- a/artic/vcf_filter.py +++ b/artic/vcf_filter.py @@ -47,8 +47,10 @@ def check_filter(self, v): class MedakaFilter: - def __init__(self, no_frameshifts): + def __init__(self, no_frameshifts, min_depth, min_variant_quality): self.no_frameshifts = no_frameshifts + self.min_depth = min_depth + self.min_variant_quality = min_variant_quality def check_filter(self, v, min_depth): try: @@ -65,6 +67,10 @@ def check_filter(self, v, min_depth): if v.num_het: return False + + if v.QUAL < self.min_variant_quality: + return False + return True @@ -94,10 +100,6 @@ def go(args): except KeyError: pass - if v.QUAL < args.min_variant_quality: - print(f"Suppress variant {v.POS} due to low quality") - continue - # now apply the filter to send variants to PASS or FAIL file if filter.check_filter(v, args.min_depth): vcf_writer.write_record(v)