Skip to contents

Takes the `hgsi_fit` object produced by [hbr_fit_models()], groups the superior haplotypes into haplotype blocks, scores crosses by usefulness (Schnell and Utz, 1975) and by block coverage, and selects a diverse parent set. Returns the full `hgsi_advanced` object. Because the expensive cross-validation is already done, this function reruns in minutes with a different `haploblock_method` or a different `genetic_map`.

Usage

hbr_cross_design(
  fit,
  output_dir = NULL,
  cM_per_Mb = NULL,
  genetic_map = NULL,
  bin_cM = 1,
  top_crosses = 20L,
  relatedness_max = 0.3,
  mating = c("DH", "RIL"),
  sel_frac = 0.1,
  h_sel = 1,
  cross_rank = c("uc", "blocks", "balanced"),
  haploblock_method = c("recomb", "ld", "fourgamete", "gabriel", "recomb+gabriel",
    "recomb+fourgamete"),
  haploblock_rmax = 0.01,
  haploblock_r2 = 0.5,
  haploblock_ld_max_cM = 3,
  haploblock_max_span_cM = 5,
  haploblock_flank_cM = 1,
  haploblock_max_snps = 400L,
  haploblock_min_gamete = 0.01,
  run_set_selection = TRUE,
  set_size = 8L,
  n_candidates = 60L,
  block_cM = 5,
  verbose = TRUE
)

Arguments

fit

An `hgsi_fit` object from [hbr_fit_models()].

output_dir

Directory for the cross-design CSVs and the final RDS. `NULL` inherits `fit$output_dir`.

cM_per_Mb, genetic_map, bin_cM

Genetic map. See [hbr_advanced_decision()].

top_crosses

Number of crosses reported.

relatedness_max

Maximum relatedness between parents of a cross.

mating

`"DH"` or `"RIL"`.

sel_frac, h_sel

Selection intensity and heritability for usefulness.

cross_rank

How crosses are ordered: `"uc"`, `"blocks"` or `"balanced"`.

haploblock_method

See [hbr_advanced_decision()].

haploblock_rmax, haploblock_r2, haploblock_ld_max_cM, haploblock_max_span_cM

Map-based / LD block thresholds.

haploblock_flank_cM, haploblock_max_snps, haploblock_min_gamete

SNP-level method settings.

run_set_selection, set_size, n_candidates, block_cM

Set-selection settings.

verbose

Print progress.

Value

An `hgsi_advanced` object (a superset of the `hgsi_fit`).

Examples

toy <- system.file("extdata", "hgsi_toy", package = "HaploBreedR")
td  <- file.path(toy, "trait_YLD")
fit <- try(hbr_fit_models(
  trait_dirs   = c(YLD = td),
  plink_prefix = file.path(toy, "geno_toy"),
  output_dir   = tempdir(),
  cv_repeats   = 1L, cv_folds = 2L, strict = FALSE,
  verbose      = FALSE))
#> Error in addw(sprintf("%s: %d individuals lack a phenotype; they are ",  : 
#>   unused argument ("predicted, not used for training.")
if (inherits(fit, "hgsi_fit")) {
  try(hbr_cross_design(
    fit,
    output_dir        = tempdir(),
    haploblock_method = "recomb",
    run_set_selection = FALSE,
    verbose           = FALSE))
}