Perform a QTL mapping permutation test using the qtl:scanone(...) function to find significant QTL.

Usage,
qtl_perm_test(
  x_data,
  cpus = 1,
  qtl_method = "par-scanone",
  raw_data_normalised = NULL,
  lod_threshold = 3,
  parametric = TRUE,
  n_perm = 1000,
  plots_dir = tempdir(),
  ...
)

Arguments

x_data

Cross-data frame containing genetic map data and traits.

cpus

Number of CPUs to be used in the computation.

qtl_method

QTL mapping method.

raw_data_normalised

Normalised raw data, see assess_normality.

lod_threshold

LOD score threshold to look up for significant QTLs

parametric

Boolean flag to indicate whether or not x_data contains parametric (normal) traits.

n_perm

Number of permutations.

plots_dir

Output directory for plots.

...

Arguments passed on to qtl::scanone.

Value

Data frame containing the significant QTLs information.

See also

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

Examples

# \donttest{
# Toy dataset
excluded_columns <- c(1, 2)
population <- 5
seed <- 123
set.seed(seed)
out_prefix <- file.path(tempdir(), "metapipe")
plots_dir <- file.path(tempdir(), "plots")
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 = out_prefix,
                                     plots_dir = plots_dir)

# 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)
#>  --Read the following data:
#> 	 5  individuals
#> 	 100  markers
#> 	 3  phenotypes
#>  --Cross type: f2 

x <- qtl::calc.genoprob(x, step = 1, error.prob = 0.001)
x_scone <- MetaPipe::qtl_scone(x, 1, model = "normal", method = "hk")
x_qtl_perm <- MetaPipe::qtl_perm_test(x, 
                                      n_perm = 5, 
                                      model = "normal", 
                                      method = "hk",
                                      plots_dir = plots_dir)
x_qtl_perm_1000 <- MetaPipe::qtl_perm_test(x, 
                                           n_perm = 1000, 
                                           model = "normal", 
                                           method = "hk",
                                           plots_dir = plots_dir)

# F1 Seedling Ionomics dataset
data(ionomics) # Includes some missing data
data(father_riparia) # Genetic map
out_prefix <- file.path(tempdir(), "ionomics")
plots_dir <- file.path(tempdir(), "plots")
ionomics_rev <- MetaPipe::replace_missing(ionomics, 
                                          excluded_columns = c(1, 2),
                                          replace_na =  TRUE,
                                          out_prefix = out_prefix)
ionomics_normalised <- 
  MetaPipe::assess_normality(ionomics_rev,
                             excluded_columns = c(1, 2),
                             out_prefix = out_prefix,
                             plots_dir = plots_dir,
                             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", "--"))
#>  --Read the following data:
#> 	 166  individuals
#> 	 1115  markers
#> 	 7  phenotypes
#> Warning: Some markers at the same position on chr 1,4,5,7,8,9,10,12,14,15,16,17; use jittermap().
#>  --Cross type: f2 
                          
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")
x_qtl_perm <- MetaPipe::qtl_perm_test(x, 
                                      n_perm = 5, 
                                      model = "normal", 
                                      method = "hk",
                                      plots_dir = plots_dir)
x_qtl_perm_1000 <- MetaPipe::qtl_perm_test(x, 
                                           n_perm = 1000, 
                                           model = "normal", 
                                           method = "hk",
                                           plots_dir = plots_dir)
# }