Skip to contents

The goal of geno2r is to easily import genotype data from various formats into R.

HTSlib is wrapped and imported by Rsamtools, to enhance the VCF reading speed. In order to efficiently read a VCF file, it should be compressed with bgzip and indexed with tabix.

Installation

You can install the most recent version of geno2r from GitHub with:

#install.packages("remotes")
remotes::install_github("oumarkme/geno2r", force=TRUE)

Example

This is a basic example which shows you how to read VCF data to R with read_vcf():

library(geno2r)
read_vcf(file = "human.vcf.gz", range="22:49379357")   # or
read_vcf(file = "human.vcf.gz", range="22:49379357-49379357")   # or
read_vcf(file = "human.vcf.gz", range=NULL)

Example data

You can find an example VCF file on Github.