extract_variants: Targeted extraction of variants from .vcf files using Tabix...

View source: R/extract_variants.R

extract_variantsR Documentation

Targeted extraction of variants from .vcf files using Tabix files

Description

Performs targeted extraction of variants from chromosome .vcf files using Tabix index (.tbi) files.

Usage

extract_variants(
  chr_files,
  gwas_info,
  autosomes = TRUE,
  range = 0,
  grch37 = TRUE,
  keep_all = FALSE
)

Arguments

chr_files

Filenames (in order) for the chromosome-wise .vcf files

gwas_info

An object generated by get_trait_variants() or get_pQTLs(). Alternatively, a character vector of rsids.

autosomes

If TRUE, only extracts variants from the autosomes.

range

Variants are extracted from the start position until start position + range (in bp).

grch37

If TRUE, the build is grch37; if FALSE, grch38 is used.

keep_all

If TRUE, keeps all variants in the search range, even those not in gwas_info.

Value

A list with two data.frames: 'gt', containing the genotype data in number of risk alleles (0/1/2), and 'fix', containing information on the variants: rsid, chromosome, position, reference and alternative allele, and imputation quality information (e.g. DR2).

Examples

TG_gwas_info <- get_trait_variants('thrombin generation',trait_list=NULL,ask_about_efo=FALSE)
# TG_variants <- extract_variants(chromosome_files, TG_gwas_info)

vincent10kd/polygenic documentation built on Feb. 25, 2024, 10:17 a.m.