eigenval_plot: Plot Windowed Eigenvalues Along a Chromosome

View source: R/eigenval_plot.R

eigenval_plotR Documentation

Plot Windowed Eigenvalues Along a Chromosome

Description

Takes as input a list of results from eigen_analyse_vectors() and plots all results along a chromosome. The chromosome positions are derived from the names() variable of the eigen_res input, which should be in the standard genome interval format of chrX:X-Y

Usage

eigenval_plot(
  eigen_res = NULL,
  cutoffs = NULL,
  null_vectors = NULL,
  plot.pvalues = FALSE,
  keep_chr_scale = TRUE
)

Arguments

eigen_res

A list of results from eigen_analyse_vectors(). This can be easily created by combining eigen_analyse_vectors with lapply. Each element of the input list should correspond to the eigen decomposition results for a given genome window.

cutoffs

Numeric vector of alpha thresholds for null distribution cutoffs. These must be equal in length to the number of eigenvalues, such that the first element is the threshold for eigenvalue 1, the second for eigevalue 2 e.t.c.

null_vectors

A list of NULL allele frequency change vector matrices as output by calc_AF_vectors() with null_perms set to a numeric value. This is only necessary if wanting to calculate and plot p.values.

plot.pvalues

Boolean flag as to whether or not to plot p.values instead of summed eigenvalues.

keep_chr_scale

Boolean flag as to whether or not to plot chromosome widths according to their actual size, or plot all chromosomes/scaffolds as equal width

Value

A list of ggplot figures, where each element corresponds to figure for each eigenvector.


JimWhiting91/afvaper documentation built on Aug. 30, 2022, 10:03 a.m.