Skip to content

Commit

Permalink
Merge pull request #3 from atgu/fix_chrM_handling
Browse files Browse the repository at this point in the history
Fix chrM handling
  • Loading branch information
LindoNkambule authored Sep 30, 2024
2 parents e5d6987 + e8bfbea commit a444bf1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gwaspy/preimp_qc/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def manhattan_plot(pvals, significance_threshold: float = -np.log10(5E-08), titl
data.columns = ['locus', 'p', 'chromosome', 'position'] # rename columns
data['position'] = data['position'].astype(int)
data['chromosome'] = data['chromosome'].str.replace('chr', '')
data['chromosome'].replace({"X": 23, "Y": 24, "MT": 25}, inplace=True)
data['chromosome'].replace({"X": 23, "Y": 24, "MT": 25, "M":25}, inplace=True)
data['chromosome'] = data['chromosome'].astype(int)
data.dropna(subset=['p'], inplace=True) # drop NAs as log10(val) won't work

Expand Down
14 changes: 11 additions & 3 deletions gwaspy/preimp_qc/preimp_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,18 @@ def preimp_qc(input_type: str = None, dirname: str = None, basename: str = None,
data_type = 'no-pheno'

chroms = mt.aggregate_rows(hl.agg.collect_as_set(mt.locus.contig))
if ('chrX' or 'chrY' or 'chrMT') in chroms:
chromx, chromy, chrommt = 'chrX', 'chrY', 'chrMT'
if ('chrX' or 'chrY' or 'chrMT' or 'chrM') in chroms:
chromx, chromy = 'chrX', 'chrY'
if ('chrMT') in chroms:
chrommt = 'MT'
else:
chrommt = 'M'
else:
chromx, chromy, chrommt = 'X', 'Y', 'MT'
chromx, chromy = 'X', 'Y'
if ('chrMT') in chroms:
chrommt = 'MT'
else:
chrommt = 'M'

# we need to compute call rate for chr1-23 and chrY separately since females have no chrY
mt = mt.annotate_entries(
Expand Down

0 comments on commit a444bf1

Please sign in to comment.