Source

utils / fixvcf.py

#/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')
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.