diff --git a/python/vcf_b36_to_hg18.py b/python/vcf_b36_to_hg18.py index 57102b3ae..24abdb017 100755 --- a/python/vcf_b36_to_hg18.py +++ b/python/vcf_b36_to_hg18.py @@ -1,5 +1,5 @@ from farm_commands2 import * -import os.path +import os import sys from optparse import OptionParser from datetime import date @@ -24,15 +24,20 @@ def main(): b36vcf, hg18vcf = args - out = open(hg18vcf, 'w') + temp = open("tmp", 'w') + mitotemp = open("mtmp",'w') for line in open(b36vcf): length = len(line) if length > 2 and line[0] != '#': if line[0:2] == 'MT': - sys.exit('Cannot convert MT containing VCFs, sorry') + spline = line.split("\t") + spline[0] = "chrM" + mitotemp.write("\t".join(spline)) line = 'chr' + line - out.write(line) + temp.write(line) out.close() + mitotemp.close() + os.system("cat mtmp tmp > "+hg18vcf+" ; rm mtmp ; rm tmp") if __name__ == "__main__": main()