From 2e8ad9a89d6b4ab9570b11ae9c31c866341eeff6 Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 30 Jan 2020 16:20:36 +0100 Subject: [PATCH] Implemented simulateIndividuals --- NAMESPACE | 1 + R/admix1.R | 25 ------------------------- R/simulateIndividuals.R | 27 +++++++++++++++++++++++++++ man/simulateIndividuals.Rd | 12 ++++++++++++ tests/testthat/test-admix1.R | 20 ++++++++++++++++++++ 5 files changed, 60 insertions(+), 25 deletions(-) create mode 100644 R/simulateIndividuals.R create mode 100644 man/simulateIndividuals.Rd diff --git a/NAMESPACE b/NAMESPACE index 79a2e2f..f49f1d9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -14,6 +14,7 @@ export(proportion2str) export(rand) export(randdir) export(repmat) +export(simulateIndividuals) export(simuloiAlleeli) export(suoritaMuutos) export(times) diff --git a/R/admix1.R b/R/admix1.R index d611540..8251e22 100644 --- a/R/admix1.R +++ b/R/admix1.R @@ -453,29 +453,4 @@ admix1 <- function(tietue) { # simuloidut = randdir(counts(1:noalle(j),j,i) , noalle(j)); # allfreqs(1:noalle(j),j,i) = simuloidut; # end -# end - -# %-------------------------------------------------------------------------- - - -# function refData = simulateIndividuals(n,rowsFromInd,allfreqs,pop, missing_level) -# % simulate n individuals from population pop, such that approximately -# % proportion "missing_level" of the alleles are present. - -# nloci = size(allfreqs,2); - -# refData = zeros(n*rowsFromInd,nloci); -# counter = 1; % which row will be generated next. - -# for ind = 1:n -# for loc = 1:nloci -# for k=0:rowsFromInd-1 -# if rand