PheWAS_Plotting | R Documentation |
These functions permit the plotting of a variety of data types found when working with phenotypes. The functions are sequentially nested calls as outlined below. Supplying lower level parameters will permit tweaks to the higher level functions as well.
phewasManhattan(d, annotate.phenotype.description=T, ...)
phenotypeManhattan(d, suggestive.line = 0.05, significant.line,
OR.size = F, OR.direction = F, sizes, annotate.level,
y.axis.interval = 5, y.axis.label = expression(-log[10](italic(p))), max.y,
...)
phenotypePlot(d, max.y,max.x, suggestive.line, significant.line,
size.x.labels=9, size.y.labels=9, switch.axis=F,
sort.by.value=F, sort.by.category.value=F,
base.labels=F, annotate.phenotype.description,
annotate.angle=0, annotate.size=5, annotate.level,
annotate.phenotype=F, annotate.snp.w.phenotype=F,
annotate.snp=F, annotate.snp.angle=0,
annotate.list, annotate.only.largest=T,
lc.labels=F, x.group.labels=T, x.phenotype.labels=F,
sizes=F, direction=F, point.size=3,
use.color=T, color.palette,
title= paste0("Phenotype Plot ", date()),
x.axis.label="Phenotypes",
y.axis.label="Values",
y.axis.interval=5)
d |
Data frame containing |
... |
Further parameters to be passed down to |
suggestive.line |
For |
significant.line |
For |
OR.size |
Adjust point size based on odds ratios? Requires d to contain the |
OR.direction |
Adjust point shape based on odds ratio direction? Requires d to contain the |
annotate.level |
For |
y.axis.interval |
The interval for y axis labeling. Defaults to 5. Scale is in -log10 units for the Manhattan plots and is the same as |
x.axis.label |
The label for the x axis. Defaults to "Phenotypes". |
y.axis.label |
The label for the y axis. Defaults to a stylized "-log10(p)" for the Manhattan plots and "Values" for |
max.y |
For the Manhattan plots, the maximum |
max.x |
Maximum number of |
size.x.labels |
The size of the x axis labels. |
size.y.labels |
The size of the y axis labels. |
switch.axis |
Switch the X and Y axis? Currently non-functioning. Defaults to false. |
sort.by.value |
Sort the plot by highest to lowest |
sort.by.category.value |
Sort the plot by |
base.labels |
Use base ggplot2 labels? Defaults to FALSE, which uses ggrepel. |
annotate.phenotype.description |
Contains either TRUE or a data frame that contains description annotations for each phenotype. Should contain columns "phenotype" and "description". Missing or FALSE yields no description annotation. |
annotate.angle |
Angle for annotation text. |
annotate.size |
Size of annotation text |
annotate.phenotype |
Include the phenotype name in the annotation? Default is FALSE. |
annotate.snp.w.phenotype |
Include the snp in the phenotype annotation? Default is FALSE. |
annotate.snp |
Annotate the SNP? This is a second annotation, default is FALSE. |
annotate.snp.angle |
Angle of annotation for the SNP only annotation. |
annotate.list |
A vector of |
annotate.only.largest |
Should only the largest point for each phenotype be annotated? Default is TRUE, which only shows text for each phenotype once, even if multiple points pass the annotation threshold or are listed. |
lc.labels |
Force the labels to lower case? Default is FALSE. |
x.group.labels |
Label the phenotype groups? Requires group attributes in |
x.phenotype.labels |
Label every phenotype? Default is no, cannot be used in conjunction with |
sizes |
Adjust point size based on |
direction |
Adjust point shape based on |
point.size |
Size of the points. Default is 2. |
use.color |
Color the points? Requires |
color.palette |
An alternate color palette. Requires at least the number of groups that exist. |
title |
Title for the plot. Defaults to "Phenotype Plot" with the date and time. |
These functions are nested: phewasManhattan
calls phenotypeManhattan
which calls phenotypePlot
.
phewasManhattan
generates a PheWAS Manhattan plot and can be used with a result data frame from phewas
using phecodes. This function only adds PheWAS code groupings and descriptions as applicable before calling phenotypeManhattan
.
phenotypeManhattan
performs the transformations to the data and paramters for a -log10 scale. It is useful in cases of phewas
results using other phenotypes besides phecodes.
phenotypePlot
does the actual plotting and can be used to visualize non-p-value data.
All of these functions return ggplot2
objects. Aspects of the plots can be modified post hoc, for instance to adjust the point size scale one can use plot + scale_size(<parameters>)
A ggplot2
plot. It contains PheWAS codes against their -log10 transformed p-values for phewasManhattan
, generic phenotypes versus -log10 transformed p-values for phenotypeManhattan
, and generic phenotypes versus generic values for phenotypePlot
.
The PheWAS package
for a complete example.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.