replace_path: Replace the path used in fst_genoprob object

Description Usage Arguments Value See Also Examples

View source: R/fst_path.R

Description

Replace the path used in an fst_genoprob object.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

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