Use user-provided list of genetic variants with weights for a trait to create a polygenic score. Uses the imputed BGEN files (field 22828) or WGS DRAGEN BGEN files (field 24309) data and load as data.frame
If selecting the DRAGEN data as the source, this assumes your project has access to the WGS BGEN files released April 2025. If not, run `ukbrapR:::make_dragen_bed_from_pvcfs()` to use [tabix] and [plink] to subset the [DRAGEN WGS pVCF files].
Usage
create_pgs(
in_file,
out_file = "tmp",
pgs_name = "pgs",
source = "imputed",
is_bed = FALSE,
overwrite = FALSE,
progress = FALSE,
verbose = FALSE,
very_verbose = FALSE
)
Arguments
- in_file
A data frame or file path. Must contain rsid, chr, pos, effect_allele, other_allele, beta. For imputed genos pos is build 37. For DRAGEN pos is build 38. Other columns are ignored.
- out_file
A string. Prefix for output files (optional)
default="tmp"
- pgs_name
A string. Variable name for created PGS (optional)
default="pgs"
- source
A string. Either "imputed" or "dragen" - indicating whether the variants should be from "UKB imputation from genotype" (field 22828) or "DRAGEN population level WGS variants, PLINK format [500k release]" (field 24308). Can instead be a path to a local BED file, if `is_bed=TRUE`.
default="imputed"
- is_bed
Logical. If you already have a BED file containing the required variants set this to TRUE and provide a path to the BED file in the `source` option,
default=FALSE
- overwrite
Logical. Overwrite output BED files? (If out_file is left as 'tmp' overwrite is set to TRUE),
default=FALSE
- progress
Logical. Show progress through each individual file,
default=FALSE
- verbose
Logical. Be verbose (show individual steps),
default=FALSE
- very_verbose
Logical. Be very verbose (show individual steps & show terminal output from Plink etc),
default=FALSE
Examples
liver_pgs <- create_pgs(in_file=system.file("files", "pgs_liver_cirrhosis.txt", package="ukbrapR"), out_file="liver_cirrhosis.imputed.pgs", pgs_name="liver_cirrhosis_pgs")