Skip to content

Commit

Permalink
little bugs squashed
Browse files Browse the repository at this point in the history
  • Loading branch information
your.name committed Oct 9, 2020
1 parent 0cac6f9 commit 71955e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Binary file modified .DS_Store
Binary file not shown.
9 changes: 5 additions & 4 deletions SCRIPTS/gwas2cojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ def select(name, options, fail=True):
wrong_column_count += 1
continue
if postype_combined:
ch, bp, *_ = parts[hpos].split(':', 2) # Some append :<SNP>/:<INDEL>, just ignore
# ch, bp, *_ = parts[hpos].split(':', 2) # Some append :<SNP>/:<INDEL>, just ignore
ch, bp = parts[hpos].split(':', 2) # Some append :<SNP>/:<INDEL>, just ignore
if default_chr:
print('Default chromosome specified but reading chr:bp column.')
exit(1)
Expand Down Expand Up @@ -517,13 +518,13 @@ def select(name, options, can_fail=False):
with fopen(stats_filename) as f:
lineno = 0
for line in f:
if line.startswith('#'):
if line.startswith('##'):
# discard comments
continue
lineno += 1
if lineno == 1:
header = line.split()
hrsid = select('ident', ['rsid', 'snp', 'variantid'])
hrsid = select('ident', ['rsid', 'SNP', 'variantid'])
hch = select('chr', ['chr', 'chromosome'])
hbp = select('bp', ['bp', 'position', 'pos'])
heff = select('effect', [])
Expand Down Expand Up @@ -619,7 +620,7 @@ def select(name, options, can_fail=False):
continue
rsids_seen.add(rsid)
if output:
print(rsid, parts[heff], parts[hoth], freq, beta,
print(parts[hrsid], parts[heff], parts[hoth], freq, beta,
gwas_row.se, gwas_row.p, gwas_row.n, file=output)
if lineno % 100000 == 0:
message = '#{0}+{1}'.format(converted,discarded)
Expand Down

0 comments on commit 71955e6

Please sign in to comment.