Skip to content

Commit

Permalink
properly put low quality variants in mask
Browse files Browse the repository at this point in the history
  • Loading branch information
BioWilko committed Nov 12, 2024
1 parent 1bd24f0 commit 7f018b5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions artic/vcf_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7f018b5

Please sign in to comment.