genoprob_to_alleleprob_fst: Convert genotype probabilities to allele probabilities and...

Description Usage Arguments Details Value See Also Examples

View source: R/genoprob_to_alleleprob_fst.R

Description

Reduce genotype probabilities (as calculated by calc_genoprob()) to allele probabilities, writing them to an fst database.

Usage

1
2
3
4
5
6
7
8
9
genoprob_to_alleleprob_fst(
  probs,
  fbase,
  fdir = ".",
  quiet = TRUE,
  cores = 1,
  compress = 0,
  overwrite = FALSE
)

Arguments

probs

Genotype probabilities, as calculated from calc_genoprob().

fbase

Base of filename for fst database.

fdir

Directory for fst database.

quiet

IF FALSE, print progress messages.

cores

Number of CPU cores to use, for parallel calculations. (If 0, use parallel::detectCores().) Alternatively, this can be links to a set of cluster sockets, as produced by parallel::makeCluster().

compress

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

overwrite

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

Details

This is like calling qtl2::genoprob_to_alleleprob() and then fst_genoprob(), but in a way that hopefully saves memory by doing it one chromosome at a time.

Value

Link to fst database for the probs input with probabilities collapsed to alleles rather than genotypes.

See Also

qtl2::genoprob_to_alleleprob(), fst_genoprob()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library(qtl2)
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
gmap_w_pmar <- insert_pseudomarkers(iron$gmap, step=1)

# genotype probabilities
fst_dir <- file.path(tempdir(), "iron_genoprob")
dir.create(fst_dir)
probs_fst <- calc_genoprob_fst(iron, "iron", fst_dir, gmap_w_pmar, error_prob=0.002)

# allele probabilities
fst_dir_apr <- file.path(tempdir(), "iron_alleleprob")
dir.create(fst_dir_apr)
aprobs_fst <- genoprob_to_alleleprob_fst(probs_fst, "iron", fst_dir_apr)

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

qtl2fst documentation built on Oct. 7, 2021, 5:09 p.m.