Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added color and ax options to manhattan_plot in util.py #15

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lucasmiranda42
Copy link

@lucasmiranda42 lucasmiranda42 commented Mar 23, 2021

I modified a bit your version of manhattan_plot to suit my needs. If you think it's appropriate, feel free to merge the slight changes :)

In a nutshell, I added two parameters, "color" and "ax". The first one just gives the user control over the color scheme of the plot, defaulting of course to the same configuration you have on the main branch.

The second adds the possibility to pass a pylab.axes object where to plot the figure, giving the user the possibility to superimpose two or more sets of SNPs to, for example, highlight certain regions. I leave an example below.

pylab.rcParams["figure.figsize"] = (22.0, 10.0)

ax = pylab.axes(label="manplot")    # Define the axes object where to plot
pylab.title("Example Manhattan plot")

chrom_starts = manhattan_plot(
               lmm_gwas_sumstats[["Chr", "ChrPos", "PValue"]].values,
               pvalue_line=5e-8,
               xaxis_unit_bp=True,
               ax=ax,
               )    # Store chrom_starts in a variable, which we'll pass to the second function call
manhattan_plot(
    snps_in_panel[["Chr", "ChrPos", "PValue"]].values,
    xaxis_unit_bp=True,
    color="red",
    chromosome_starts=chrom_starts,    # Pass the chrom_starts defined above
    alpha=1,
    ax=ax,
)

pylab.show()

The result, where two particular regions are highlighted in red:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant