Skip to content

Commit

Permalink
Merge pull request #43 from Akazhiel/master
Browse files Browse the repository at this point in the history
Fixed sample rename in mutect filter
  • Loading branch information
jfnavarro authored Feb 24, 2021
2 parents e191b79 + 037e7f0 commit 18171eb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hlapipeline/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ def mutect2_filter(input, output, sample1_ID, sample2_ID):
vcf = open(input)
for line in vcf:
if line.startswith('#') and not line.startswith('#CHROM'):
line.replace(sample1_ID, "TUMOR")
line.replace(sample2_ID, "NORMAL")
filtered_vcf.write(line)
if sample1_ID in line:
filtered_vcf.write(line.replace(sample1_ID, "TUMOR"))
elif sample2_ID in line:
filtered_vcf.write(line.replace(sample2_ID, "NORMAL"))
else:
filtered_vcf.write(line)
elif line.startswith('#CHROM'):
headers = line.strip().split('\t')
filtered_vcf.write(line)
filtered_vcf.write(line.replace(sample1_ID, "TUMOR").replace(sample2_ID, "NORMAL"))
elif not line.startswith('#'):
columns = line.strip().split('\t')
if 'PASS' in columns[headers.index('FILTER')]:
Expand Down

0 comments on commit 18171eb

Please sign in to comment.