liftover

Liftover of Variants

Description

This is a generic function that performs a liftover of variants between genome builds

Perform a liftover for a given set of variants from from.build to to.build genome builds.

Calls a GenotypeInfo object’s lift() function

Usage

liftover(data, to.build, ...)

## S3 method for class 'PolyGeniusModelSet'
liftover(data, to.build, min.variants = NULL, logger = NULL)

## S3 method for class 'PolyGeniusModel'
liftover(data, to.build, logger = NULL)

## S3 method for class 'data.frame'
liftover(
  data,
  from.build,
  to.build,
  chromosome.column = "chr",
  position.columns = c("position"),
  chromosome.format = NULL,
  chain.path = NULL,
  liftover.binary = internal.value("liftover.exec"),
  logger = NULL
)

## S3 method for class 'GenotypeInfo'
liftover(
  data,
  to.build,
  output = NULL,
  standardize.ids = TRUE,
  chromosome.format = "26",
  logger = NULL
)

Arguments

data

GenotypInfo object to liftover

to.build

Character. Target genome build key.

Additional arguments passed to specific methods.

chromosome.column

A character specifying the variants column name that contains the variants chromosome information.

position.columns

A character vector specifying the variants column name(s) containing variant position information. Expected is a single column name specifying position (interpreted as both beginning and end positions) or two column names of beginning and end positions.

chromosome.format

Character. Sets the “–output-chr” flag to reformat chromosome codes (e.g. "chr", "0M", "MT") (default "26")

chain.path

Optional path to a liftover chain file. If NULL, the path is resolved via workspace$catalogs$liftoverChains.

output

Character. Optional output directory; defaults to source directory.

standardize.ids

Logical. If TRUE, all variant IDs are overwritten using the variants.updateIDs function

from.buid

A character of the genome build to liftover from. See liftoverChains for supported liftovers options.

liftover

Path to a liftOver executable to be used. If not specified (default) then package default is used.

Details

By setting the global option PolyGenius.debug to TRUE the function writes three intermediate files:

  1. to.lift.{from.build}.to.{to.build} - A bed formatted file with the variants to be lifted

  2. lifted.{from.build}.to.{to.build} - A bed formatted file with the lifted variants

  3. unlifted.{from.build}.to.{to.build} - A tab separated file with the unlifted variants with the reason for which they failed liftover.

Value

Object with lifted variants

The table of post liftover variants. Any variants that failed to be lifted are added as an attribute to the variants table and include liftover fail reason

A new GenotypeInfo of the lifted data.

Note

A file containing unlifted variants is added as attr(obj, “unlifted”)

Examples

# Specifying a single position column
variants <- data.frame(chr = c("chr1", "chr2"), position = c(10001, 20001))
result <- liftover(variants, from.build = "GRCh37", to.build = "GRCh38")

# Specifying both beginning and end positions
variants <- data.frame(chr = c("chr1", "chr2"), begin = c(10001, 20001), end = c(10010, 20003))
result <- liftover(variants, from.build = "GRCh37", to.build = "GRCh38")
head(result)