Created
November 5, 2019 21:29
-
-
Save arteymix/16d2fb48394ee9e14a5004cef1ad6e75 to your computer and use it in GitHub Desktop.
Convert CADD annotations to VCF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Converts the CADD format to VCF | |
# | |
import sys | |
import csv | |
print('''##fileformat=VCFv4.2 | |
##INFO<ID=CADD_SCORE,Number=A,Type=Float,Description="CADD Score"> | |
#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO''') | |
reader = csv.reader(sys.stdin, delimiter='\t') | |
writer = csv.writer(sys.stdout, delimiter='\t') | |
for row in reader: | |
if row[0].startswith('#'): | |
continue | |
chrom, pos, ref, alt, cadd_score, cadd_phred = row | |
writer.writerow([chrom, pos, '.', ref, alt, cadd_phred, '.', 'CADD_SCORE={}'.format(cadd_score)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment