probs2fst: Store genotype probabilities in fst database

fst_genoprobR Documentation

Store genotype probabilities in fst database

Description

Save an R/qtl2 genotype probabilities object to a set of fst files for fast access with reduced memory usage.

Usage

fst_genoprob(
  genoprob,
  fbase,
  fdir = ".",
  compress = 0,
  verbose = TRUE,
  overwrite = FALSE,
  quiet = !verbose
)

Arguments

genoprob

Object of class "calc_genoprob". For details, see the R/qtl2 developer guide and qtl2::calc_genoprob().

fbase

Base of filename for fst database.

fdir

Directory for fst database.

compress

Amount of compression to use (value in the range 0-100; lower values mean larger file sizes)

verbose

Opposite of quiet; deprecated argument (to be removed).

overwrite

If FALSE (the default), refuse to overwrite any files that already exist.

quiet

If FALSE (the default), show messages about fst database creation.

Details

The genotype probabilities are stored in separate databases for each chromosome as tables of (indivduals*genotypes) x (positions) in directory fst. The dim, dimnames and is_x_chr elements of the object have information about the entire fst database. If a fst_genoprob object is a subset of another such object, the chr, ind, and mar contain information about what is in the subset. However, the fst databases are not altered in a subset, and can be restored by fst_restore(). The actual elements of an "fst_genoprob" object are only accessible to the user after a call to unclass(); instead the usual access to elements of the object invoke subset.fst_genoprob().

Value

A list containing the attributes of genoprob and the address for the created fst database. Components are:

  • dim - List of all dimensions of 3-D arrays.

  • dimnames - List of all dimension names of 3-D arrays.

  • is_x_chr - Vector of all is_x_chr attributes.

  • chr - Vector of (subset of) chromosome names for this object.

  • ind - Vector of (subset of) individual names for this object.

  • mar - Vector of (subset of) marker names for this object.

  • fst - Path and base of file names for the fst database.

Functions

  • fst_genoprob: Deprecated version (to be deleted)

See Also

fst_path(), fst_extract(), fst_files(), replace_path(), fst_restore()

Examples

library(qtl2)
grav2 <- read_cross2(system.file("extdata", "grav2.zip", package="qtl2"))
map <- insert_pseudomarkers(grav2$gmap, step=1)
probs <- calc_genoprob(grav2, map, error_prob=0.002)
dir <- tempdir()
fprobs <- fst_genoprob(probs, "grav2", dir, overwrite=TRUE)

# clean up: remove all the files we created
unlink(fst_files(fprobs))

kbroman/qtl2fst documentation built on May 3, 2023, 11:12 a.m.