read_snp | R Documentation |
This function reads a standard Eigenstrat *.snp file into a tibble.
It uses readr::read_table()
to do it efficiently.
read_snp(file, verbose = TRUE)
file |
Input file (whatever is accepted by |
verbose |
If |
A tibble with columns: id
, chr
, posg
, pos
, ref
, alt
Eigenstrat SNP format reference: https://github.com/DReichLab/EIG/tree/master/CONVERTF
# to read "data.snp", run like this: # snp <- read_snp("data") # this also works # snp <- read_snp("data.snp") # The following example is more awkward # because package sample data has to be specified in this weird way: # read an existing Eigenstrat *.snp file file <- system.file("extdata", 'sample.snp', package = "genio", mustWork = TRUE) snp <- read_snp(file) snp # can specify without extension file <- sub('\\.snp$', '', file) # remove extension from this path on purpose file # verify .snp is missing snp <- read_snp(file) # load it anyway! snp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.