Skip to content

Commit

Permalink
Updated the parser script
Browse files Browse the repository at this point in the history
  • Loading branch information
tgurbich committed Feb 16, 2021
1 parent e15f27e commit 493b932
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions parse_clingen_tsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
The output is two bed files, one for haploinsufficient regions and one for triplosensitive regions
"""
parser = argparse.ArgumentParser()
parser.add_argument('--infile', help='Input file in bed format; the first four columns should be chromosome, '
'start position, end position, CNV type (DEL or DUP)')
parser.add_argument('--infile', help='Input file in tsv format, downloaded from ClinGen;')
args = parser.parse_args()

if args.infile.endswith('tsv'):
outfile_hi = args.infile.replace('tsv', 'HI.bed')
outfile_hi = args.infile.replace('tsv', 'HI.bed')
outfile_ts = args.infile.replace('tsv', 'TS.bed')
else:
sys.exit('The file is not in the tsv format\n')
Expand All @@ -34,8 +33,8 @@
# if the score field is not empty, print to file
if fields[4]:
hi_out.write('{}\t{}\t{}\t{}\n'.format(chr, start.strip(), end.strip(), fields[4]))
if fields[9]:
ts_out.write('{}\t{}\t{}\t{}\n'.format(chr, start.strip(), end.strip(), fields[9]))
if fields[12]:
ts_out.write('{}\t{}\t{}\t{}\n'.format(chr, start.strip(), end.strip(), fields[12]))

infile.close()
hi_out.close()
Expand Down

0 comments on commit 493b932

Please sign in to comment.