Predict KIR genotypes for a set of samples using a trained PONG2
attribute bagging model. This is the core prediction function used
by the pong2 impute CLI command.
a PONG2 model object of class hlaAttrBagClass
as returned by kirParallelAttrBagging()
a SNP genotype object of class hlaSNPGenoClass
containing the target samples to impute
a cluster object for parallel computation, or FALSE
(default) for single-threaded prediction
character; type of prediction output. One of:
"response+dosage" (default; predicted alleles + dosage scores),
"response" (predicted alleles only),
"prob" (posterior probabilities only),
"response+prob" (predicted alleles + posterior probabilities)
character; voting method for ensemble classifiers.
One of "prob" (default; probability-weighted voting) or
"majority" (majority vote)
logical; if TRUE (default), check and
validate allele names against the model
character; SNP matching method. One of
"Position" (default), "Pos+Allele",
"RefSNP+Position", or "RefSNP"
logical; if TRUE, assume SNPs are on the
same strand (default: FALSE)
logical; if TRUE (default), print progress
messages
logical; if TRUE (default), print SNP
matching summary
An object of class hlaAlleleClass containing KIR imputation
results. The object includes:
data frame with columns sample.id,
allele1, allele2, and prob (posterior
probability of the best call)
numeric matrix of allele dosage scores
(samples x alleles); NULL if type = "response"
numeric matrix of posterior probabilities
(alleles x samples); NULL unless
type = "response+prob" or "prob"
Samples with posterior probability below the call threshold
(CT) are assigned NA for both alleles.
# Load example data
data(PONG2_example)
#> Warning: data set ‘PONG2_example’ not found
# Load model from object
model <- hlaModelFromObj(example_mobj)
# Predict KIR genotypes
pred <- kirPredict(
object = model,
snp = example_snp,
type = "response+dosage",
verbose = FALSE
)
#> Error in .C("PONG2_Predict_Resp_dosage", object$model, as.integer(snp), n.samp, as.integer(vote_method), as.logical(verbose), H1 = integer(n.samp), H2 = integer(n.samp), prob = double(n.samp), postprob = matrix(NaN, nrow = n.hla * (n.hla + 1)/2, ncol = n.samp), err = integer(1), NAOK = TRUE, PACKAGE = "PONG2"): "PONG2_Predict_Resp_dosage" not available for .C() for package "PONG2"
# View results
head(pred$value)
#> sample.id allele1 allele2 prob
#> 1 S1 KIR3DL1*002 KIR3DL1*015 0.4767310
#> 2 S2 KIR3DL1*007 KIR3DL1*007 0.4504548
#> 3 S3 KIR3DL1*002 KIR3DL1*015 0.6123777
#> 4 S4 KIR3DL1*002 KIR3DL1*015 0.6277634
#> 5 S5 KIR3DL1*002 KIR3DL1*005 0.6243871
#> 6 S6 KIR3DL1*002 KIR3DL1*002 0.7030016
# Clean up
hlaClose(model)