replace_path {qtl2fst}R Documentation

Replace the path used in fst_genoprob object

Description

Replace the path used in an fst_genoprob object.

Usage

replace_path(object, path)

Arguments

object

An object of class "fst_genoprob" as created by fst_genoprob().

path

New path (directory + file stem as a single character string) to be used in the object.

Value

The input object with the path replaced. If any of the expected files don't exist with the new path, warnings are issued.

See Also

fst_path(), fst_files()

Examples

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

# move the probabilities into a different directory
new_dir <- file.path(tempdir(), "subdir")
if(!dir.exists(new_dir)) dir.create(new_dir)
for(file in fst_files(fprobs)) {
   file.rename(file, file.path(new_dir, basename(file)))
}

# revise the path in fprobs
new_path <- sub(dir, new_dir, fst_path(fprobs))
fprobs <- replace_path(fprobs, new_path)

[Package qtl2fst version 0.28 Index]