Skip to contents

Wrapper function to create a HIDECAN plot from GWAS results, DE results or candidate genes.

Usage

hidecan_plot(
  gwas_list = NULL,
  de_list = NULL,
  can_list = NULL,
  score_thr_gwas = 4,
  score_thr_de = 2,
  log2fc_thr = 1,
  chrom_length = NULL,
  colour_genes_by_score = TRUE,
  remove_empty_chrom = FALSE,
  chroms = NULL,
  chrom_limits = NULL,
  title = NULL,
  subtitle = NULL,
  n_rows = NULL,
  n_cols = 2,
  legend_position = "bottom",
  point_size = 3,
  label_size = 3.5,
  label_padding = 0.15
)

Arguments

gwas_list

Data-frame or list of data-frames containing GWAS results, each with at least a chromosome, position and either padj or score columns. If a named list, the names will be used in the plot.

de_list

Data-frame or list of data-frames containing DE results, each with at least a chromosome, start, end, log2FoldChange and either padj or score columns. If a named list, the names will be used in the plot.

can_list

Data-frame or list of data-frames containing candidate genes, each with at least a chromosome, start, end and name columns. If a named list, the names will be used in the plot.

score_thr_gwas

Numeric, the score threshold for GWAS results that will be used to select which markers will be plotted. Default value is 4.

score_thr_de

Numeric, the score threshold for DE results that will be used to select which markers will be plotted. Default value is 2.

log2fc_thr

Numeric, the log2(fold-change) threshold that will be used to select which genes will be plotted. Default value is 1.

chrom_length

Optional, tibble with columns chromosome and length, giving for each chromosome its length in bp. If NULL (the default), will be inferred from the GWAS, DE and candidate gene data.

colour_genes_by_score

Logical, whether to colour the genes by score (TRUE) or by log2(fold-change) (FALSE). Default value is TRUE.

remove_empty_chrom

Logical, should chromosomes with no significant markers/genes nor candidate genes be removed from the plot? Default value if FALSE.

chroms

Character vector, name of chromosomes to include in the plot. If NULL (default value), all chromosomes will be included.

chrom_limits

Integer vector of length 2, or named list where the elements are integer vectors of length 2. If vector, gives the lower and upper limit of the chromosomes (in bp) to use in the plot. If a named list, names should correspond to chromosome names. Gives for each chromosome the lower and upper limits (in bp) to use in the plot. Doesn't have to be specified for all chromosomes. Default value is NULL, i.e. no limits are applied to the chromosomes (they will be plotted in their entirety).

title

Character, title of the plot. Default value is NULL (i.e. no title will be added to the plot).

subtitle

Character, subtitle of the plot. Default value is NULL (i.e. no subtitle will be added to the plot).

n_rows

Integer, number of rows of chromosomes to create in the plot. Default value is NULL.

n_cols

Integer, number of columns of chromosomes to create in the plot. Default value is 2. Will be set to NULL if n_rows is not NULL.

legend_position

Character, position of the legend in the plot. Can be bottom (default value), top, right, left or none.

point_size

Numeric, size of the points in the plot. Default value is 3.

label_size

Numeric, size of the gene labels in the plot. Default value is 3.5 (for geom_label_repel).

label_padding

Numeric, amount of padding around gene labels in the plot, as unit or number. Default value is 0.15 (for geom_label_repel).

Value

a ggplot.

Examples

if (interactive()) {
x <- get_example_data()

## Typical example with one GWAs result table, one DE result table and
## one table of candidate genes
hidecan_plot(gwas_list = x[["GWAS"]],
             de_list = x[["DE"]],
             can_list = x[["CAN"]],
             score_thr_gwas = -log10(0.0001),
             score_thr_de = -log10(0.005),
             log2fc_thr = 0,
             label_size = 2)

## Example with two sets of GWAS results
hidecan_plot(gwas_list = list(x[["GWAS"]], x[["GWAS"]]),
             score_thr_gwas = 4)

## Example with two sets of DE results, with names
hidecan_plot(de_list = list("X vs Y" = x[["DE"]],
                            "X vs Z" = x[["DE"]]),
             score_thr_de = -log10(0.05),
             log2fc_thr = 0)

## Set limits on all chromosomes (to "zoom in" to the 10-20Mb region)
hidecan_plot(gwas_list = x[["GWAS"]],
             de_list = x[["DE"]],
             can_list = x[["CAN"]],
             score_thr_gwas = -log10(0.0001),
             score_thr_de = -log10(0.005),
             log2fc_thr = 0,
             label_size = 2,
             chrom_limits = c(10e6, 20e6))

## Set limits on some chromosomes only
hidecan_plot(gwas_list = x[["GWAS"]],
             de_list = x[["DE"]],
             can_list = x[["CAN"]],
             score_thr_gwas = -log10(0.0001),
             score_thr_de = -log10(0.005),
             log2fc_thr = 0,
             label_size = 2,
             chrom_limits = list("ST4.03ch00" = c(10e6, 20e6),
                                  "ST4.03ch02" = c(15e6, 25e6)))
}