| Reading and combining SGP outputs | R Documentation |
Read the output generated by the 'SGP' or 'SGP.CV' functions saved at the provided save.at parameter. It merges all partial files when data was splited according to argument subset. Function 'read_summary' reads the output generated after calling the method summary; multiple outputs are read if argument path is a vector and in this case, they are combined by averaging across all outputs.
read_SGP(path = ".", type = NULL,
file.ext = ".RData", verbose = TRUE)
read_summary(path = ".", type = NULL,
file.ext = ".RData", verbose = TRUE)
path |
(character) Path where output files were saved. This may include a prefix |
type |
(character) Either 'SGP' or 'SGP.CV' to collect results generated by either function of the same name |
file.ext |
(character) This is the file extension at which file was saved as per the argument |
verbose |
|
An object of the class 'SGP' for which methods predict, plot and summary exist
require(SFSI)
data(wheatHTP)
index = which(Y$trial %in% 1:10) # Use only a subset of data
Y = Y[index,]
M = scale(M[index,])/sqrt(ncol(M)) # Subset and scale markers
G = tcrossprod(M) # Genomic relationship matrix
y = as.vector(scale(Y[,"E1"])) # Scale response variable
# Training and testing sets
tst = which(Y$trial %in% 1:3)
trn = seq_along(y)[-tst]
path = paste0(tempdir(),"/testSGP_")
# Run the analysis into 4 subsets and save them at a given path
SGP(y, K=G, trn=trn, tst=tst, subset=c(1,4), save.at=path)
SGP(y, K=G, trn=trn, tst=tst, subset=c(2,4), save.at=path)
SGP(y, K=G, trn=trn, tst=tst, subset=c(3,4), save.at=path)
SGP(y, K=G, trn=trn, tst=tst, subset=c(4,4), save.at=path)
# Collect all results after completion
fm = read_SGP(path)
# Generate and save summary
summary(fm, save.at=path)
fm2 = read_summary(path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.