Package 'TrumpetPlots'

Title: Visualization of Genetic Association Studies
Description: Visualizes the relationship between allele frequency and effect size in genetic association studies. The input is a data frame containing association results. The output is a plot with the effect size of risk variants in the Y axis, and the allele frequency spectrum in the X axis. Corte et al (2023) <doi:10.1101/2023.04.21.23288923>.
Authors: Judit García-González [aut, cre] , Lathan Liou [ctb]
Maintainer: Judit García-González <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1.1
Built: 2024-12-12 06:58:05 UTC
Source: CRAN

Help Index


Trumpets

Description

This function generates trumpet plots

Usage

plot_trumpets(
  dataset = toy_data,
  rsID = "rsID",
  freq = "freq",
  A1_beta = "A1_beta",
  Analysis = "Analysis",
  Gene = "Gene",
  calculate_power = TRUE,
  show_power_curves = TRUE,
  exist_datapwr = NULL,
  threshold = c(0.7, 0.9),
  N = 1e+05,
  alpha = 5e-08,
  Nfreq = 500,
  power_color_palette = c("purple", "deeppink"),
  analysis_color_palette = c("#018571", "#a6611a")
)

Arguments

dataset

Input text file with genetic association results. Columns required are rsID, freq, A1_beta, Analysis and Gene.

rsID

(required) Single Nucleotide Polymorphism (SNP) name.

freq

(required) allele frequency of effect SNP.

A1_beta

(required) risk allele effect size.

Analysis

(optional) adds colour to the type of analysis (e.g. GWAS, Sequencing).

Gene

(optional) Candidate gene name (can be empty).

calculate_power

(TRUE/FALSE) Calculate power curves. Choose TRUE to add power curves for a given threshold, alpha, sample size N and number of allele frequencies. Choose FALSE if you already ran powerCurves() outside or do not want to show power curves.

show_power_curves

(TRUE/FALSE) Show power curves in plot

exist_datapwr

Existing dataframe containing columns: freq, pos.b.for.f, neg.b.for.f, powerline.

threshold

Required if power == TRUE. Can be a single number or a vector of statistical power thresholds.

N

(Required if calculate_power == TRUE). Sample size used to test the association.

alpha

(Required if calculate_power == TRUE).

Nfreq

(Required if calculate_power == TRUE). Number of allele frequency data points generated to calculate the power curves. We recommend Nfreq>1000 for power curves with high resolution. Note that this will slow down the rendering of the plot.

power_color_palette

A vector of colours for the power curves. Number of colors should match number of thresholds supplied.

analysis_color_palette

A vector of colours for the analysis types.

Value

Creates a Trumpet plot with variant allele frequency (X axis, log10 scale) and effect size information (Y axis).

Examples

plot_trumpets(dataset = toy_data)

Power Curves for Trumpet Plots

Description

This function generates curves indicating statistical power in Trumpet plots

Usage

powerCurves(threshold = 0.8, N = 4e+05, alpha = 5e-08, Nfreq = 500)

Arguments

threshold

user-specified power level

N

sample size

alpha

significance threshold

Nfreq

Number of allele frequency data points generated to calculate the power curves

Value

A data frame with the power estimated for each allele frequency and effect size, given a: Statistical power threshold, significance threshold (alpha value), and sample size

Examples

powerCurves(threshold = 0.8, N=400000, alpha = 5e-8)

Toy dataset

Description

A data frame with 9999 genetic associations

Usage

data(toy_data)

Format

A data frame with 9999 genetic associations

Details

  • rsID. SNP name

  • freq. allele frequency of effect SNP

  • A1_beta. effect size

  • Analysis. adds colour to the type of analysis (e.g. GWAS, Sequencing)

  • Gene. Candidate gene name

  • N.

  • trait. ToyDataPheno