Description Usage Arguments Details Value Author(s) Examples
View source: R/calculateSimilarity.R
Computes the Hamming distance for two samples using both alleles. See details section for more information about the Hamming distance.
1 | hamming_distance_digit1(allele)
|
allele |
a |
The Hamming distance is given by
min(s1A1 != s2A1 + s1A2 != s2A2, s1A1 != s2A2 + s1A2 != s2A1) where
s1
and s2
are two samples and A1
and A2
are
there alleles.
a tibble
object with one row containing the minimum
Hamming distance and a logical
column indicating whether
same allele was used. If the
distance is the same for both, then NA
is returned.
Santiago Medina, Nissim Ranade
1 2 3 4 5 6 7 8 9 | ## Create a demo dataset
demoData <- data.frame(SampleName=c("s1", "s1", "s2", "s2"),
AlleleName=c(1, 2, 1, 2), AlleleGroup=c(1, 3, 1, 5))
## Transform to tibble object
demoDataTibble <- dplyr::as_tibble(demoData)
## Calculate the Hamming distance on the demo dataset
HLAClustRView:::hamming_distance_digit1(demoDataTibble)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.