hlaDistance {HIBAG} | R Documentation

## Distance matrix of HLA alleles

### Description

To calculate the distance matrix of HLA alleles from a HIBAG model.

### Usage

    hlaDistance(model)

### Arguments

`model` | a model of `hlaAttrBagClass` or `hlaAttrBagObj`

### Value

Return a distance matrix with row and column names for HLA alleles.

### Author(s)

Xiuwen Zheng

### Examples

    # make a "hlaAlleleClass" object
    hla.id <- "A"
    hla <- hlaAllele(HLA_Type_Table$sample.id,
        H1 = HLA_Type_Table[, paste(hla.id, ".1", sep="")],
        H2 = HLA_Type_Table[, paste(hla.id, ".2", sep="")],
        locus=hla.id, assembly="hg19")

    # flanking genotypes
    train.geno <- hlaGenoSubsetFlank(HapMap_CEU_Geno, hla.id, 500000)
    summary(train.geno)

    # train a HIBAG model
    set.seed(100)
    model <- hlaAttrBagging(hla, train.geno, nclassifier=10)
    summary(model)

    # distance matrix
    d <- hlaDistance(model)

    # draw
    p <- hclust(as.dist(d))
    plot(p, xlab="HLA alleles")

[Package HIBAG version 1.22.0 Index]