Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gl.filter.hamming

Filters loci based on pairwise Hamming distance between sequence tags


Description

Hamming distance is calculated as the number of base differences between two sequences which can be expressed as a count or a proportion. Typically, it is calculated between two sequences of equal length. In the context of DArT trimmed sequences, which differ in length but which are anchored to the left by the restriction enzyme recognition sequence, it is sensible to compare the two trimmed sequences starting from immediately after the common recognition sequence and terminating at the last base of the shorter sequence.

Usage

gl.filter.hamming(x, threshold = 0.2, rs = 5, pb = FALSE, verbose = NULL)

Arguments

x

– name of the genlight object containing the SNP data [required]

threshold

– a threshold Hamming distance for filtering loci [default threshold <= 0.2]

rs

– number of bases in the restriction enzyme recognition sequence [default = 4]

pb

– switch to output progress bar [default FALSE]

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]

Details

Hamming distance can be computed by exploiting the fact that the dot product of two binary vectors x and (1-y) counts the corresponding elements that are different between x and y. This approach can also be used for vectors that contain more than two possible values at each position (e.g. A, C, T or G).

If a pair of DNA sequences are of differing length, the longer is truncated.

The algorithm is that of Johann de Jong https://johanndejong.wordpress.com/2015/10/02/faster-hamming-distance-in-r-2/ as implimented in utils.hamming.r

Only one of two loci are retained if their Hamming distance is less that a specified percentage. 5 base differences out of 100 bases is a 20

Value

a genlight object filtered on Hamming distance.

Author(s)

Arthur Georges (Post to https://groups.google.com/d/forum/dartr)

Examples

# SNP data
  result <- gl.filter.hamming(testset.gl, threshold=0.25, verbose=3)

dartR

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

v1.9.6
GPL-2
Authors
Bernd Gruber [aut, cre], Arthur Georges [aut], Jose L. Mijangos [aut], Peter J. Unmack [ctb], Oliver Berry [ctb], Lindsay V. Clark [ctb], Floriaan Devloo-Delva [ctb]
Initial release
2021-04-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.