qtl_scone: QTL mapping

View source: R/metapipe.R

qtl_sconeR Documentation

QTL mapping

Description

Perform QTL mapping using the qtl:scanone(...) function to obtain LOD scores for all traits, peak positions, and markers.

Usage

qtl_scone(x_data, cpus = 1, ...)

Arguments

x_data

Cross-data frame containing genetic map data and traits.

cpus

Number of CPUs to be used in the computation.

...

Arguments passed on to qtl::scanone.

Value

Data frame containing the LOD scores.

See Also

Other QTL mapping functions: qtl_perm_test(), read.cross()

Examples


# Create temp dir
tmp <- tempdir()
dir.create(tmp, showWarnings = FALSE, recursive = TRUE)

# Toy dataset
excluded_columns <- c(1, 2)
population <- 5
seed <- 123
set.seed(seed)
example_data <- data.frame(ID = 1:population,
                           P1 = c("one", "two", "three", "four", "five"),
                           T1 = rnorm(population),
                           T2 = rnorm(population))

output <- MetaPipe::assess_normality(example_data, 
                                     excluded_columns, 
                                     show_stats = FALSE,
                                     out_prefix = paste0(tmp, "/tmp"))

# Create and store random genetic map (for testing only)
genetic_map <- MetaPipe:::random_map(population = population, 
                                     seed = seed)
# Load cross file with genetic map and raw data for normal traits
x <- MetaPipe::read.cross(genetic_map, output$norm)

x <- qtl::calc.genoprob(x, step = 1, error.prob = 0.001)
x_scone <- MetaPipe::qtl_scone(x, 1, model = "normal", method = "hk")

# F1 Seedling Ionomics dataset
data(ionomics) # Includes some missing data
data(father_riparia) # Genetic map
ionomics_rev <- MetaPipe::replace_missing(ionomics, 
                                          excluded_columns = c(1, 2),
                                          replace_na =  TRUE,
                                          out_prefix = paste0(tmp, "/tmp"))
ionomics_normalised <- 
  MetaPipe::assess_normality(ionomics_rev,
                             excluded_columns = c(1, 2),
                             out_prefix = file.path(tmp, "ionomics"),
                             transf_vals = c(2, exp(1)),
                             show_stats = FALSE)
                             
# Load cross file with genetic map and raw data for normal traits
x <- MetaPipe::read.cross(father_riparia, 
                          ionomics_normalised$norm,
                          genotypes = c("nn", "np", "--"))
                          
set.seed(seed)
x <- qtl::jittermap(x)
x <- qtl::calc.genoprob(x, step = 1, error.prob = 0.001)

x_scone <- MetaPipe::qtl_scone(x, 1, model = "normal", method = "hk")

# Clean temporal directory
# unlink(tmp, recursive = TRUE, force = TRUE)
MetaPipe:::tidy_up(tmp)


villegar/MetaPipe documentation built on Nov. 22, 2022, 10:44 p.m.