make_scatterplot: Make a scatter plot (called the LocusCompare plot). Each axis...

make_scatterplotR Documentation

Make a scatter plot (called the LocusCompare plot). Each axis of the LocusCompare plot represent the -log10(p-value) from an association study. Each point thus represent a SNP. By default, the lead SNP is a purple diamond, whereas the other SNPs are colored according to their LD with the lead SNP.

Description

Make a scatter plot (called the LocusCompare plot). Each axis of the LocusCompare plot represent the -log10(p-value) from an association study. Each point thus represent a SNP. By default, the lead SNP is a purple diamond, whereas the other SNPs are colored according to their LD with the lead SNP.

Usage

make_scatterplot(merged, title1, title2, color, shape, size,
  legend = TRUE, legend_position = c("bottomright", "topright",
  "topleft"))

Arguments

merged

(data.frame) An input data.frame which has the following columns: rsid, pval1 (p-value for study 1), logp1 (p-value for study 2), logp1 (log p-value for study 1), logp2 (log p-value for study 2), chr, pos. See the example for 'get_lead_snp()' on how to generate this data.frame.

title1

(string) The title for the x-axis.

title2

(string) The title for the y-axis.

color

(data.frame) The output from 'assign_color()'.

shape

(data.frame) Specification of the shape of each SNP. See example blow on how to generate this data.frame.

size

(data.frame) Specification of the size of each SNP. See example below on how to generate this data.frame.

legend

(boolean) Whether to include the legend.

legend_position

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

Examples

# The data.frame `merged` comes from the example of `add_label()`.
# The data.frame `color` comes from the example of `assign_color()`.
snp = 'rs9349379'
shape = ifelse(merged$rsid == snp, 23, 21)
names(shape) = merged$rsid
size = ifelse(merged$rsid == snp, 3, 2)
names(size) = merged$rsid
make_scatterplot(merged, title1 = 'GWAS', title2 = 'eQTL', color, shape, size)

boxiangliu/locuscomparer documentation built on Nov. 27, 2022, 7:26 a.m.