hamming_distance_digit1: Compute the Hamming distance between two samples

Description Usage Arguments Details Value Author(s) Examples

View source: R/calculateSimilarity.R

Description

Computes the Hamming distance for two samples using both alleles. See details section for more information about the Hamming distance.

Usage

1

Arguments

allele

a tibble object with 3 mandatory columns: "SampleName", "AlleleName" and "AlleleGroup".

Details

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.

Value

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.

Author(s)

Santiago Medina, Nissim Ranade

Examples

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)

NCBI-Hackathons/Integrating-HLA-typing-methods-and-RNA-seq documentation built on Nov. 23, 2019, 1:57 a.m.