Mercurial > repos > artbio > snvtocnv
diff sanitize_snv.py @ 0:0e54da14f831 draft
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/snvtocnv commit fd049d0796cbfaa6c41a7d80e84d3a734b30acc8"
author | artbio |
---|---|
date | Thu, 18 Feb 2021 18:59:53 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanitize_snv.py Thu Feb 18 18:59:53 2021 +0000 @@ -0,0 +1,24 @@ +import sys + +handle = open(sys.argv[1], 'r') +out = open(sys.argv[2], 'w') +for line in handle: + if line[0] == '#': + out.write(line) + continue + linelist = line.split('\t') + refcol = linelist[0].split('chr') + infocol = linelist[7].split('INDEL') + if len(infocol) > 1: + continue + if len(refcol) > 1: + refcol = refcol[1] + else: + refcol = refcol[0] + if refcol not in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', + '11', '12', '13', '14', '15', '16', '17', '18', '19', + '20', '21', '22', 'X', 'Y']: + continue + else: + linelist[0] = refcol + out.write('\t'.join(linelist))