Skip to contents

rPHG2 is a system to interact with and retrieve information from version 2 of the Practical Haplotype Graph (PHGv2) - a general, graph-based, computational framework for genotype inference. This is accomplished by leveraging the Breeding and PHG APIs.


You can install the development version of rphg2 from GitHub with:

# install.packages("pak")


# Initialize with PHGv2 JARs

# Create a connection
locCon <- list.files("my/hvcf/dir") |>

# Build a graph
graph <- locCon |> buildHaplotypeGraph()

# Read data into R
phgDs <- graph |> readPhgDataSet()

# Identify areas of interest
gr <- GRanges(
    seqnames = c("1", "2"),
    ranges = IRanges(
        c(100, 800),
        c(400, 900)

phgDs |> 
    filterSamples(c("B73", "Ky21", "Mo17")) |> 


Life Cycle Status

rPHG2 is a relatively new R package and may be subject to changes in workflow and function definitions. If you would like to see anything added or run into problems, please feel free to contact the team using the issues page.

Learning rPHG2

If installed locally, you can read the “Introduction to rPHG2” vignette by using:


Alternatively, the package’s website is another great place to read up on function usage, code changes, and workflows.