Skip to contents

Simulated pre-adjusted phenotype means (BLUEs) for 120 individuals across two traits, designed for use with run_haplotype_prediction. In a real analysis these would come from fitting a mixed model (ASReml-R, lme4, or SpATS) to field trial data. Here they are generated as polygenic trait values from random SNP effects plus noise, then standardised to zero mean and unit variance.

A flat-file copy is also available at system.file("extdata", "example_blues.csv", package = "LDxBlocks").

Usage

ldx_blues

Format

A data.frame with 120 rows and 3 columns:

id

Character. Individual identifier (ind001 to ind120), matching rownames(ldx_geno).

YLD

Numeric. Simulated yield-like BLUE (standardised).

RES

Numeric. Simulated resistance-like BLUE (standardised).

Source

Generated by data-raw/generate_example_data.R. Seed: set.seed(20250408).

Examples

blues_file <- system.file("extdata", "example_blues.csv",
                          package = "LDxBlocks")
blues <- read.csv(blues_file)
head(blues)
#>       id     YLD     RES
#> 1 ind001 -0.5175  0.6771
#> 2 ind002  0.7635  1.3764
#> 3 ind003 -1.3093 -0.9946
#> 4 ind004 -1.1162 -1.4089
#> 5 ind005  1.1343 -0.5120
#> 6 ind006  0.9307 -0.4573

if (FALSE) { # \dontrun{
# Single-trait prediction (YLD)
data(ldx_geno, ldx_snp_info, ldx_blocks)
res <- run_haplotype_prediction(
  geno_matrix = ldx_geno,
  snp_info    = ldx_snp_info,
  blocks      = ldx_blocks,
  blues       = blues,
  id_col      = "id",
  blue_col    = "YLD"
)
res$block_importance[res$block_importance$important, ]

# Multi-trait prediction (YLD + RES simultaneously)
res_mt <- run_haplotype_prediction(
  geno_matrix     = ldx_geno,
  snp_info        = ldx_snp_info,
  blocks          = ldx_blocks,
  blues           = blues,
  id_col          = "id",
  blue_cols       = c("YLD", "RES"),
  importance_rule = "any"
)
res_mt$solver_used   # 'sommer' or 'rrBLUP'
res_mt$block_importance[res_mt$block_importance$important_any,
  c("block_id", "var_scaled_YLD", "var_scaled_RES", "n_traits_important")]
} # }

# \donttest{
# Cross-validate genomic prediction accuracy
data(ldx_geno, ldx_snp_info, ldx_blocks)
blues_file <- system.file("extdata", "example_blues.csv",
                          package = "LDxBlocks")
blues <- read.csv(blues_file)
cv <- cv_haplotype_prediction(
  geno_matrix = ldx_geno,
  snp_info    = ldx_snp_info,
  blocks      = ldx_blocks,
  blues       = blues,
  k           = 3L,
  id_col      = "id",
  blue_col    = "YLD",
  verbose     = FALSE
)
cv$pa_mean
#>   trait         PA     RMSE     PA_sd    RMSE_sd
#> 1   YLD 0.08409993 1.073279 0.1879066 0.03967989
# }