Title: | Gene Locus Plot with Gene Annotations |
---|---|
Description: | Publication-ready regional gene locus plots similar to those produced by the web interface 'LocusZoom' <https://my.locuszoom.org>, but running locally in R. Genetic or genomic data with gene annotation tracks are plotted via R base graphics, 'ggplot2' or 'plotly', allowing flexibility and easy customisation including laying out multiple locus plots on the same page. It uses the 'LDlink' API <https://ldlink.nih.gov/?tab=apiaccess> to query linkage disequilibrium data from the 1000 Genomes Project and can overlay this on plots <doi:10.1093/bioadv/vbaf006>. |
Authors: | Myles Lewis [aut, cre] |
Maintainer: | Myles Lewis <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.3.7 |
Built: | 2025-02-10 22:25:10 UTC |
Source: | https://github.com/myles-lewis/locuszoomr |
Produces a plot of eQTL data embedded in a 'locus' class object. Intended for
use with set_layers()
.
eqtl_plot( loc, tissue = "Whole Blood", eqtl_gene = loc$gene, scheme = "RdYlBu", col = NA, pcutoff = NULL, xlab = NULL, ylab = expression("-log"[10] ~ "P"), cex.axis = 0.9, xticks = TRUE, border = FALSE, add = FALSE, align = TRUE, legend_pos = "topright", ... )
eqtl_plot( loc, tissue = "Whole Blood", eqtl_gene = loc$gene, scheme = "RdYlBu", col = NA, pcutoff = NULL, xlab = NULL, ylab = expression("-log"[10] ~ "P"), cex.axis = 0.9, xticks = TRUE, border = FALSE, add = FALSE, align = TRUE, legend_pos = "topright", ... )
loc |
Object of class 'locus' to use for plot. See locus. |
tissue |
GTex tissue in which eQTL has been measured |
eqtl_gene |
Gene showing eQTL effect |
scheme |
Character string specifying palette for effect size showing up/downregulation eQTL using grDevices::hcl.colors. Alternatively a vector of 6 colours. |
col |
Outline point colour. |
pcutoff |
Cut-off for p value significance. Defaults to p = 5e-08. Set
to |
xlab |
x axis title. |
ylab |
y axis title. |
cex.axis |
Specifies font size for axis numbering. |
xticks |
Logical whether x axis numbers and axis title are plotted. |
border |
Logical whether a bounding box is plotted around upper and lower plots. |
add |
Logical whether to add points to an existing plot or generate a new plot. |
align |
Logical whether set |
legend_pos |
Character value specifying legend position. See |
... |
Other arguments passed to |
No return value. Produces a scatter plot using base graphics.
locus()
set_layers()
scatter_plot()
Plot gene annotation tracks from ensembldb
data using plotly
.
genetrack_ly( locus, filter_gene_name = NULL, filter_gene_biotype = NULL, cex.text = 0.7, italics = FALSE, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = 8, width = 600, xlab = NULL, blanks = c("fill", "hide", "show"), height = NULL, plot = TRUE )
genetrack_ly( locus, filter_gene_name = NULL, filter_gene_biotype = NULL, cex.text = 0.7, italics = FALSE, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = 8, width = 600, xlab = NULL, blanks = c("fill", "hide", "show"), height = NULL, plot = TRUE )
locus |
Object of class 'locus' generated by |
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
cex.text |
Font size for gene text. |
italics |
Logical whether gene text is in italics. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
showExons |
Logical whether to show exons or simply show whole gene as a
rectangle. If |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
width |
Width of plotly plot in pixels which is purely used to prevent overlapping text for gene names. |
xlab |
Title for x axis. Defaults to chromosome |
blanks |
Controls handling of genes with blank names: |
height |
Height in pixels (optional, defaults to automatic sizing). |
plot |
Logical whether to produce plotly object or return plot coordinates. |
This function can used to plot gene annotation tracks on their own.
Either a 'plotly' plotting object showing gene tracks, or if
plot = FALSE
a list containing TX
, a dataframe of coordinates for
gene transcripts, and EX
, a dataframe of coordinates for exons.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") genetrack_ly(loc) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") genetrack_ly(loc) }
Plot gene annotation tracks from ensembldb
data.
genetracks( locus, filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.axis = 0.9, cex.lab = 1, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = NULL, text_pos = "top", italics = FALSE, xticks = TRUE, xlab = NULL, highlight = NULL, highlight_col = "red", blanks = c("fill", "hide"), showRecomb = TRUE, align = TRUE )
genetracks( locus, filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.axis = 0.9, cex.lab = 1, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = NULL, text_pos = "top", italics = FALSE, xticks = TRUE, xlab = NULL, highlight = NULL, highlight_col = "red", blanks = c("fill", "hide"), showRecomb = TRUE, align = TRUE )
locus |
Object of class 'locus' generated by |
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
border |
Logical whether a bounding box is plotted. |
cex.axis |
Specifies font size for axis numbering. |
cex.lab |
Specifies font size for axis titles. |
cex.text |
Font size for gene text. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
showExons |
Logical whether to show exons or simply show whole gene as a
rectangle. If |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
text_pos |
Character value of either 'top' or 'left' specifying placement of gene name labels. |
italics |
Logical whether gene text is in italics. |
xticks |
Logical whether x axis ticks and numbers are plotted. |
xlab |
Title for x axis. Defaults to chromosome |
highlight |
Vector of genes to highlight. |
highlight_col |
Single colour or vector of colours for highlighted genes. |
blanks |
Controls handling of genes with blank names: |
showRecomb |
Logical controls alignment of right margin if recombination data present. |
align |
Logical whether to set |
This function is called by locus_plot()
. It can be used to plot the gene
annotation tracks on their own. It uses base graphics, so layout()
can be
used to position adjacent plots above or below.
gene_col
, exon_col
and exon_border
set colours for all genes, while
highlight
and highlight_col
can optionally be used together to highlight
specific genes of interest. For full control over every single gene, users
can add columns gene_col
, exon_col
and exon_border
to the TX
object
within the 'locus' object. Columns added to TX
override their equivalent
arguments.
No return value.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") genetracks(loc) ## Limit the number of tracks genetracks(loc, maxrows = 4) ## Filter by gene biotype genetracks(loc, filter_gene_biotype = 'protein_coding') ## Customise colours genetracks(loc, gene_col = 'grey', exon_col = 'orange', exon_border = 'darkgrey') }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") genetracks(loc) ## Limit the number of tracks genetracks(loc, maxrows = 4) ## Filter by gene biotype genetracks(loc, filter_gene_biotype = 'protein_coding') ## Customise colours genetracks(loc, gene_col = 'grey', exon_col = 'orange', exon_border = 'darkgrey') }
Plot gene annotation tracks from ensembldb
data using the grid package to
create a grob.
genetracks_grob( locus, filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = NULL, text_pos = "top", italics = FALSE, highlight = NULL, highlight_col = "red", blanks = c("fill", "hide") )
genetracks_grob( locus, filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = NULL, text_pos = "top", italics = FALSE, highlight = NULL, highlight_col = "red", blanks = c("fill", "hide") )
locus |
Object of class 'locus' generated by |
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
border |
Logical whether a bounding box is plotted. |
cex.text |
Font size for gene text. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
showExons |
Logical whether to show exons or simply show whole gene as a
rectangle. If |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
text_pos |
Character value of either 'top' or 'left' specifying placement of gene name labels. |
italics |
Logical whether gene text is in italics. |
highlight |
Vector of genes to highlight. |
highlight_col |
Single colour or vector of colours for highlighted genes. |
blanks |
Controls handling of genes with blank names: |
This function is called by gg_genetracks()
. It can be used to
generate a grob of the gene annotation tracks on their own.
A grob object.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") g <- genetracks_grob(loc) grid::grid.newpage() grid::grid.draw(g) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") g <- genetracks_grob(loc) grid::grid.newpage() grid::grid.draw(g) }
Adds gene tracks to an existing ggplot2 plot.
gg_addgenes(p, loc, heights = c(3, 2), ...)
gg_addgenes(p, loc, heights = c(3, 2), ...)
p |
ggplot2 plot object. This can be generated by |
loc |
Object of class 'locus' to use for plot. See |
heights |
Vector specifying ratio of heights of upper plot and lower gene track. |
... |
Additional arguments passed to |
A ggplot2 plotting object.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") p <- gg_scatter(loc) gg_addgenes(p, loc) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") p <- gg_scatter(loc) gg_addgenes(p, loc) }
Plot gene annotation tracks from ensembldb
data using ggplot2 and grid.
gg_genetracks( loc, filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.axis = 1, cex.lab = 1, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = NULL, text_pos = "top", italics = FALSE, xticks = TRUE, xlab = NULL, highlight = NULL, highlight_col = "red", blanks = c("fill", "hide") )
gg_genetracks( loc, filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.axis = 1, cex.lab = 1, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = NULL, text_pos = "top", italics = FALSE, xticks = TRUE, xlab = NULL, highlight = NULL, highlight_col = "red", blanks = c("fill", "hide") )
loc |
Object of class 'locus' generated by |
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
border |
Logical whether a bounding box is plotted. |
cex.axis |
Specifies font size for axis numbering. |
cex.lab |
Specifies font size for axis titles. |
cex.text |
Font size for gene text. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
showExons |
Logical whether to show exons or simply show whole gene as a
rectangle. If |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
text_pos |
Character value of either 'top' or 'left' specifying placement of gene name labels. |
italics |
Logical whether gene text is in italics. |
xticks |
Logical whether x axis ticks and numbers are plotted. |
xlab |
Title for x axis. Defaults to chromosome |
highlight |
Vector of genes to highlight. |
highlight_col |
Single colour or vector of colours for highlighted genes. |
blanks |
Controls handling of genes with blank names: |
This function is called by locus_ggplot()
, and in turn it calls
genetracks_grob()
. It can be used to plot the gene annotation tracks on
their own as a ggplot2 object.
gene_col
, exon_col
and exon_border
set colours for all genes, while
highlight
and highlight_col
can optionally be used together to highlight
specific genes of interest. For full control over every single gene, users
can add columns gene_col
, exon_col
and exon_border
to the TX
object
within the 'locus' object. Columns added to TX
override their equivalent
arguments.
A ggplot2 object.
locus_ggplot()
genetracks_grob()
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") gg_genetracks(loc) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") gg_genetracks(loc) }
Produces a scatter plot from a 'locus' class object (without gene tracks).
gg_scatter( loc, index_snp = loc$index_snp, pcutoff = 5e-08, scheme = c("grey", "dodgerblue", "red"), size = 2, cex.axis = 1, cex.lab = 1, xlab = NULL, ylab = NULL, ylim = NULL, ylim2 = c(0, 100), yzero = (loc$yvar == "logP"), xticks = TRUE, border = FALSE, showLD = TRUE, LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"), recomb_col = "blue", recomb_offset = 0, legend_pos = "topleft", labels = NULL, eqtl_gene = NULL, beta = NULL, shape = NULL, shape_values = c(21, 24, 25), ... )
gg_scatter( loc, index_snp = loc$index_snp, pcutoff = 5e-08, scheme = c("grey", "dodgerblue", "red"), size = 2, cex.axis = 1, cex.lab = 1, xlab = NULL, ylab = NULL, ylim = NULL, ylim2 = c(0, 100), yzero = (loc$yvar == "logP"), xticks = TRUE, border = FALSE, showLD = TRUE, LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"), recomb_col = "blue", recomb_offset = 0, legend_pos = "topleft", labels = NULL, eqtl_gene = NULL, beta = NULL, shape = NULL, shape_values = c(21, 24, 25), ... )
loc |
Object of class 'locus' to use for plot. See locus. |
index_snp |
Specifies index SNP to be shown in a different colour and
symbol. Defaults to the SNP with the lowest p-value. Set to |
pcutoff |
Cut-off for p value significance. Defaults to p = 5e-08. Set
to |
scheme |
Vector of 3 colours if LD is not shown: 1st = normal points, 2nd = colour for significant points, 3rd = index SNP. |
size |
Specifies size for points. |
cex.axis |
Specifies font size for axis numbering. |
cex.lab |
Specifies font size for axis titles. |
xlab |
x axis title. |
ylab |
y axis title. |
ylim |
y axis limits (y1, y2). |
ylim2 |
Secondary y axis limits for recombination line. |
yzero |
Logical whether to force y axis limit to include y=0. |
xticks |
Logical whether x axis numbers and axis title are plotted. |
border |
Logical whether a bounding box is plotted around the plot. |
showLD |
Logical whether to show LD with colours |
LD_scheme |
Vector of colours for plotting LD. The first colour is for SNPs which lack LD information. The next 5 colours are for r2 or D' LD results ranging from 0 to 1 in intervals of 0.2. The final colour is for the index SNP. |
recomb_col |
Colour for recombination rate line if recombination rate
data is present. Set to NA to hide the line. See |
recomb_offset |
Offset from 0-1 which shifts the scatter plot up and recombination line plot down. Recommended value 0.1. |
legend_pos |
Position of legend. Set to |
labels |
Character vector of SNP or genomic feature IDs to label. The
value "index" selects the highest point or index SNP as defined when
|
eqtl_gene |
Optional column name in |
beta |
Optional column name for beta coefficient to display upward triangles for positive beta and downward triangles for negative beta (significant SNPs only). |
shape |
Optional column name in |
shape_values |
Vector of shape values which match levels of the column
specified by |
... |
Optional arguments passed to |
If recombination rate data is included in the locus object following a call
to link_recomb()
, this is plotted as an additional line with a secondary y
axis. In the base graphics version the line is placed under the scatter
points, but this is not possible with ggplot2 as the secondary y axis data
must be plotted on top of the primary scatter point data.
Returns a ggplot2 plot.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") gg_scatter(loc) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") gg_scatter(loc) }
Produces a line plot from a 'locus' class object. Intended for use with
set_layers()
.
line_plot( loc, pcutoff = 5e-08, xlab = NULL, ylab = expression("-log"[10] ~ "P"), cex.axis = 1, xticks = FALSE, border = FALSE, align = TRUE, ... )
line_plot( loc, pcutoff = 5e-08, xlab = NULL, ylab = expression("-log"[10] ~ "P"), cex.axis = 1, xticks = FALSE, border = FALSE, align = TRUE, ... )
loc |
Object of class 'locus' to use for plot. See locus. |
pcutoff |
Cut-off for p value significance. Defaults to p = 5e-08. Set
to |
xlab |
x axis title. |
ylab |
y axis title. |
cex.axis |
Specifies font size for axis numbering. |
xticks |
Logical whether x axis numbers and axis title are plotted. |
border |
Logical whether a bounding box is plotted around upper and lower plots. |
align |
Logical whether set |
... |
Other arguments passed to |
No return value. Produces a scatter plot using base graphics.
locus()
set_layers()
scatter_plot()
Adds eQTL (expression quantitative trait loci) information from GTEx
(https://gtexportal.org/) to a 'locus' class object. It queries LDlink
(https://ldlink.nci.nih.gov/) via the LDlinkR
package to retrieve GTEx eQTL
information on a reference SNP.
link_eqtl(loc, pop = "CEU", r2d = "r2", token = "", ...)
link_eqtl(loc, pop = "CEU", r2d = "r2", token = "", ...)
loc |
Object of class 'locus' generated by |
pop |
A 1000 Genomes Project population, (e.g. YRI or CEU), multiple
allowed, default = "CEU". Passed to |
r2d |
Either "r2" for LD r^2 or "d" for LD D', default = "r2". Passed
to |
token |
Personal access token for accessing 1000 Genomes LD data via
LDlink API. See |
... |
Optional arguments such as |
The additional eQTL information obtained from LDlink web server can be
displayed using eqtl_plot()
which generates a scatter plot with gene tracks
similar to a locus plot, or with overlay_plot()
which tries to overlay the
EQTL analysis over the original locus results (e.g. GWAS).
Returns an object of class 'locus' with an extra list element 'LDexp'
containing a dataframe of information obtained via LDexpress()
.
locus()
eqtl_plot()
overlay_plot()
Adds LD information to a 'locus' class object. It queries LDlink
(https://ldlink.nci.nih.gov/) via the LDlinkR
package to retrieve linkage
disequilibrium (LD) information on a reference SNP.
link_LD( loc, pop = "CEU", r2d = "r2", token = "", method = c("proxy", "matrix"), genome_build = loc$genome, ... )
link_LD( loc, pop = "CEU", r2d = "r2", token = "", method = c("proxy", "matrix"), genome_build = loc$genome, ... )
loc |
Object of class 'locus' generated by |
pop |
A 1000 Genomes Project population, (e.g. YRI or CEU), multiple
allowed, default = "CEU". Passed to |
r2d |
Either "r2" for LD r^2 or "d" for LD D', default = "r2". Passed
to |
token |
Personal access token for accessing 1000 Genomes LD data via
LDlink API. See |
method |
Either |
genome_build |
Choose between one of the three options: 'grch37' for genome build GRCh37 (hg19), 'grch38' for GRCh38 (hg38), or 'grch38_high_coverage' for GRCh38 High Coverage (hg38) 1000 Genome Project data sets. Default is GRCh37 (hg19). |
... |
Optional arguments which are passed on to |
The argument method
controls which LDlinkR function is used to retrieve LD
data. LDmatrix()
is slower but usually more complete for small queries
(<1000 SNPs). However, it has a limit of 1000 SNPs which can be queried.
LDproxy()
is faster but data on some SNPs may be absent.
Note, SNPs have to be correctly formatted as required by LDlinkR, either as
rsID (works with either method) or chromosome coordinate e.g. "chr7:24966446"
(works with LDproxy only). Default genome build is grch37
, see LDproxy()
or LDmatrix()
.
Returns a list object of class 'locus'. LD information is added as a
column ld
in list element data
.
Adds recombination data to a 'locus' object by querying UCSC genome browser.
link_recomb(loc, genome = loc$genome, table = NULL, recomb = NULL)
link_recomb(loc, genome = loc$genome, table = NULL, recomb = NULL)
loc |
Object of class 'locus' generated by |
genome |
Either |
table |
Optional character value specifying which recombination table to use. |
recomb |
Optional |
Uses the rtracklayer
package to query UCSC genome browser for recombination
rate data.
Possible options for table
for hg19 are "hapMapRelease24YRIRecombMap"
,
"hapMapRelease24CEURecombMap"
, "hapMapRelease24CombinedRecombMap"
(the
default). The only option for table
for hg38 is "recomb1000GAvg"
(the
default).
If you are doing many queries, it may be much faster to download the entire
recombination track data (around 30 MB for hg38) from the Recombination Rate
Tracks page at
UCSC genome browser.
The link to the hg38 download folder is
http://hgdownload.soe.ucsc.edu/gbdb/hg38/recombRate/ and for hg19 is
http://hgdownload.soe.ucsc.edu/gbdb/hg19/decode/. These .bw files can be
converted to useable GRanges
objects using rtracklayer::import.bw()
(see
the vignette).
Sometimes rtracklayer
generates intermittent API errors or warnings: try
calling link_recomb()
again. If warnings persist restart your R session.
Errors are handled gracefully using try()
to allow users to wrap
link_recomb()
in a loop without quitting halfway. Error messages are still
shown. Successful API calls are cached using memoise
to reduce API
requests.
A list object of class 'locus'. Recombination data is added as list
element recomb
.
Creates object of class 'locus' for genomic locus plot similar to
locuszoom
.
locus( data = NULL, gene = NULL, xrange = NULL, seqname = NULL, flank = NULL, fix_window = NULL, ens_db, chrom = NULL, pos = NULL, p = NULL, yvar = NULL, labs = NULL, index_snp = NULL, LD = NULL, std_filter = TRUE )
locus( data = NULL, gene = NULL, xrange = NULL, seqname = NULL, flank = NULL, fix_window = NULL, ens_db, chrom = NULL, pos = NULL, p = NULL, yvar = NULL, labs = NULL, index_snp = NULL, LD = NULL, std_filter = TRUE )
data |
Dataset (data.frame or data.table) to use for plot. If
unspecified or |
gene |
Optional character value specifying which gene to view. Either
|
xrange |
Optional vector of genomic position range for the x axis. |
seqname |
Optional, specifies which chromosome to plot. |
flank |
Single value or vector with 2 values for how much flanking region left and right of the gene to show. Defaults to 100kb. |
fix_window |
Optional alternative to |
ens_db |
Either a character string which specifies which Ensembl
database package (version 86 and earlier for Homo sapiens) to query for
gene and exon positions (see |
chrom |
Determines which column in |
pos |
Determines which column in |
p |
Determines which column in |
yvar |
Specifies column in |
labs |
Determines which column in |
index_snp |
Specifies the index SNP. If not specified, the SNP with the
lowest P value is selected. Can be used to specify locus region instead of
specifying |
LD |
Optional character value to specify which column in |
std_filter |
Logical, whether standard filters on chromosomes 1-22, X &
Y, and filtering of genes to only those whose transcript ids start with
"ENS" are applied. For users with novel genome assemblies, this probably
needs to be set to |
This is an R version of locuszoom
(http://locuszoom.org) for generating
publication ready Manhattan plots of gene loci. It references Ensembl
databases using the ensembldb
Bioconductor package framework for annotating
genes and exons in the locus.
Returns a list object of class 'locus' ready for plotting, containing:
seqname |
chromosome value |
xrange |
vector of genomic position range |
gene |
gene name |
ens_db |
Ensembl or AnnotationHub database |
ens_version |
Ensembl database version |
organism |
Ensembl database organism |
genome |
Ensembl data genome build |
chrom |
column name in |
pos |
column name in |
p |
column name in |
yvar |
column name in |
labs |
column name in |
index_snp |
id of the most significant SNP |
data |
the subset of GWAS data to be plotted |
TX |
dataframe of transcript annotations |
EX |
|
If data
is NULL
when locus()
is called then gene track information
alone is returned.
locus_plot()
locus_ggplot()
locus_plotly()
## Bioconductor package EnsDb.Hsapiens.v75 is needed for these examples if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") summary(loc) locus_plot(loc) loc2 <- locus(SLE_gwas_sub, gene = 'STAT4', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") locus_plot(loc2) }
## Bioconductor package EnsDb.Hsapiens.v75 is needed for these examples if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") summary(loc) locus_plot(loc) loc2 <- locus(SLE_gwas_sub, gene = 'STAT4', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") locus_plot(loc2) }
Genomic locus plot similar to locuszoom.
locus_ggplot( loc, heights = c(3, 2), filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.axis = 1, cex.lab = 1, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = 12, text_pos = "top", italics = FALSE, xticks = "top", xlab = NULL, highlight = NULL, highlight_col = "red", blanks = "fill", ... )
locus_ggplot( loc, heights = c(3, 2), filter_gene_name = NULL, filter_gene_biotype = NULL, border = FALSE, cex.axis = 1, cex.lab = 1, cex.text = 0.7, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = 12, text_pos = "top", italics = FALSE, xticks = "top", xlab = NULL, highlight = NULL, highlight_col = "red", blanks = "fill", ... )
loc |
Object of class 'locus' to use for plot. See |
heights |
Vector supplying the ratio of top to bottom plot. |
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
border |
Logical whether a bounding box is plotted. |
cex.axis |
Specifies font size for axis numbering. |
cex.lab |
Specifies font size for axis titles. |
cex.text |
Font size for gene text. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
showExons |
Logical whether to show exons or simply show whole gene as a
rectangle. If |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
text_pos |
Character value of either 'top' or 'left' specifying placement of gene name labels. |
italics |
Logical whether gene text is in italics. |
xticks |
Logical whether x axis ticks and numbers are plotted. |
xlab |
Title for x axis. Defaults to chromosome |
highlight |
Vector of genes to highlight. |
highlight_col |
Single colour or vector of colours for highlighted genes. |
blanks |
Controls handling of genes with blank names: |
... |
Additional arguments passed to |
Arguments to control plotting of the gene tracks are passed onto
gg_genetracks()
and for the scatter plot are passed via ...
to
gg_scatter()
. See the documentation for each of these functions for
details.
Returns a ggplot2 plot containing a scatter plot with genetracks underneath.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") locus_ggplot(loc) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") locus_ggplot(loc) }
Genomic locus plot similar to locuszoom.
locus_plot( loc, filter_gene_name = NULL, filter_gene_biotype = NULL, xlab = NULL, cex = 1, cex.axis = 0.9, cex.lab = 1, cex.text = 0.7, use_layout = TRUE, heights = c(3, 2), showExons = TRUE, maxrows = 7, xticks = "bottom", border = FALSE, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", text_pos = "top", italics = FALSE, highlight = NULL, highlight_col = "red", blanks = "fill", recomb_col = "blue", ... )
locus_plot( loc, filter_gene_name = NULL, filter_gene_biotype = NULL, xlab = NULL, cex = 1, cex.axis = 0.9, cex.lab = 1, cex.text = 0.7, use_layout = TRUE, heights = c(3, 2), showExons = TRUE, maxrows = 7, xticks = "bottom", border = FALSE, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", text_pos = "top", italics = FALSE, highlight = NULL, highlight_col = "red", blanks = "fill", recomb_col = "blue", ... )
loc |
Object of class 'locus' to use for plot. See |
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
xlab |
x axis title. |
cex |
Specifies size for points. |
cex.axis |
Specifies font size for axis numbering. |
cex.lab |
Specifies font size for axis titles. |
cex.text |
Font size for gene text. |
use_layout |
Logical whether |
heights |
Ratio of top to bottom plot. See layout. |
showExons |
Logical whether to show exons or simply show whole gene as a rectangle |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
xticks |
Character value of either 'top' or 'bottom' specifying whether x axis ticks and numbers are plotted on top or bottom plot window. |
border |
Logical whether a bounding box is plotted around upper and lower plots. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
text_pos |
Character value of either 'top' or 'left' specifying placement of gene name labels. |
italics |
Logical whether gene text is in italics. |
highlight |
Vector of genes to highlight. |
highlight_col |
Single colour or vector of colours for highlighted genes. |
blanks |
Controls handling of genes with blank names: |
recomb_col |
Colour for recombination rate line if recombination rate
data is present. Set to |
... |
Other arguments passed to |
This is an R version of locuszoom for generating publication ready Manhattan
plots of gene loci. It references Ensembl databases for annotating genes
and exons. Use locus()
first to generate an object of class 'locus' for
plotting. LDlink web server can be queried using function link_LD()
to
retrieve linkage disequilibrium (LD) information on the index SNP.
Arguments to control plotting of the gene tracks are passed onto
genetracks()
and for the scatter plot are passed via ...
to
scatter_plot()
. See the documentation for each of these functions for
details.
No return value.
locus()
scatter_plot()
genetracks()
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") locus_plot(loc) ## Use embedded LD information in column `r2` loc2 <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") ## Add label for index SNP locus_plot(loc2, labels = "index") }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = 'UBE2L3', flank = 1e5, ens_db = "EnsDb.Hsapiens.v75") locus_plot(loc) ## Use embedded LD information in column `r2` loc2 <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") ## Add label for index SNP locus_plot(loc2, labels = "index") }
Genomic locus plot similar to locuszoom, using plotly.
locus_plotly( loc, heights = c(0.6, 0.4), filter_gene_name = NULL, filter_gene_biotype = NULL, cex.text = 0.7, italics = FALSE, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = 8, width = 600, xlab = NULL, blanks = "show", ... )
locus_plotly( loc, heights = c(0.6, 0.4), filter_gene_name = NULL, filter_gene_biotype = NULL, cex.text = 0.7, italics = FALSE, gene_col = ifelse(showExons, "blue4", "skyblue"), exon_col = "blue4", exon_border = "blue4", showExons = TRUE, maxrows = 8, width = 600, xlab = NULL, blanks = "show", ... )
loc |
Object of class 'locus' to use for plot. See |
heights |
Vector controlling relative height of each panel on 0-1 scale.
Alternatively a vector of length 2 of height in pixels passed to
|
filter_gene_name |
Vector of gene names to display. |
filter_gene_biotype |
Vector of gene biotypes to be filtered. Use
|
cex.text |
Font size for gene text. |
italics |
Logical whether gene text is in italics. |
gene_col |
Colour for gene lines. |
exon_col |
Fill colour for exons. |
exon_border |
Border line colour outlining exons (or genes if
|
showExons |
Logical whether to show exons or simply show whole gene as a
rectangle. If |
maxrows |
Specifies maximum number of rows to display in gene annotation panel. |
width |
Width of plotly plot in pixels which is purely used to prevent overlapping text for gene names. |
xlab |
Title for x axis. Defaults to chromosome |
blanks |
Controls handling of genes with blank names: |
... |
Optional arguments passed to |
This is an R/plotly version of locuszoom for exploring regional Manhattan
plots of gene loci. Use locus()
first to generate an object of class
'locus' for plotting. This references a selected Ensembl database for
annotating genes and exons. Hover over the points or gene tracks to reveal
more information.
A 'plotly' plotting object showing a scatter plot above gene tracks.
locus()
genetrack_ly()
scatter_plotly()
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = "IRF5", flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") locus_plotly(loc) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) loc <- locus(SLE_gwas_sub, gene = "IRF5", flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") locus_plotly(loc) }
Produces pages with multiple locus plots on.
multi_layout( plots, nrow = 1, ncol = 1, heights = c(3, 2), legend_pos = "topleft", ... )
multi_layout( plots, nrow = 1, ncol = 1, heights = c(3, 2), legend_pos = "topleft", ... )
plots |
Either an 'expression' to be evaluated which is a series of
calls to |
nrow |
Number of rows of plots |
ncol |
Number of columns of plots |
heights |
Vector of length 2 specifying height for plot and gene tracks |
legend_pos |
A keyword either "topleft" or "topright" or |
... |
Optional arguments passed to |
No return value.
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) genes <- c("STAT4", "UBE2L3", "IRF5") loclist <- lapply(genes, locus, data = SLE_gwas_sub, ens_db = "EnsDb.Hsapiens.v75", LD = "r2") ## produce 3 locus plots, one on each page multi_layout(loclist) ## place 3 locus plots in a row on a single page multi_layout(loclist, ncol = 3) ## full control loc <- locus(SLE_gwas_sub, gene = 'STAT4', flank = 1e5, LD = "r2", ens_db = "EnsDb.Hsapiens.v75") loc2 <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") loc3 <- locus(SLE_gwas_sub, gene = 'UBE2L3', LD = "r2", ens_db = "EnsDb.Hsapiens.v75") multi_layout(ncol = 3, plots = { locus_plot(loc, use_layout = FALSE, legend_pos = 'topleft') locus_plot(loc2, use_layout = FALSE, legend_pos = NULL) locus_plot(loc3, use_layout = FALSE, legend_pos = NULL) }) }
if(require(EnsDb.Hsapiens.v75)) { data(SLE_gwas_sub) genes <- c("STAT4", "UBE2L3", "IRF5") loclist <- lapply(genes, locus, data = SLE_gwas_sub, ens_db = "EnsDb.Hsapiens.v75", LD = "r2") ## produce 3 locus plots, one on each page multi_layout(loclist) ## place 3 locus plots in a row on a single page multi_layout(loclist, ncol = 3) ## full control loc <- locus(SLE_gwas_sub, gene = 'STAT4', flank = 1e5, LD = "r2", ens_db = "EnsDb.Hsapiens.v75") loc2 <- locus(SLE_gwas_sub, gene = 'IRF5', flank = c(7e4, 2e5), LD = "r2", ens_db = "EnsDb.Hsapiens.v75") loc3 <- locus(SLE_gwas_sub, gene = 'UBE2L3', LD = "r2", ens_db = "EnsDb.Hsapiens.v75") multi_layout(ncol = 3, plots = { locus_plot(loc, use_layout = FALSE, legend_pos = 'topleft') locus_plot(loc2, use_layout = FALSE, legend_pos = NULL) locus_plot(loc3, use_layout = FALSE, legend_pos = NULL) }) }
Experimental plotting function for overlaying eQTL data from GTEx on top of GWAS results. y axis shows the -log10 p-value for the GWAS result. Significant eQTL for the specified gene are overlaid using colours and symbols.
overlay_plot( loc, base_col = "black", alpha = 0.5, scheme = "RdYlBu", tissue = "Whole Blood", eqtl_gene = loc$gene, legend_pos = "topright", ... )
overlay_plot( loc, base_col = "black", alpha = 0.5, scheme = "RdYlBu", tissue = "Whole Blood", eqtl_gene = loc$gene, legend_pos = "topright", ... )
loc |
Object of class 'locus' to use for plot. See |
base_col |
Colour of points for SNPs which do not have eQTLs. |
alpha |
Alpha opacity for non-eQTL points |
scheme |
Character string specifying palette for effect size showing up/downregulation eQTL using grDevices::hcl.colors. Alternatively a vector of 6 colours. |
tissue |
GTex tissue in which eQTL has been measured |
eqtl_gene |
Gene showing eQTL effect |
legend_pos |
Character value specifying legend position. See |
... |
Other arguments passed to |
No return value. Produces a plot using base graphics.
Simple but fast function for finding peaks in genome-wide association study (GWAS) data based on setting a minimum distance between peaks.
quick_peak( data, npeaks = NA, p_cutoff = 5e-08, span = 1e+06, min_points = 2, chrom = NULL, pos = NULL, p = NULL )
quick_peak( data, npeaks = NA, p_cutoff = 5e-08, span = 1e+06, min_points = 2, chrom = NULL, pos = NULL, p = NULL )
data |
GWAS dataset (data.frame or data.table) |
npeaks |
Number of peaks to find. If set to |
p_cutoff |
Specifies cut-off for p-value significance above which p-values are ignored. |
span |
Minimum genomic distance between peaks (default 1 Mb) |
min_points |
Minimum number of p-value significant points which must lie
within the span of a peak. This removes peaks with single or only a few low
p-value SNPs. To disable set |
chrom |
Determines which column in |
pos |
Determines which column in |
p |
Determines which column in |
This function is designed for speed. SNP p-values are filtered to only those
which are significant as specified by p_cutoff
. Each peak is identified as
the SNP with the lowest p-value and then SNPs in proximity to each peak
within the distance specified by span
are removed. Regions such as the HLA
whose peaks may well be broader than span
may produce multiple entries.
Vector of row indices
Produces a base graphics scatter plot from a 'locus' class object. This
function is called by locus_plot()
to generate the scatter plot portion.
Can be used manually with set_layers()
.
scatter_plot( loc, index_snp = loc$index_snp, pcutoff = 5e-08, scheme = c("grey", "dodgerblue", "red"), cex = 1, cex.axis = 0.9, cex.lab = 1, xlab = NULL, ylab = NULL, ylim = NULL, ylim2 = c(0, 100), yzero = (loc$yvar == "logP"), xticks = TRUE, border = FALSE, showLD = TRUE, LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"), recomb_col = "blue", recomb_offset = 0, legend_pos = "topleft", labels = NULL, label_x = 4, label_y = 4, eqtl_gene = NULL, beta = NULL, add = FALSE, align = TRUE, ... )
scatter_plot( loc, index_snp = loc$index_snp, pcutoff = 5e-08, scheme = c("grey", "dodgerblue", "red"), cex = 1, cex.axis = 0.9, cex.lab = 1, xlab = NULL, ylab = NULL, ylim = NULL, ylim2 = c(0, 100), yzero = (loc$yvar == "logP"), xticks = TRUE, border = FALSE, showLD = TRUE, LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"), recomb_col = "blue", recomb_offset = 0, legend_pos = "topleft", labels = NULL, label_x = 4, label_y = 4, eqtl_gene = NULL, beta = NULL, add = FALSE, align = TRUE, ... )
loc |
Object of class 'locus' to use for plot. See locus. |
index_snp |
Specifies index SNP or a vector of SNPs to be shown in a
different colour and symbol. Defaults to the SNP with the lowest p-value.
Set to |
pcutoff |
Cut-off for p value significance. Defaults to p = 5e-08. Set
to |
scheme |
Vector of 3 colours if LD is not shown: 1st = normal points, 2nd = colour for significant points, 3rd = index SNP(s). |
cex |
Specifies size for points. |
cex.axis |
Specifies font size for axis numbering. |
cex.lab |
Specifies font size for axis titles. |
xlab |
x axis title. |
ylab |
y axis title. |
ylim |
y axis limits (y1, y2). |
ylim2 |
Secondary y axis limits for recombination line, if present. |
yzero |
Logical whether to force y axis limit to include y=0. |
xticks |
Logical whether x axis numbers and axis title are plotted. |
border |
Logical whether a bounding box is plotted around upper and lower plots. |
showLD |
Logical whether to show LD with colours |
LD_scheme |
Vector of colours for plotting LD. The first colour is for SNPs which lack LD information. The next 5 colours are for r2 or D' LD results ranging from 0 to 1 in intervals of 0.2. The final colour is for the index SNP. |
recomb_col |
Colour for recombination rate line if recombination rate
data is present. Set to |
recomb_offset |
Offset from 0-1 which shifts the scatter plot up and recombination line plot down. Recommended value 0.1. |
legend_pos |
Position of legend. See |
labels |
Character vector of SNP or genomic feature IDs to label. The
value "index" selects the highest point or index SNP as defined when
|
label_x |
Value or vector for position of label as percentage of x axis scale. |
label_y |
Value or vector for position of label as percentage of y axis scale. |
eqtl_gene |
Column name in |
beta |
Optional column name for beta coefficient to display upward triangles for positive beta and downward triangles for negative beta (significant SNPs only). |
add |
Logical whether to add points to an existing plot or generate a new plot. |
align |
Logical whether to set |
... |
Other arguments passed to |
Advanced users familiar with base graphics can customise every single point
on the scatter plot, by adding columns named bg
, col
, pch
or cex
directly to the dataframe stored in $data
element of the 'locus' object.
Setting these will overrule any default settings. These columns refer to
their respective base graphics arguments, see graphics::points()
.
No return value. Produces a scatter plot using base graphics.
Produces a scatter plot from a 'locus' class object using plotly.
scatter_plotly( loc, index_snp = loc$index_snp, pcutoff = 5e-08, scheme = c("grey", "dodgerblue", "red"), xlab = NULL, ylab = NULL, yzero = (loc$yvar == "logP"), showLD = TRUE, LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"), marker_outline = "black", marker_size = 7, recomb_col = "blue", eqtl_gene = NULL, beta = NULL, add_hover = NULL, showlegend = TRUE, height = NULL, webGL = TRUE )
scatter_plotly( loc, index_snp = loc$index_snp, pcutoff = 5e-08, scheme = c("grey", "dodgerblue", "red"), xlab = NULL, ylab = NULL, yzero = (loc$yvar == "logP"), showLD = TRUE, LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"), marker_outline = "black", marker_size = 7, recomb_col = "blue", eqtl_gene = NULL, beta = NULL, add_hover = NULL, showlegend = TRUE, height = NULL, webGL = TRUE )
loc |
Object of class 'locus' to use for plot. See locus. |
index_snp |
Specifies index SNP or a vector of SNPs to be shown in a
different colour and symbol. Defaults to the SNP with the lowest p-value.
Set to |
pcutoff |
Cut-off for p value significance. Defaults to p = 5e-08. Set
to |
scheme |
Vector of 3 colours if LD is not shown: 1st = normal points, 2nd = colour for significant points, 3rd = index SNP(s). |
xlab |
x axis title. |
ylab |
y axis title. |
yzero |
Logical whether to force y axis limit to include y=0. |
showLD |
Logical whether to show LD with colours |
LD_scheme |
Vector of colours for plotting LD. The first colour is for SNPs which lack LD information. The next 5 colours are for r^2 or D' LD results ranging from 0 to 1 in intervals of 0.2. The final colour is for the index SNP. |
marker_outline |
Specifies colour for outlining points. |
marker_size |
Value for size of markers in plotly units. |
recomb_col |
Colour for recombination rate line if recombination rate
data is present. Set to |
eqtl_gene |
Column name in |
beta |
Optional column name for beta coefficient to display upward triangles for positive beta and downward triangles for negative beta (significant SNPs only). |
add_hover |
Optional vector of column names in |
showlegend |
Logical whether to show a legend for the scatter points. |
height |
Height in pixels (optional, defaults to automatic sizing). |
webGL |
Logical whether to use webGL or SVG for scatter plot. |
A plotly
scatter plot.
Uses layout()
to set up multiple locus plots aligned in a column.
set_layers(n = 1, heights = c(rep(3, n), 2), rev = FALSE)
set_layers(n = 1, heights = c(rep(3, n), 2), rev = FALSE)
n |
Number of plots (not including gene tracks on bottom) |
heights |
Vector of length |
rev |
Logical whether to reverse plotting order and plot from bottom to top |
Sets layout()
to enable multiple plots aligned in a column. The
gene track is assumed to be positioned on the bottom. Returns par()
invisibly so that layout can be reset to default at the end of plotting.
Dataset of SNPs at 3 gene loci (UBE2L3, STAT4, IRF5) from GWAS on SLE (Bentham et al, 2015, Nature Genetics 47(12):1457-64, PMID: 26502338).
data(SLE_gwas_sub)
data(SLE_gwas_sub)
Data frame with 1990 rows and 11 variables
https://www.ebi.ac.uk/gwas/studies/GCST003156