hlaCheckSNPs: Check the SNP predictors in a HIBAG model

View source: R/DataUtilities.R

hlaCheckSNPsR Documentation

Check the SNP predictors in a HIBAG model

Description

Check the SNP predictors in a HIBAG model, by calculating the overlapping between the model and SNP genotypes.

Usage

hlaCheckSNPs(model, object,
    match.type=c("Position", "Pos+Allele", "RefSNP+Position", "RefSNP"), verbose=TRUE)

Arguments

model

an object of hlaAttrBagClass, or an object of hlaAttrBagObj

object

a genotype object of hlaSNPGenoClass, or a character vector like c("rs2523442", "rs9257863", ...)

match.type

"RefSNP+Position" (by default) – using both of RefSNP IDs and positions; "RefSNP" – using RefSNP IDs only; "Position" – using positions only

verbose

if TRUE, show information

Value

Return a data.frame for individual classifiers:

NumOfValidSNP

the number of non-missing SNPs in an individual classifier

NumOfSNP

the number of SNP predictors in an individual classifier

fraction

NumOfValidSNP / NumOfSNP

Author(s)

Xiuwen Zheng

See Also

hlaAttrBagging, predict.hlaAttrBagClass

Examples

# make a "hlaAlleleClass" object
hla.id <- "DQB1"
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")

# training genotypes
region <- 100   # kb
snpid <- hlaFlankingSNP(HapMap_CEU_Geno$snp.id, HapMap_CEU_Geno$snp.position,
    hla.id, region*1000, assembly="hg19")
train.geno <- hlaGenoSubset(HapMap_CEU_Geno,
    snp.sel = match(snpid, HapMap_CEU_Geno$snp.id))

# train a HIBAG model
set.seed(1000)
model <- hlaAttrBagging(hla, train.geno, nclassifier=2)
print(model)


hlaCheckSNPs(model, train.geno)

# close the HIBAG model explicitly
hlaClose(model)

zhengxwen/HIBAG documentation built on Nov. 19, 2024, 1:01 p.m.