From f20cdbe60adb3410f600d896a3bdc297c50f8563 Mon Sep 17 00:00:00 2001 From: chartl Date: Fri, 30 Jul 2010 14:59:59 +0000 Subject: [PATCH] Modified to work with MT containing VCFs. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3910 348d0f76-0448-11de-a6fe-93d51630548a --- python/vcf_b36_to_hg18.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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()