LDscan  R Documentation 
LDscan
computes a matrix of pairwise linkage disequilibrium (LD)
coefficients (r) from a set of loci (which must be biallelic;
if not, the results are not guaranteed to be meaningful). The
genotypes must be phased.
LDmap
plots a matrix of LD coefficients, optionally with the
positions of the loci.
LDscan(x, ...) ## S3 method for class 'DNAbin' LDscan(x, quiet = FALSE, what = c("r", "Dprime"), ...) ## S3 method for class 'loci' LDscan(x, depth = NULL, quiet = FALSE, what = c("r", "Dprime"), ...) LDmap(d, POS = NULL, breaks = NULL, col = NULL, border = NA, angle = 0, asp = 1, cex = 1, scale.legend = 0.8, ...)
x 
an object of class 
depth 
a vector of integers giving the the depth(s) (or lags) at which the r's are calculated. By default, all possible depths are considered. 
quiet 
a logical: should the progress of the operation be printed? 
what 
the quantity to be computed. Two choices are possible:

d 
a correlation matrix (can be an object of class 
POS 
an optional vector of locus positions (e.g., from a VCF file; see examples). 
breaks 
a vector of break intervals to count the values in

col 
an optional vector of colours; a scale from lightyellow to red is used by default. 
border 
the border of the rectangles: the default is to have no
border (this is not the same than default in

angle 
value (in degrees) to rotate the graphic. 
asp 
the aspect ratio of the graphic; one by default so the elements are squares (not rectangles). 
cex 
the scaling of the labels and text. 
scale.legend 
the scaling of the legend rectangles. 
... 
further arguments passed to methods ( 
The LD coefficient r is well defined when the two loci have
only two alleles. In other cases, LD is well defined (see
LD
) but the definition of r is not clear.
All levels of ploidy are accepted, but all loci should have the same ploidy level.
If depth
is used, the r's are calculated only for the
pairs of loci that are distant by these values in x
, but
necessarily on the chromosome. The returned list has names set with
the values of depth
.
The value returned is actually r (not r^2).
LDscan
returns an object of class "dist"
by default, or
a list if depth
is used.
Emmanuel Paradis
LD
, read.vcf
data(woodmouse) d < LDscan(woodmouse) LDmap(d, seg.sites(woodmouse), seq(0, 1, .1)) ## Not run: ## Download the VCF file from Dryad: ## https://doi.org/10.5061/dryad.446sv.2 ## the VCF file should have this name: fl < "global.pop.GATK.SNP.hard.filters.V3.phased_all.pop.maf.05.recode.vcf.gz" info.fly < VCFloci(fl) ## LD map from the first 100 loci: x < read.vcf(fl, to = 100) # read only 100 loci res < LDscan(x) bks < seq(0, 1, 0.2) LDmap(res, info.fly$POS[1:100], bks, scale.legend = 3) ## check the chromosomes: table(info.fly$CHROM) ## LD map from 100 loci randomly distributed on the chromosome: s < ceiling(seq(1, 224253, length.out = 100)) xs < read.vcf(fl, which.loci = s) res2 < LDscan(xs) LDmap(res2, info.fly$POS[s], bks, scale.legend = 3) ## something simpler with 10 loci: x10 < x[, 1:10] ## the VCF file has no locus IDs, so we give some here: names(x10) < paste0("Loc", 1:10) res10 < LDscan(x10, quiet = TRUE) LDmap(res10, angle = 45, border = NULL) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.