View source: R/gl.plot.snp.density.r
| gl.plot.snp.density | R Documentation |
Generates a tiled heat-map of single-nucleotide polymorphisms (SNPs) across chromosomes or scaffolds in a genlight object. SNPs are binned into fixed-width windows and coloured by SNP count, optionally annotating chromosomes with their SNP number and the position of their last SNP (Mb).
gl.plot.snp.density(
x,
bin.size = 1e+06,
min.snps = 50,
min.length = 1e+06,
color.palette = viridis::viridis,
chr.info = TRUE,
plot.title = NULL,
plot.theme = theme_dartR(),
plot.display = TRUE,
plot.file = NULL,
plot.dir = NULL,
verbose = NULL
)
x |
A genlight object with chromosome names in |
bin.size |
Width (bp) of the genomic bins used to count SNPs [default 1e6]. |
min.snps |
Minimum number of positioned SNPs a chromosome must have to be plotted [default 50]. |
min.length |
Minimum position (bp) of the last SNP for a chromosome to be plotted [default 1e6]. |
color.palette |
A function returning a vector of colours, passed to ggplot2; typically viridis::viridis [default viridis::viridis]. |
chr.info |
If TRUE, append (N SNPs, L Mb) to the chromosome labels [default TRUE]. |
plot.title |
Main title for the plot [default NULL]. |
plot.theme |
User specified theme [default theme_dartR()]. |
plot.display |
Specify if plot is to be displayed in the graphics window [default TRUE]. |
plot.file |
Filename (minus extension) for the RDS plot file [Required for plot save]. |
plot.dir |
Directory to save the plot RDS file [default as specified by the global working directory or tempdir()]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, brief progress messages; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity]. |
Chromosome names are taken from x@chromosome and SNP positions
from x@position. Packaged datasets ship with these slots empty;
fill them from the locus metrics first, as in the example. Loci with a
missing chromosome or a missing or zero position are ignored.
A chromosome is plotted when it carries at least min.snps
positioned SNPs and its last SNP lies at or beyond min.length
bp; the "length" used here and in the labels is the position of the
last SNP, not the assembly length. Chromosomes are ordered
alphabetically, numeric-aware (chr2 before chr10), with
the first name at the top of the plot. Every bin from the start of the
chromosome to its last SNP is drawn; bins containing no SNPs are
rendered in the lowest colour of the palette. The function does not
modify the input genlight object.
A ggplot object (invisibly) displaying the SNP-density heat-map.
Author(s): Luis Mijangos. Custodian: Luis Mijangos – Post to https://groups.google.com/d/forum/dartr
Other graphics:
gl.colors(),
gl.map.interactive(),
gl.plot.heatmap(),
gl.select.colors(),
gl.select.shapes(),
gl.smearplot(),
gl.tree.nj()
t1 <- platypus.gl
t1$chromosome <- t1$other$loc.metrics$Chrom_Platypus_Chrom_NCBIv1
t1$position <- t1$other$loc.metrics$ChromPos_Platypus_Chrom_NCBIv1
gl.plot.snp.density(t1,
bin.size = 5e6,
min.snps = 10,
min.length = 2e6,
plot.title = "Platypus SNP density")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.