Changelog
Source:NEWS.md
TSDFGS 3.0.0
R stays the interface; the computation moved to C++ (Rcpp and RcppEigen). All exported functions, their names, and their arguments are those of v2.4.2, so v2 scripts run unchanged.
New criteria and license
- 15 training set criteria were added (A-, D-, E-, G-optimality, PEVmax, MSPE, GVoverall, GVaverage, Avg_GRM, Avg_GRM_self, Avg_GRM_MinMax, CDmean, CDmean(v2), PAM, CDmax). Select one with
optTrain(method = ); score a given set with its*_score()function; list them withcriteria(). Each has a page on the website with the original reference, the authors’ repository, and a license review. -
optTrain()has alambdaargument (ridge penalty). - The license is GPL (>= 3), as in v2.4.2. STPGA (GPL-3) and TSODBG (GPL >= 3) were used to check results; no code was copied.
Multithreading
-
SSDFGS(),FGCM(), andnt2r()run independent searches in parallel with OpenMP (multi.threads = TRUEorthreads = n) instead ofparallel::mclapply. Each search has its own random generator, so values do not depend on the number of threads. They differ from the serial run with the same seed. Benchmark:bench/bench_openmp.R. - The package no longer imports
parallel; the default thread count comes from OpenMP (processors available to the process, limited byOMP_NUM_THREADS). -
optTrain(threads = )sets the threads Eigen may use inside one search (useful for several hundred columns).
Published method unchanged
-
r_score(),optTrain(), andSSDFGS()keep the method of Ou & Liao (2019, doi:10.1007/s00122-019-03387-0). The criterion values equal the v2.4.2 values to about 1e-7 (v2.4.2 returned single-precision numbers). -
optTrain()keeps the search moves, the order of the random numbers, the default number of iterations, and the stopping rule. Withoptions(TSDFGS.legacy_float = TRUE)and the same seed it returns the training sets recorded from v2.4.2 for all twelve routes (with or without sub-populations, targeted or not, three criteria). This is tested. -
r_score()still uses the scalar1 - 1/n0where a centering matrix may be intended. It is kept on purpose, so that results do not change.
Faster
- The scores no longer form n0 x n0 matrices. They use matrices of size min(n, p) (primal or dual form), a Cholesky solve instead of an explicit inverse, and a precomputed test-set term when the test set is fixed. See the article “How the scores are computed”.
- With more columns than training rows (for example markers), the scores use the Gram matrix of all rows, built once per search. On the rice PCs this makes 404 PCs 13 to 106 times faster than v2.4.2 on one core.
- The search (hill climbing) runs in C++: no row copies in R, no growing vectors.
- The score vectors of the search are allocated once.
- Benchmark:
bench/bench_speed.R; results in the article “Moving from v2 to v3”.
Fixes
-
optTrain()no longer fails with “the condition has length > 1” whenmin.iteris smaller than5 * sqrt(length(cand) * n.train)(negative look-back index in the stopping rule). - Drawing from a group or pool of size 1 no longer samples from
1:x. - With sub-populations and no test set,
candneed not be1:nrow(geno). - Clear errors for missing values,
n.trainlarger thancand, and row numbers outsidegeno. -
min.itermust be a single finite number of at least 1;NAorInfused to run forever. - A score that is not finite (for example a test set of one individual) stops the search with an error instead of returning
NaN. A test set needs at least 2 individuals. -
n.trainmust be a whole number, andcandmust not contain duplicates. - With sub-populations and a test set, a new training individual is never one that is already in the training set (v2.4.2 could duplicate a member;
TSDFGS.legacy_floatkeeps that draw). A sub-population with too few candidates gives a clear error. - Parallel searches share one Gram matrix instead of copying it for each search.
- Scores are returned in double precision.
- Removed compiled files (
*.o,*.so) from the repository.
New
-
optTrain(seed = ); the result also hasn.iterandconverged. - Plots of
SSDFGS()use the Okabe-Ito colors; ggplot2 is optional (without it the figures areNULLand the numbers are still returned). - Dependencies:
dplyr,ggplot2, andlatex2expare no longer imported (dplyrwas never used). Imports are nowRcppandstats;RcppEigenis link-time only. - Tests (
tests/testthat) with regression tests against v2.4.2 output. Only the r-score, PEV, and CD (the criteria of v2.4.2) are tested carefully; the 15 added criteria are provided but not carefully tested. -
env/: Apptainer recipe (TSDFGS.def) and pinned conda list for building and testing. - License: GPL (>= 3), unchanged from v2.4.2.
-
environment.ymlandenv/Dockerfile: the tested software versions as a conda environment and as a Docker image (GitHub Container Registry, built by.github/workflows/docker.yaml). - New website (pkgdown) with a getting-started guide and articles on criteria, methods, and migration.