#!/usr/bin/env python
##coding=utf-8
import re
import os
import sys
import argparse
parser = argparse.ArgumentParser(description="\n\033[1;32;40m \
Usage: python vcfstat.py -i [sample.anno.hg19_multianno.vcf] -o [stat.sv.txt]\033[0m ")
parser.add_argument('-i', '--inputvcf', help = 'the sample vcf information file', required = True)
parser.add_argument('-o', '--output', help = 'the analysis of the pathway', required = True)
argv = vars(parser.parse_args())
inF = os.path.abspath(argv['inputvcf'].strip())
ouF = os.path.abspath(argv['output'].strip())
def drawvcf(INF,OUF):
ouc=open(OUF,'w')
ouc.write("SV_Lenght\tSV_type\n")
with open(INF,'r') as l:
for li in l:
lis=li.strip().split('\t')
if str(lis[0]).startswith("#"):
continue
else:
info=str(lis[7]).strip().split(";")
for infol in info:
if "SVTYPE" in str(infol):
infoli=str(infol).strip().split("=")
typekeyi=infoli[1]
elif str(infol).startswith("SVLEN"):
infoli=str(infol).strip().split("=")
svlen=abs(int(infoli[1]))
ouc.write(str(svlen)+"\t"+str(typekeyi)+"\n")
statvcf(inF,ouF)
网友评论