View source: R/gl.report.ld.map.r
| gl.report.ld.map | R Documentation |
This function calculates pairwise linkage disequilibrium (LD) by population
using the function ld from package snpStats.
If SNPs are mapped to a reference genome, the information for the SNP's
position should be stored in the genlight accessor "@position" and the
SNP's chromosome name in the accessor "@chromosome" (see examples). The
function will then calculate LD within each chromosome and for all possible
SNP pair combinations within a distance of ld.max.pairwise.
If SNPs are not mapped to a reference genome (the "@chromosome" accessor
is empty), the function will assign the same chromosome ("1") to all the
SNPs in the dataset, assign a sequence from 1 to n loci as the position of
each SNP, and calculate LD for all possible SNP pair combinations. Setting
ld.max.pairwise = NULL forces this all-pairs behaviour even when
chromosome information is present.
gl.report.ld.map(
x,
ld.max.pairwise = 1e+06,
maf = 0.05,
ld.stat = "R.squared",
ind.limit = 10,
stat.keep = "AvgPIC",
ld.threshold.pops = 0.2,
plot.display = TRUE,
plot.theme = theme_dartR(),
plot.file = NULL,
plot.dir = NULL,
histogram.colors = NULL,
boxplot.colors = NULL,
bins = 50,
verbose = NULL
)
x |
Name of the genlight object containing the SNP data [required]. |
ld.max.pairwise |
Maximum distance in number of base pairs at which LD should be calculated [default 1000000]. |
maf |
Minor allele frequency (by population) threshold to filter out loci. If a value > 1 is provided it will be interpreted as MAC (i.e. the minimum number of times an allele needs to be observed) [default 0.05]. |
ld.stat |
The LD measure to be calculated: "LLR", "OR", "Q", "Covar", "D.prime", "R.squared", and "R". See function ld from snpstats (package snpStats) for details [default "R.squared"]. |
ind.limit |
Number of individuals a population must exceed to be
included in the analysis; populations with |
stat.keep |
Name of the column from the slot |
ld.threshold.pops |
LD threshold to report in the plot of "Number of populations in which the same SNP pair are in LD" [default 0.2]. |
plot.display |
If TRUE, the resultant plots are displayed in the plot window [default TRUE]. |
plot.theme |
Theme for the plot. See Details for options [default theme_dartR()]. |
plot.file |
Name for the RDS binary file to save (base name only, exclude extension) [default NULL] |
plot.dir |
Directory to save the plot RDS files [default as specified by the global working directory or tempdir()] |
histogram.colors |
Vector with two color names for the borders and fill [default NULL]. |
boxplot.colors |
A color palette for box plots by population or a list with as many colors as there are populations in the dataset [default NULL]. |
bins |
Number of bins to display in histograms [default 50]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity]. |
This function reports LD between SNP pairs by population.
The function gl.filter.ld filters out the SNPs in LD using as
input the results of gl.report.ld.map. The actual number of
SNPs to be filtered out depends on the parameters set in the function
gl.filter.ld.
Only SNP pairs with a positive value of the chosen statistic are reported;
pairs with a zero or negative value (possible for the signed statistics
"R", "Covar" and "Q") are omitted from the report and the plots. Within
each chromosome, loci sharing the same map position are represented by the
first of them; the others are excluded from the analysis (a message
reports the exclusions).
Boxplots of LD by population and
a histogram showing LD frequency are presented.
A dataframe with information for each SNP pair in LD.
Author(s): Luis Mijangos. Custodian: Luis Mijangos – Post to https://groups.google.com/d/forum/dartr
gl.filter.ld
Other matched report:
gl.report.allna(),
gl.report.callrate(),
gl.report.contamination(),
gl.report.excess.het(),
gl.report.factorloadings(),
gl.report.fstat(),
gl.report.hamming(),
gl.report.heterozygosity(),
gl.report.hwe(),
gl.report.ld(),
gl.report.locmetric(),
gl.report.maf(),
gl.report.overshoot(),
gl.report.pa(),
gl.report.rdepth(),
gl.report.replicates(),
gl.report.replicates.KING(),
gl.report.reproducibility(),
gl.report.secondaries(),
gl.report.taglength()
require("dartR.data")
if (isTRUE(getOption("dartR_fbm"))) platypus.gl <- gl.gen2fbm(platypus.gl)
x <- platypus.gl
x <- gl.filter.callrate(x,threshold = 1)
x <- gl.filter.monomorphs(x)
x$position <- x$other$loc.metrics$ChromPos_Platypus_Chrom_NCBIv1
x$chromosome <- as.factor(x$other$loc.metrics$Chrom_Platypus_Chrom_NCBIv1)
ld_res <- gl.report.ld.map(x,ld.max.pairwise = 10000000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.