Skip to contents

Auto-detects the source type (PLINK2, PLINK1, VCF, GDS or BGEN, given directly or through LD metadata whose rows point at genotype files) and returns variant metadata. For PLINK2, opens only the .pvar file. For PLINK1, reads only the .bim file. For VCF, GDS and BGEN, loads the full file and extracts variant info.

Usage

refVariantInfo(source, region = NULL)

Arguments

source

Genotype file path/prefix or LD metadata file path.

region

Region of interest: "chr:start-end" string or data.frame with chrom/start/end. If NULL, returns all variants.

Value

A data.frame with columns: chrom, id, pos, A2, A1. May also include allele_freq, variance, n_nomiss depending on source.

Examples

meta <- system.file("extdata", "ld_reference", "ld_meta_file.tsv",
  package = "pecotmr")
refVariantInfo(meta, region = "chr22:10000000-19000000")
#> # A tibble: 175 × 6
#>    chrom id                      pos A2    A1    allele_freq
#>    <chr> <chr>                 <int> <chr> <chr>       <dbl>
#>  1 22    chr22:10685239:C:T 10685239 C     T          0.0583
#>  2 22    chr22:10761227:G:A 10761227 G     A          0.15  
#>  3 22    chr22:11285239:C:T 11285239 C     T          0.0833
#>  4 22    chr22:11601805:G:A 11601805 G     A          0.0583
#>  5 22    chr22:11791698:G:T 11791698 G     T          0.05  
#>  6 22    chr22:11797697:C:T 11797697 C     T          0.05  
#>  7 22    chr22:12044872:A:C 12044872 A     C          0.0417
#>  8 22    chr22:12194389:G:A 12194389 G     A          0.0583
#>  9 22    chr22:12207043:C:T 12207043 C     T          0.0583
#> 10 22    chr22:12350816:G:A 12350816 G     A          0.0583
#> # ℹ 165 more rows