| Title: | Colourful Biometrical Analysis for Plant Breeding and Genetics |
|---|---|
| Description: | A compact, colour-first toolkit for the analysis of plant breeding and genetics field experiments. It provides analysis of variance for the randomised block design (RBD) and factorial RBD, a check-anchored intra-block analysis for augmented alpha-lattice designs, and the core biometrical-genetics workflow used in crop improvement: estimation of genetic variability (genotypic and phenotypic coefficients of variation, broad-sense heritability, expected genetic advance), genotypic and phenotypic correlation, path-coefficient analysis, line x tester and Griffing diallel combining-ability analysis (general combining ability and specific combining ability), Mahalanobis D-square genetic-divergence analysis with Tocher and hierarchical clustering, and genotype-by-environment stability analysis (Eberhart-Russell regression and the additive main effects and multiplicative interaction (AMMI) model). Methods follow Griffing (1956) <doi:10.1071/BI9560463> and Eberhart and Russell (1966) <doi:10.2135/cropsci1966.0011183X000600010011x>. Every analysis returns a tidy result object and a publication-ready 'ggplot2' figure using a bespoke high-contrast colour system. |
| Authors: | Praveen Kumar B. K. [aut, cre] |
| Maintainer: | Praveen Kumar B. K. <[email protected]> |
| License: | GPL-3 |
| Version: | 0.3.2 |
| Built: | 2026-09-27 11:50:20 UTC |
| Source: | https://github.com/bkpraveenars-del/bkbreed |
A compact, colour-first toolkit for analysing plant-breeding and genetics field
experiments: RBD, Factorial RBD and Augmented Alpha-Lattice designs; genetic
variability, correlation and path analysis; Mahalanobis D-square divergence; and
Eberhart-Russell / AMMI stability. Every analysis returns a tidy object and a
publication-ready ggplot2 figure via bk_plot.
Praveen Kumar B. K. [email protected]
bk_rbd, bk_frbd, bk_augmented,
bk_variability, bk_correlation, bk_path,
bk_diversity, bk_stability, bk_plot.
Analysis of augmented designs. Block effects are estimated by intra-block least squares from replicated checks; every genotype mean is adjusted and classical Federer standard errors are reported.
bk_augmented(data, trait, gen, block, rep = NULL, checks = NULL, alpha = 0.05)bk_augmented(data, trait, gen, block, rep = NULL, checks = NULL, alpha = 0.05)
data |
A data frame in long format. |
trait |
Character; response column. |
gen |
Character; genotype column (checks and test entries). |
block |
Character; (incomplete) block column. |
rep |
Character or NULL; replication column for the alpha-lattice layout. |
checks |
Character vector of check names; if NULL, genotypes occurring more than once are treated as checks. |
alpha |
Significance level (default 0.05). |
An object of class bk_augmented with adjusted means, block effects, error MS and Federer critical differences.
d <- bk_data("augmented") res <- bk_augmented(d, "grain_yield", "genotype", "block", "rep", checks = c("CHK-1","CHK-2","CHK-3","CHK-4")) res bk_plot(res)d <- bk_data("augmented") res <- bk_augmented(d, "grain_yield", "genotype", "block", "rep", checks = c("CHK-1","CHK-2","CHK-3","CHK-4")) res bk_plot(res)
Genotypic and phenotypic correlation coefficients among traits, via analysis of covariance.
bk_correlation(data, traits, gen, rep)bk_correlation(data, traits, gen, rep)
data |
A data frame in long format. |
traits |
Character vector of trait columns (>= 2). |
gen |
Character; genotype column. |
rep |
Character; replication column. |
An object of class bk_correlation with matrices rg and rp.
cr <- bk_correlation(bk_data("rbd"), c("grain_yield","plant_height","tillers","test_weight"), "genotype", "rep") cr bk_plot(cr)cr <- bk_correlation(bk_data("rbd"), c("grain_yield","plant_height","tillers","test_weight"), "genotype", "rep") cr bk_plot(cr)
Convenience loader for the demonstration datasets shipped with the package.
bk_data(name = c("rbd", "frbd", "augmented", "mlt", "lxt", "diallel"))bk_data(name = c("rbd", "frbd", "augmented", "mlt", "lxt", "diallel"))
name |
One of |
A data frame.
head(bk_data("rbd"))head(bk_data("rbd"))
Griffing's (1956) diallel analysis for a half diallel of parents plus one set of F1 crosses without reciprocals (Method 2), with genotypes as fixed effects (Model I). Standard errors are computed exactly by propagating the per-entry error variance through the linear GCA/SCA estimators.
bk_diallel(data, trait, parent1, parent2, rep, alpha = 0.05)bk_diallel(data, trait, parent1, parent2, rep, alpha = 0.05)
data |
A data frame in long format with one row per plot. |
trait |
Character; response column. |
parent1, parent2
|
Character; the two parent columns of each entry. Diagonal entries (parent1 == parent2) are the parents/selfs. |
rep |
Character; replication column. |
alpha |
Significance level for testing effects (default 0.05). |
An object of class bk_diallel with the combining-ability ANOVA, parental
GCA effects, the SCA matrix, exact standard errors, Baker's predictability ratio
and variance components.
res <- bk_diallel(bk_data("diallel"), trait = "grain_yield", parent1 = "parent1", parent2 = "parent2", rep = "rep") res bk_plot(res) bk_plot(res, type = "sca")res <- bk_diallel(bk_data("diallel"), trait = "grain_yield", parent1 = "parent1", parent2 = "parent2", rep = "rep") res bk_plot(res) bk_plot(res, type = "sca")
Computes Mahalanobis D-square distances among genotypes using the pooled error covariance, then groups them by Tocher and Ward clustering.
bk_diversity(data, traits, gen, rep, method = c("tocher", "hierarchical"), clusters = NULL)bk_diversity(data, traits, gen, rep, method = c("tocher", "hierarchical"), clusters = NULL)
data |
A data frame in long format. |
traits |
Character vector of trait columns. |
gen |
Character; genotype column. |
rep |
Character; replication column. |
method |
Clustering for the default figure: tocher (default) or hierarchical. |
clusters |
Number of hierarchical clusters; if NULL, matches the Tocher count. |
An object of class bk_diversity with the D2 matrix, cluster
memberships and cluster means.
dv <- bk_diversity(bk_data("rbd"), c("grain_yield","plant_height","tillers","test_weight"), "genotype", "rep") dv bk_plot(dv)dv <- bk_diversity(bk_data("rbd"), c("grain_yield","plant_height","tillers","test_weight"), "genotype", "rep") dv bk_plot(dv)
ANOVA for a two-factor factorial in a randomised block design, with main-effect and interaction means and factor-specific critical differences.
bk_frbd(data, trait, factorA, factorB, rep, alpha = 0.05)bk_frbd(data, trait, factorA, factorB, rep, alpha = 0.05)
data |
A data frame in long format. |
trait |
Character; response column. |
factorA, factorB
|
Character; the two treatment factor columns. |
rep |
Character; replication/block column. |
alpha |
Significance level (default 0.05). |
An object of class bk_frbd.
res <- bk_frbd(bk_data("frbd"), "grain_yield", "nitrogen", "variety", "rep") res bk_plot(res)res <- bk_frbd(bk_data("frbd"), "grain_yield", "nitrogen", "variety", "rep") res bk_plot(res)
Kempthorne's Line x Tester analysis for crosses in a randomised
block design. Partitions crosses into lines, testers and line x tester;
estimates GCA and SCA effects; and derives additive and dominance variances
(assuming inbred parents, F = 1).
bk_lxt(data, trait, line, tester, rep, alpha = 0.05)bk_lxt(data, trait, line, tester, rep, alpha = 0.05)
data |
A data frame of the crosses in long format. |
trait |
Character; response column. |
line |
Character; line (female) column. |
tester |
Character; tester (male) column. |
rep |
Character; replication column. |
alpha |
Significance level for testing GCA/SCA effects (default 0.05). |
An object of class bk_lxt with the combining-ability ANOVA, GCA effects
for lines and testers, SCA effects, proportional contributions and variance
components.
res <- bk_lxt(bk_data("lxt"), trait = "grain_yield", line = "line", tester = "tester", rep = "rep") res bk_plot(res) bk_plot(res, type = "sca")res <- bk_lxt(bk_data("lxt"), trait = "grain_yield", line = "line", tester = "tester", rep = "rep") res bk_plot(res) bk_plot(res, type = "sca")
A curated set of high-contrast palettes used across all BKBreed figures.
bk_palette(name = c("field", "spectrum", "canopy", "sunrise", "earth"), n = NULL, reverse = FALSE)bk_palette(name = c("field", "spectrum", "canopy", "sunrise", "earth"), n = NULL, reverse = FALSE)
name |
Palette name. |
n |
Number of colours to return (interpolated if needed). |
reverse |
Logical; reverse the palette order. |
A character vector of hex colours.
bk_palette("sunrise", 5) bk_palette("spectrum", 11)bk_palette("sunrise", 5) bk_palette("spectrum", 11)
Partitions the correlation of each causal trait with a target trait into direct and indirect effects (Wright's path analysis).
bk_path(data, traits, dependent, gen, rep, type = c("genotypic", "phenotypic"))bk_path(data, traits, dependent, gen, rep, type = c("genotypic", "phenotypic"))
data |
A data frame in long format. |
traits |
Character vector of causal (independent) traits. |
dependent |
Character; the target/effect trait. |
gen |
Character; genotype column. |
rep |
Character; replication column. |
type |
Correlation basis: genotypic (default) or phenotypic. |
An object of class bk_path with direct/indirect effects and the residual.
pa <- bk_path(bk_data("rbd"), c("plant_height","tillers","panicle_len","test_weight"), "grain_yield", "genotype", "rep") pa bk_plot(pa)pa <- bk_path(bk_data("rbd"), c("plant_height","tillers","panicle_len","test_weight"), "grain_yield", "genotype", "rep") pa bk_plot(pa)
Generic entry point returning the publication-ready figure for whichever analysis produced x.
bk_plot(x, ...)bk_plot(x, ...)
x |
A BKBreed result object. |
... |
Passed to the specific method (e.g. |
A ggplot2 object.
bk_plot(bk_rbd(bk_data("rbd"), "grain_yield", "genotype", "rep"))bk_plot(bk_rbd(bk_data("rbd"), "grain_yield", "genotype", "rep"))
One-call ANOVA for a randomised complete block design with SE, critical difference, CV and compact-letter groupings.
bk_rbd(data, trait, gen, rep, alpha = 0.05)bk_rbd(data, trait, gen, rep, alpha = 0.05)
data |
A data frame in long format. |
trait |
Character; response column. |
gen |
Character; genotype/treatment column. |
rep |
Character; replication/block column. |
alpha |
Significance level for the critical difference (default 0.05). |
An object of class bk_rbd with elements anova, means, cv, sem, sed and cd.
res <- bk_rbd(bk_data("rbd"), "grain_yield", "genotype", "rep") res bk_plot(res)res <- bk_rbd(bk_data("rbd"), "grain_yield", "genotype", "rep") res bk_plot(res)
Multi-location trial analysis: combined ANOVA, Eberhart-Russell regression (bi, S2di) and an AMMI decomposition with IPCA scores for biplots.
bk_stability(data, trait, gen, env, rep)bk_stability(data, trait, gen, env, rep)
data |
A data frame in long format. |
trait |
Character; response column. |
gen |
Character; genotype column. |
env |
Character; environment/location column. |
rep |
Character; replication column. |
An object of class bk_stability with combined ANOVA, Eberhart-Russell parameters and AMMI scores.
st <- bk_stability(bk_data("mlt"), "grain_yield", "genotype", "environment", "rep") st bk_plot(st) bk_plot(st, type = "er")st <- bk_stability(bk_data("mlt"), "grain_yield", "genotype", "environment", "rep") st bk_plot(st) bk_plot(st, type = "er")
Estimates GCV, PCV, ECV, broad-sense heritability, genetic advance and genetic advance as percent of mean for one or more traits.
bk_variability(data, traits, gen, rep, k = 2.063)bk_variability(data, traits, gen, rep, k = 2.063)
data |
A data frame in long format. |
traits |
Character vector of trait columns. |
gen |
Character; genotype column. |
rep |
Character; replication column. |
k |
Selection differential (default 2.063 for 5 percent intensity). |
An object of class bk_variability (a data frame with metadata).
v <- bk_variability(bk_data("rbd"), c("grain_yield","plant_height","tillers","test_weight"), "genotype", "rep") v bk_plot(v)v <- bk_variability(bk_data("rbd"), c("grain_yield","plant_height","tillers","test_weight"), "genotype", "rep") v bk_plot(v)
Discrete colour and fill scales built on the BKBreed palettes.
scale_colour_bk(pal_name = "sunrise", reverse = FALSE, ...) scale_color_bk(pal_name = "sunrise", reverse = FALSE, ...) scale_fill_bk(pal_name = "sunrise", reverse = FALSE, ...)scale_colour_bk(pal_name = "sunrise", reverse = FALSE, ...) scale_color_bk(pal_name = "sunrise", reverse = FALSE, ...) scale_fill_bk(pal_name = "sunrise", reverse = FALSE, ...)
pal_name |
BKBreed palette name (see |
reverse |
Logical; reverse the palette. |
... |
Passed to |
A ggplot2 scale.
library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) + geom_point() + scale_colour_bk("sunrise")library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) + geom_point() + scale_colour_bk("sunrise")
The BKBreed figure theme.
theme_bk(base_size = 12, base_family = "", grid = TRUE)theme_bk(base_size = 12, base_family = "", grid = TRUE)
base_size |
Base font size in points. |
base_family |
Font family. |
grid |
Logical; draw light major grid lines. |
A ggplot2 theme object.
library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_bk()library(ggplot2) ggplot(mtcars, aes(wt, mpg)) + geom_point() + theme_bk()