Description Usage Arguments Value Examples
A Function to calculate polygenic risk score (PRS). PRS is calculated by summing risk alleles, which are weighted by the effect size of the risk alleles (i.e. beta coefficient for continuous traits or log(OR) for binary traits).
1 |
genotype |
[data.frame/matrix] The genotype data is a data frame or matrix with rows corresponding to individuals and columns to SNPs. SNP genotypes are encoded as the number of minor allele (0, 1, 2). |
beta |
[vector] The effect size of each SNP. If |
PRS
return a vector of polygenic risk scores.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | input.dir <- system.file("extdata", package="pv")
output.dir <- system.file("extdata", package="pv")
path2plink <- '/path/to/plink'
## Not run:
lr.result <- plink.lr(input.dir = input.dir,
output.dir = output.dir,
genotype = "train",
phenotype = "train.phenotypes.txt",
covar.number = c(2, 3),
plink.path = path2plink,
verbose = TRUE)
beta <- lr.result[which(lr.result$TEST == "ADD"), ]$BETA
beta[is.na(beta)] <- 0
genotype.path <- file.path(input.dir, "train.raw")
genotype.path <- gsub('\\\\', '/', genotype.path)
genotype <- data.table::fread(genotype.path, data.table = FALSE)[, -c(1,2,3,4,5,6)]
prs <- PRS(genotype, beta)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.