# NOT RUN {
# }
# NOT RUN {
<!-- % library(miraculix) -->
# }
# NOT RUN {
set.seed(0)
snps <- 100
indiv <- 10
M <- matrix(sample(0:2, snps * indiv, replace=TRUE), nrow = snps)
(GM <- genomicmatrix(M))
stopifnot(all(as.matrix(GM) == M))
## There is a difference between genomicmatrix and as.genomicmatrix
## in case of files: 'as.genomicmatrix' creates only a pointer to
## the file, while 'genomicmatrix' reads the file
file <- "miraculix"
if (interactive() && !file.exists(paste0(file, ".bgl"))) {
f <- rhaplo(indiv=100, loci=1000, file=file, file.type="beagle")
print(f)
print(G <- as.genomicmatrix(f))
print(g <- genomicmatrix(f))
Print(object.size(G), object.size(g)) ## g needs much more memory
file.remove(f)
}
# }
Run the code above in your browser using DataCamp Workspace