From 6dcb63888db29e9e03d9491fbae0f10d2ca97a8c Mon Sep 17 00:00:00 2001 From: chartl Date: Fri, 30 Jul 2010 16:11:16 +0000 Subject: [PATCH] Be smart about the headers. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3912 348d0f76-0448-11de-a6fe-93d51630548a --- python/vcf_b36_to_hg18.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/python/vcf_b36_to_hg18.py b/python/vcf_b36_to_hg18.py index d27062812..685f826c4 100755 --- a/python/vcf_b36_to_hg18.py +++ b/python/vcf_b36_to_hg18.py @@ -28,13 +28,17 @@ def main(): mitotemp = open("mtmp",'w') for line in open(b36vcf): length = len(line) - if length > 2 and line[0] != '#': - if line[0:2] == 'MT': - spline = line.split("\t") - spline[0] = "chrM" - mitotemp.write("\t".join(spline)) - line = 'chr' + line - temp.write(line) + if length > 2 : + if line[0:2] == 'MT' or line[0] == "#": + if line[0] == "#": + mitotemp.write(line) + else: + spline = line.split("\t") + spline[0] = "chrM" + mitotemp.write("\t".join(spline)) + else: + line = 'chr' + line + temp.write(line) temp.close() mitotemp.close() os.system("cat mtmp tmp > "+hg18vcf+" ; rm mtmp ; rm tmp")