Skip to content

Commit 4e3c653

Browse files
committed
Added another filtering criteria.
1 parent dc69a05 commit 4e3c653

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

BAM_to_TCS.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import pysam
1818
from pipeutils import ASCII_to_num, FASTA_parser
19+
from math import ceil
1920

2021

2122
def TCSwriter(bamfile_name, fasta_d, minqual, mincov):
@@ -75,7 +76,12 @@ def TCSwriter(bamfile_name, fasta_d, minqual, mincov):
7576

7677
tcov += sum(covs) # Workaround
7778

78-
if tcov < mincov: # Discard position from TCS in this case
79+
# Discard position if below mincov:
80+
if tcov < mincov:
81+
keepline = False
82+
83+
# Discard low freq. second variant:
84+
elif sorted([int(x) for x in covs])[-2] <= (ceil(tcov * 0.2)):
7985
keepline = False
8086

8187
# Define reference base (AKA "B") and qual (AKA "Q")

0 commit comments

Comments
 (0)