Learn R Programming

⚠️There's a newer version (2.9.9.5) of this package.Take me there.

dartR (version 2.0.4)

Importing and Analysing SNP and Silicodart Data Generated by Genome-Wide Restriction Fragment Analysis

Description

Functions are provided that facilitate the import and analysis of SNP (single nucleotide polymorphism) and silicodart (presence/absence) data. The main focus is on data generated by DarT (Diversity Arrays Technology). However, once SNP or related fragment presence/absence data from any source is imported into a genlight object many of the functions can be used. Functions are available for input and output of SNP and silicodart data, for reporting on and filtering on various criteria (e.g. CallRate, Heterozygosity, Reproducibility, maximum allele frequency). Advanced filtering is based on Linkage Disequilibrium and HWE (Hardy-Weinberg equilibrium). Other functions are available for visualization after PCoA (Principle Coordinate Analysis), or to facilitate transfer of data between genlight/genind objects and newhybrids, related, phylip, structure, faststructure packages.

Copy Link

Version

Install

install.packages('dartR')

Monthly Downloads

2,264

Version

2.0.4

License

GPL (>= 3)

Maintainer

Bernd Gruber

Last Published

June 5th, 2022

Functions in dartR (2.0.4)

gl.Ho

Estimates observed Heterozygosity
gl.assign.pa

Eliminates populations as possible source populations for an individual of unknown provenance, using private alleles
gi2gl

Converts a genind object into a genlight object
bandicoot.gl

A genlight object created via the read.dart functions
gl.alf

Calculates allele frequency of the first and second allele for each loci A very simple function to report allele frequencies
gl.He

Estimates expected Heterozygosity
gl.assign.pca

Assign an individual of unknown provenance to population based on PCA
gl.LDNe

Estimates effective population size using the Linkage Disequilibrium method based on NeEstimator (V2)
gl.assign.mahalanobis

Assign an individual of unknown provenance to population based on Mahalanobis Distance
gl.amova

Performs AMOVA using genlight data
gl.compliance.check

Checks a genlight object to see if it complies with dartR expectations and amends it to comply if necessary
gl.dist.ind

Calculates a distance matrix for individuals defined in a genlight object
gl.diagnostics.sim

Comparing simulations against theoretical expectations
gl.grm.network

Represents a genomic relationship matrix (GRM) as a network
gl.filter.parent.offspring

Filters putative parent offspring within a population
gl.edit.recode.ind

Creates or edits individual (=specimen) names, creates a recode_ind file and applies the changes to a genlight object
gl.basic.stats

Calculates basic statistics for each loci (Hs, Ho, Fis etc.)
gl.edit.recode.pop

Creates or edits a population re-assignment table
gl.filter.rdepth

Filters loci based on counts of sequence tags scored at a locus (read depth)
gl.blast

Aligns nucleotides sequences against those present in a target database using blastn
gl.hwe.pop

Performs Hardy-Weinberg tests over loci and populations
gl.filter.allna

Filters loci that are all NA across individuals and/or populations with all NA across loci
gl.costdistances

Calculates cost distances for a given landscape (resistance matrix)
gl.define.pop

Defines a new population in a genlight object for specified individuals
gl.check.verbosity

Checks the current global verbosity
gl.collapse

Collapses a distance matrix by amalgamating populations with pairwise fixed difference count less that a threshold
gl.drop.loc

Removes specified loci from a genlight {adegenet} object
gl.drop.pop

Removes specified populations from a genlight object
gl.install.vanilla.dartR

Installs all required packages for using all functions available in dartR
gl.join

Combines two genlight objects
gl.filter.maf

Filters loci on the basis of minor allele frequency (MAF) in a genlight adegenet object
gl.pcoa

Ordination applied to genotypes in a genlight object (PCA), in an fd object, or to a distance matrix (PCoA)
gl.filter.hwe

Filters loci that show significant departure from Hardy-Weinberg Equilibrium
gl.filter.locmetrics

Filters loci on the basis of numeric information stored in other$loc.metrics in a genlight {adegenet} object
gl.dist.pop

Calculates a distance matrix for populations with SNP genotypes in a genlight object
gl.drop.ind

Removes specified individuals from a genlight {adegenet} object
gl.diagnostics.hwe

Provides descriptive stats and plots to diagnose potential problems with Hardy-Weinberg proportions
gl.filter.monomorphs

Filters monomorphic loci, including those with all NAs
gl.plot.heatmap

Represents a distance matrix as a heatmap
gl.pcoa.plot

Bivariate or trivariate plot of the results of an ordination generated using gl.pcoa()
gl.fixed.diff

Generates a matrix of fixed differences and associated statistics for populations taken pairwise
gl.filter.sexlinked

Filters loci that are sex linked
gl.fst.pop

Calculates a pairwise Fst values for populations in a genlight object
gl.filter.hamming

Filters loci based on pairwise Hamming distance between sequence tags
gl.filter.taglength

Filters loci in a genlight {adegenet} object based on sequence tag length
gl.keep.loc

Removes all but the specified loci from a genlight {adegenet} object
gl.filter.heterozygosity

Filters individuals with average heterozygosity greater than a specified upper threshold or less than a specified lower threshold
gl.filter.secondaries

Filters loci that represent secondary SNPs in a genlight object
gl.filter.reproducibility

Filters loci in a genlight {adegenet} object based on average repeatability of alleles at a locus
gl.keep.ind

Removes all but the specified individuals from a genlight {adegenet} object
gl.filter.callrate

Filters loci or specimens in a genlight {adegenet} object based on call rate
gl.ibd

Performs isolation by distance analysis
gl.evanno

Creates an Evanno plot from a STRUCTURE run object
gl.percent.freq

Generates percentage allele frequencies by locus and population
gl.keep.pop

Removes all but the specified populations from a genlight object
gl.play.history

Replays the history and applies it to a genlight object
gl.rename.pop

Renames a population in a genlight object
gl.smearplot

Smear plot of SNP or presence/absence (SilicoDArT) data
gl.recode.pop

Recodes population assignments in a genlight object
gl.sim.offspring

Simulates a specified number of offspring based on alleles provided by potential father(s) and mother(s)
gl2genalex

Converts a genlight object into a format suitable for input to genalex
gl.read.vcf

Converts a vcf file into a genlight object
gl.plot.network

Represents a distance or dissimilarity matrix as a network
gl.reassign.pop

Assigns an individual metric as pop in a genlight {adegenet} object
gl.fdsim

Estimates the rate of false positives in a fixed difference analysis
gl2genepop

Converts a genlight object into genepop format (and file)
gl.report.monomorphs

Reports monomorphic loci
gl.make.recode.ind

Creates a proforma recode_ind file for reassigning individual (=specimen) names
gl.load

Loads an object from compressed binary format produced by gl.save()
gl.merge.pop

Merges two or more populations in a genlight object into one population
gl.map.structure

Maps a STRUCTURE plot using a genlight object
gl.print.reports

Prints dartR reports saved in tempdir
gl.report.callrate

Reports summary of Call Rate for loci or individuals
gl.propShared

Calculates a similarity (distance) matrix for individuals on the proportion of shared alleles
gl.report.bases

Reports summary of base pair frequencies
gl.list.reports

Prints dartR reports saved in tempdir
gl.filter.overshoot

Filters loci for which the SNP has been trimmed from the sequence tag along with the adaptor
gl.filter.pa

Filters loci that contain private (and fixed alleles) between two populations
gl2vcf

Converts a genlight object into vcf format
gl2treemix

Converts a genlight object to a treemix input file
testset_SNPs_2Row

Testfile in DArT format (as provided by DArT)
gl.report.pa

Reports private alleles (and fixed alleles) per pair of populations
gl.select.shapes

Selects shapes from the base R shape palette and outputs as a vector
gl.subsample.loci

Subsamples n loci from a genlight object and return it as a genlight object
gl.impute

Imputates missing data
gl.set.verbosity

Sets the default verbosity level
gl.report.parent.offspring

Identifies putative parent offspring within a population
gl.test.heterozygosity

Tests the difference in heterozygosity between populations taken pairwise
gl.read.dart

Imports DArT data into dartR and converts it into a genlight object
gl.nhybrids

Creates an input file for the program NewHybrids and runs it if NewHybrids is installed
gl2hiphop

Converts a genlight objects into hiphop format
gl.read.silicodart

Imports presence/absence data from SilicoDArT to genlight {agegenet} format (ploidy=1)
gl.plot.structure

Plots STRUCTURE analysis results (Q-matrix)
gl.outflank

Identifies loci under selection per population using the outflank method of Whitlock and Lotterhos (2015)
gl.report.ld

Calculates pairwise population based Linkage Disequilibrium across all loci using the specified number of cores
gl.report.ld.map

Calculates pairwise linkage disequilibrium in SNPs mapped to a reference genome
gl.report.rdepth

Reports summary of Read Depth for each locus
gl.sim.WF.run

Runs Wright-Fisher simulations
gl.report.reproducibility

Reports summary of RepAvg (repeatability averaged over both alleles for each locus) or reproducibility (repeatability of the scores for fragment presence/absence)
gl.genleastcost

Performs least-cost path analysis based on a friction matrix
gl.grm

Calculates an identity by descent matrix
testset_metadata

Metadata file. Can be integrated via the dart2genlight function.
gl.make.recode.pop

Creates a proforma recode_pop_table file for reassigning population names
utils.jackknife

Conducts jackknife resampling using a genlight object
gl.report.overshoot

Reports loci for which the SNP has been trimmed from the sequence tag along with the adaptor
gl.print.history

Prints history of a genlight object
utils.n.var.invariant

A utility script to calculate the number of variant and invariant sites by locus
gl2phylip

Creates a Phylip input distance matrix from a genlight (SNP) {adegenet} object
gl.report.diversity

Calculates diversity indexes for SNPs
gl.report.hamming

Calculates the pairwise Hamming distance between DArT trimmed DNA sequences
gl.report.heterozygosity

Reports observed, expected and unbiased heterozygosities and FIS (inbreeding coefficient) by population or by individual from SNP data
gl.save

Saves an object in compressed binary format for later rapid retrieval
utils.recalc.freqhomsnp

A utility script to recalculate the frequency of the homozygous alternate SNP by locus after some populations have been deleted
gl.sim.WF.table

Creates the reference table for running gl.sim.WF.run
gl.select.colors

Selects colors from one of several palettes and output as a vector
gl.random.snp

Randomly changes the allocation of 0's and 2's in a genlight object
gl.recalc.metrics

Recalculates locus metrics when individuals or populations are deleted from a genlight {adegenet} object
gl.map.interactive

Creates an interactive map (based on latlon) from a genlight object
utils.recalc.maf

A utility script to recalculate the minor allele frequency by locus, typically after some populations have been deleted
gl.read.csv

Reads SNP data from a csv file into a genlight object
gl.write.csv

Writes out data from a genlight object to csv file
gl.tree.nj

Outputs an nj tree to summarize genetic similarity among populations
gl2geno

Converts a genlight object to geno format from package LEA
gl2gi

Converts a genlight object to genind object
gl.sim.ind

Simulates individuals based on the allele frequencies provided via a genlight object.
gl.recode.ind

Recodes individual (=specimen = sample) labels in a genlight object
gl2svdquartets

Converts a genlight object to nexus format PAUP SVDquartets
utils.het.pop

Calculates expected mean expected heterozygosity per population
gl2structure

Converts a genlight object to STRUCTURE formated files
utils.hamming

Calculates the Hamming distance between two DArT trimmed DNA sequences
gl.report.locmetric

Reports summary of the slot $other$loc.metrics
gl.report.maf

Reports minor allele frequency (MAF) for each locus in a SNP dataset
gl.report.secondaries

Reports loci containing secondary SNPs in sequence tags and calculates number of invariant sites
gl.report.sexlinked

Identifies loci that are sex linked
interactive_reference

Shiny app for the input of the reference table for the simulations
testset.gl

A genlight object created via the gl.read.dart function
interactive_sim_run

Shiny app for the input of the simulations variables
gl2faststructure

Converts a genlight object into faststructure format (to run faststructure elsewhere)
gl.sim.mutate

Simulates mutations within a genlight object
testset.gs

A genlight object created via the gl.read.silicodart function
utils.recalc.freqhets

A utility script to recalculate the frequency of the heterozygous SNPs by locus after some populations have been deleted
gl.report.hwe

Reports departure from Hardy-Weinberg proportions
utils.recalc.freqhomref

A utility script to recalculate the frequency of the homozygous reference SNP by locus after some populations have been deleted
zzz

Setting up the package
gl2bayescan

Converts a genlight object into a format suitable for input to Bayescan
utils.flag.start

A utility script to flag the start of a script
utils.structure.genind2gtypes

structure util functions
utils.dist.ind.snp

Calculates a distance matrix for individuals defined in a dartR genlight object using SNP data (DArTseq)
gl2gds

Converts a genlight object into gds format
gl2demerelate

Creates a dataframe suitable for input to package {Demerelate} from a genlight {adegenet} object
gl2plink

Converts a genlight object into PLINK format
utils.structure.run

Utility function to run strcture
gl2related

Converts a genlight object to format suitable to be run with Coancestry
testset_pop_recode

Recode file to be used with the function.
theme_dartR

dartR theme
gl.run.structure

Runs a STRUCTURE analysis using a genlight object
gl.report.taglength

Reports summary of sequence tag length across loci
gl.sim.create_dispersal

Creates a dispersal file as input for the function gl.sim.WF.run
gl2sa

Converts genlight objects to the format used in the SNPassoc package
gl2fasta

Concatenates DArT trimmed sequences and outputs a FASTA file
gl.sim.emigration

Simulates emigration between populations
gl2shp

Converts a genlight object to ESRI shapefiles or kml files
gl2eigenstrat

Converts a genlight object into eigenstrat format
is.fixed

Tests if two populations are fixed at a given locus
gl2snapp

Converts a genlight object to nexus format suitable for phylogenetic analysis by SNAPP (via BEAUti)
platy

Example data set as text file to be imported into a genlight object
utils.dart2genlight

Converts DarT to genlight
utils.dist.binary

Calculates a distance matrix for individuals defined in a dartR genlight object using binary P/A data (SilicoDArT)
utils.outflank.MakeDiploidFSTMat

Creates OutFLANK input file from individual genotype info.
gl2sfs

Converts a genlight object into a sfs input file
utils.outflank

OutFLANK: An Fst outlier approach by Mike Whitlock and Katie Lotterhos, University of British Columbia.
possums.gl

A simulated genlight object created to run a landscape genetic example
utils.basic.stats

Calculates mean observed heterozygosity, mean expected heterozygosity and Fis per locus, per population and Fst across all populations
utils.recalc.callrate

A utility script to recalculate the callrate by locus after some populations have been deleted
utils.recalc.avgpic

A utility script to recalculate the OneRatioRef, OneRatioSnp, PICRef, PICSnp, and AvgPIC by locus after some individuals or populations have been deleted.
platypus.gl

A genlight object created via the gl.read.dart function
utils.check.datatype

Utility function to check the class of an object passed to a function
utils.read.dart

Imports DarT data to R
utils.outflank.plotter

Plotting functions for Fst distributions after OutFLANK
utils.reset.flags

A utility script to reset to FALSE (or TRUE) the locus metric flags after some individuals or populations have been deleted.
utils.structure.evanno

Util function for evanno plots