pysumstats.plot¶
pysumstats.plot, a subpackage for generating plots from summary statistics data
Manhattan plot¶
-
plot.
manhattan
(fig=None, ax=None, filename=None, sigp=5e-08, sigcolor='black', sugp=1e-05, sugcolor='black', pointcolors=['midnightblue', 'goldenrod'], figsize=(12, 6), highlight=[], highlightcolors=['orange'], title=None, rainbow=False)¶ Create a Manhattan plot.
Parameters: - dataframe – pd.Dataframe containing the following columns: [‘rsid’, ‘chr’, ‘bp’, ‘p’], or
pysumstats.SumStats
- fig – matplotlib.pyplot figure object to plot to (if not specified a new figure will be created)
- ax – matplotlib.pyplot axis to plot to (if not specified a new figure will be created)
- filename (str.) – Path to store the figure to (defaults to return fig, ax objects)
- sigp (float) – Where to plot significant line(set to a negative number to remove)
- sigcolor (str) – Color to use for significant line
- sugp (float) – Where to plot significant line (set to a negative number to remove)
- sugcolor (str) – Color to use for suggestive line
- pointcolors (list) – List of colors to cycle through for plotting SNPs
- figsize ((float, float)) – Figure size in inches (width, height)
- highlight (list.) – list of SNPs to highlight
- highlightcolors (list.) – List of colors to cycle through for highlighting SNPs
- title (list.) – Main figure title
- rainbow (bool.) – Enble rainbow colors
Returns: None, or (fig, ax)
- dataframe – pd.Dataframe containing the following columns: [‘rsid’, ‘chr’, ‘bp’, ‘p’], or
QQ plot¶
-
plot.
qqplot
(fig=None, ax=None, filename=None, figsize=(8, 8), pointcolor='black', title=None, linecolor='red')¶ Function to generate a QQ-plot.
Parameters: - pvector – 1D-array of p-values
- fig – matplotlib.pyplot figure object to plot to (if not specified a new figure will be created)
- ax – matplotlib.pyplot axis to plot to (if not specified a new figure will be created)
- filename (str.) – Path to store the figure to (defaults to return fig, ax objects)
- figsize ((float, float)) – Figure size in inches (width, height)
- pointcolor (str.) – Color to use for points
- title (str.) – Main figure title.
- linecolor (str.) – Color for line x=y
Returns: None, or (fig, ax)
PZ plot¶
-
plot.
pzplot
(twotailed=True, difference_cutoff=0.1, fig=None, ax=None, filename=None, pointcolor='black', differentcolor='red', linecolor='black', differentlinecolor='red', title=None, figsize=(5, 5))¶ Generate a plot comparing the z-value as calculated from the p-value to the z-value as calculated from beta/se
Parameters: - data – 2D-array containing the columns [‘b’, ‘se’, ‘p’]
- twotailed (bool) – True if p-value was computed from both ends of the distribution.
- difference_cutoff (None or float) – Cut-off to use for highlighting SNPs with different z-values (to disable use None)
- fig – matplotlib.pyplot figure object to plot to (if not specified a new figure will be created)
- ax – matplotlib.pyplot axis to plot to (if not specified a new figure will be created)
- filename (str) – Path to store the figure to (defaults to return fig, ax objects)
- pointcolor (str) – Color to use for points
- differentcolor (str) – Color to use for points that deviate given difference_cutoff
- linecolor (str) – Color to use for the line x=y
- differentlinecolor (str) – Color to use for visualizing the difference_cutoff
- title (str.) – Main figure title.
- figsize ((int, int)) – Figure size
Returns: None or (fig, ax)
AF plot¶
-
plot.
afplot
(other_af, refname='ref_EAF', othername='other_EAF', difference_cutoff=0.1, fig=None, ax=None, filename=None, pointcolor='black', differentcolor='red', linecolor='black', differentlinecolor='red', title=None, figsize=(5, 5))¶ Generate a plot of (differences in) allele frequencies of two summary statistics.
Parameters: - ref_af – 1D-array of reference allele frequencies
- other_af – 1D-array of other allele frequencies
- refname (str) – Name to use for reference allele frequencies (x-axis label)
- othername (str) – Name to use for other allele frequencies (y-axis label)
- difference_cutoff (None or float) – Cut-off to use for highlighting SNPs with different allele frequency (to disable use None)
- fig – matplotlib.pyplot figure object to plot to (if not specified a new figure will be created)
- ax – matplotlib.pyplot axis to plot to (if not specified a new figure will be created)
- filename (str) – Path to store the figure to (defaults to return fig, ax objects)
- pointcolor (str) – Color to use for points
- differentcolor (str) – Color to use for points that deviate given difference_cutoff
- linecolor (str) – Color to use for the line x=y
- differentlinecolor (str) – Color to use for visualizing the difference_cutoff
- title (str.) – Main figure title.
- figsize ((int, int)) – Figure size
Returns: None or (fig, ax)
ZZ plot¶
-
plot.
zzplot
(data_y, xname='Z_x', yname='Z_y', twotailed=True, difference_cutoff=0.5, fig=None, ax=None, filename=None, pointcolor='black', differentcolor='red', linecolor='black', differentlinecolor='red', title=None, figsize=(5, 5))¶ Generate a plot comparing the z-values from two GWAS summary statistics
Parameters: - data_x – 2D-array containing the column ‘z’, the columns [‘b’, ‘se’] or the column ‘p’ (this is priority order)
- data_y – 2D-array containing the column ‘z’, the columns [‘b’, ‘se’] or the column ‘p’ (this is priority order)
- twotailed (bool) – True if p-value was computed from both ends of the distribution.
- xname (str) – Name to use for z_values of data_x (x-axis label)
- yname (str) – Name to use for z_values of data_y (y-axis label)
- difference_cutoff (None or float) – Cut-off to use for highlighting SNPs with different z-values (to disable use None)
- fig – matplotlib.pyplot figure object to plot to (if not specified a new figure will be created)
- ax – matplotlib.pyplot axis to plot to (if not specified a new figure will be created)
- filename (str) – Path to store the figure to (defaults to return fig, ax objects)
- pointcolor (str) – Color to use for points
- differentcolor (str) – Color to use for points that deviate given difference_cutoff
- linecolor (str) – Color to use for the line x=y
- differentlinecolor (str) – Color to use for visualizing the difference_cutoff
- title (str.) – Main figure title.
- figsize ((int, int)) – Figure size
Returns: None or (fig, ax)