Source

utils / fixvcf.py

Full commit
#/usr/bin/env python
# fix VCF from VarScan2, which writes InDels in a not compliant way...
import sys

for line in open(sys.argv[1]):
  if line[0] == '#': 
    sys.stdout.write(line)
    continue
  fields = line.strip().split()
  alt_alleles = fields[4].split('/')
  # keep only the first, right now
  fields[4] = alt_alleles[0]
  if fields[4][0] == '+':
    fields[4] = fields[3] + fields[4][1:]
  elif fields[4][0] == '-':
    fields[3] = fields[3] + fields[4][1:]
    fields[4] = fields[3][0]
  sys.stdout.write('\t'.join(fields) + '\n')