Last chance! 50% off unlimited learning
Sale ends in
LDscan
computes a matrix of pairwise linkage disequilibrium (LD)
coefficients (
LDmap
plots a matrix of LD coefficients, optionally with the
positions of the loci.
LDscan(x, quiet = FALSE)
LDmap(d, POS = NULL, breaks = NULL, col = NULL, border = NA,
angle = 0, asp = 1, cex = 1, scale.legend = 0.8, ...)
an object of class "loci"
with phased genotypes.
a logical: should the progress of the operation be printed?
a correlation matrix (can be an object of class "dist"
).
an optional vector of locus positions (e.g., from a VCF file; see examples).
a vector of break intervals to count the values in
d
; by default, ten equally-sized intervals are used.
an optional vector of colours; a scale from lightyellow to red is used by default.
the border of the rectangles: the default is to have no
border (this is not the same than default in
rect
; see examples).
value (in degrees) to rotate the graphic.
the aspect ratio of the graphic; one by default so the elements are squares (not rectangles).
the scaling of the labels and text.
the scaling of the legend rectangles.
further arguments passed to plot.default
.
an object of class "dist"
for LDscan
.
The LD coefficient LD
) but the definition of
All levels of ploidy are accepted, but all loci should have the same ploidy level.
# NOT RUN {
## Download the VCF file from Dryad:
## http://dx.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)
bks <- seq(0, 1, 0.2)
## LD map from the first 100 loci:
x <- read.vcf(fl, to = 100) # read only 100 loci
res <- LDscan(x)
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)
# }
Run the code above in your browser using DataLab