This function is rebuilt from locuscompare.R (https://github.com/boxiangliu/locuscomparer/blob/master/R/locuscompare.R).

xQTLvisual_locusZoom(
  DF,
  highlightSnp = "",
  population = "EUR",
  posRange = "",
  legend = TRUE,
  ylim = NULL,
  legend_position = c("topright", "bottomright", "topleft"),
  point_color = NULL,
  axis_text_size = 1.3,
  axis_title_size = 1.3,
  title_size = 1.4,
  xlab_text = "",
  ylab_text = "",
  title_text = "",
  snpLD = NULL
)

Arguments

DF

A data.frame or a data.table object. Four columns are required (arbitrary column names is supported):

Col 1. "snps" (character), , using an rsID (e.g. "rs11966562");

Col 2. "chromosome" (character), one of the chromosome from chr1-chr22;

Col 3. "postion" (integer), genome position of snp.

Col 4. "P-value" (numeric).

highlightSnp

Default is the snp that with lowest p-value.

population

One of the 5 popuations from 1000 Genomes: 'AFR', 'AMR', 'EAS', 'EUR', and 'SAS'.

posRange

Genome range that you want to visualize (e.g. "chr6:3e7-7e7"). Default is the region that covers all snps.

legend

(boolean, optional) Should the legend be shown? Default: TRUE.

ylim

set the minimum and maximum values for the y-axis. By default, the function will automatically determine the y-axis limits based on the data being plotted.

legend_position

(character, optional) Either 'bottomright','topright', or 'topleft'. Default: 'bottomright'.

point_color

(character, optional) Customized color vectors (5 kinds of colors).

axis_text_size

(numberic) text size of the axis labels

axis_title_size

(numberic) text size of the axis title

title_size

(numberic) text size of the title of the plot

xlab_text

(character) Lable for x-axis

ylab_text

(character) Lable for x-axis

title_text

(character) Title of the plot

snpLD

A data.frame of LD matirx. Default is null.

Value

A list containing data.table and ggplot object.

Examples

# \donttest{
library(data.table)
# For GWAS dataset:
gwasDF <- fread("https://gitee.com/stronghoney/exampleData/raw/master/gwasChr6Sub4.txt")
xQTLvisual_locusZoom(gwasDF)
# Zoom in:
xQTLvisual_locusZoom(gwasDF, posRange="chr6:4.7e7-4.8e7", population ="EUR")

# For eQTL of a gene of interest (time-consuming):
eqtlAsso <- xQTLdownload_eqtlAllAsso("RP11-385F7.1", tissueLabel = "Brain - Cortex",
                                     withB37VariantId=FALSE)
xQTLvisual_locusZoom(eqtlAsso[,c("snpId", "chrom", "pos", "pValue")], highlightSnp="rs4711878" )
# Zoom in:
xQTLvisual_locusZoom(eqtlAsso[,c("snpId", "chrom", "pos", "pValue")], highlightSnp="rs4711878",
                     posRange="chr6:47.3e6-47.9e6")
# }