Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions qmplot/modules/_manhattan.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def manhattanplot(data, chrom="#CHROM", pos="POS", pv="P", snp="ID", logp=True,
sign_marker_p=None, sign_marker_color="r",
is_annotate_topsnp=False, highlight_other_SNPs_indcs=None,
highlight_other_SNPs_color="r", highlight_other_SNPs_kwargs=None,
annotate_highlighted_SNPs=False,
text_kws=None, ld_block_size=50000, **kwargs):
"""Creates a manhattan plot from PLINK assoc output (or any data frame with chromosome, position, and p-value).

Expand Down Expand Up @@ -123,6 +124,9 @@ def manhattanplot(data, chrom="#CHROM", pos="POS", pv="P", snp="ID", logp=True,
highlight_other_SNPs_kwargs=None : Dict, or None, optional
Dict of keyword arguments passed to the command highlighting the other SNPs.

annotate_highlighted_SNPs=False : bool, optional
Set to True to annotated SNVs highlted with "highlight_other_SNPs_indcs".

text_kws: key, value pairings, or None, optional
keyword arguments for plotting in`` matplotlib.axes.Axes.text(x, y, s, fontdict=None, **kwargs)``

Expand Down Expand Up @@ -312,6 +316,12 @@ def manhattanplot(data, chrom="#CHROM", pos="POS", pv="P", snp="ID", logp=True,
for i in highlight_other_SNPs_indcs:
ax.scatter(x[i], y[i], c=highlight_other_SNPs_color,
alpha=alpha, edgecolors="none", **highlight_other_SNPs_kwargs)
if annotate_highlighted_SNPs and (snp is not None): # to annotate highlighted SNVs
texts = []
for i in highlight_other_SNPs_indcs:
snp_id = data[snp].iloc[i]
texts.append(ax.text(x[i], y[i], snp_id)) # x_pos, y_value, text (snp ID)
adjust_text(texts, ax=ax, **text_kws)

# Add GWAS significant lines
if "color" in hline_kws:
Expand Down