Proceed several crosses
Arguments
- crosses
data.frame with crossing instructions: parents names
ind1
ind2
, number of descendantn
and names of descendantnames
- pop
list of individuals containing the parents
Examples
# create specie:
mySpec <- specie$new(nChr = 3,
lchr = c(100, 150, 200),
lchrCm = 100,
verbose = FALSE)
# simulate SNP:
SNPcoord <- data.frame(chr = c(rep("Chr1", 3),
rep("Chr2", 4),
rep("Chr3", 5)),
physPos = c(sample(100, 3),
sample(150, 4),
sample(200, 5)),
linkMapPos = NA,
SNPid = sprintf(fmt = paste0("SNP%0", 2,"i"),
1:(3 + 4 + 5)))
# create SNPinfo object:
SNPs <- SNPinfo$new(SNPcoord = SNPcoord, specie = mySpec)
# simulate haplotype:
rawHaplo1 <- matrix(sample(c(0, 1), (3 + 4 + 5) * 2, replace = TRUE),
nrow = 2)
colnames(rawHaplo1) <- sprintf(fmt = paste0("SNP%0", 2,"i"),
1:(3 + 4 + 5))
haplo1 <- haplotype$new(SNPinfo = SNPs,
haplo = rawHaplo1)
rawHaplo2 <- matrix(sample(c(0, 1), (3 + 4 + 5) * 2, replace = TRUE),
nrow = 2)
colnames(rawHaplo2) <- sprintf(fmt = paste0("SNP%0", 2,"i"),
1:(3 + 4 + 5))
haplo2 <- haplotype$new(SNPinfo = SNPs,
haplo = rawHaplo2)
rawHaplo3 <- matrix(sample(c(0, 1), (3 + 4 + 5) * 2, replace = TRUE),
nrow = 2)
colnames(rawHaplo3) <- sprintf(fmt = paste0("SNP%0", 2,"i"),
1:(3 + 4 + 5))
haplo3 <- haplotype$new(SNPinfo = SNPs,
haplo = rawHaplo3)
# create individuals:
myInd1 <- individual$new(name = "Ind 1",
specie = mySpec,
parent1 = "OkaaSan",
parent2 = "OtouSan",
haplo = haplo1,
verbose = FALSE)
myInd2 <- individual$new(name = "Ind 2",
specie = mySpec,
parent1 = "OkaaSan",
parent2 = "OtouSan",
haplo = haplo2,
verbose = FALSE)
myInd3 <- individual$new(name = "Ind 3",
specie = mySpec,
parent1 = "OkaaSan",
parent2 = "OtouSan",
haplo = haplo3,
verbose = FALSE)
myPop <- population$new(name = "My Population 1",
inds = list(myInd1, myInd2, myInd3),
verbose = FALSE)
crossToDo <- data.frame(ind1 = c("Ind 1", "Ind 1", "Ind 2"),
ind2 = c("Ind 2", "Ind 3", "Ind 3"),
n = 1,
names = c("Off 1-2", "Off 1-3", "Off 2-3"))
makeCrosses(crossToDo, myPop)
#> $`Off 1-2`
#> <individual>
#> Public:
#> clone: function (deep = FALSE)
#> generateGametes: function (n = 1)
#> haplo: Haplotype, R6
#> initialize: function (name = "Unnamed", specie = specie$new(), parent1 = NA,
#> name: Off 1-2
#> parent1: Ind 1
#> parent2: Ind 2
#> specie: Specie, R6
#> Private:
#> checkHaplo: function ()
#>
#> $`Off 1-3`
#> <individual>
#> Public:
#> clone: function (deep = FALSE)
#> generateGametes: function (n = 1)
#> haplo: Haplotype, R6
#> initialize: function (name = "Unnamed", specie = specie$new(), parent1 = NA,
#> name: Off 1-3
#> parent1: Ind 1
#> parent2: Ind 3
#> specie: Specie, R6
#> Private:
#> checkHaplo: function ()
#>
#> $`Off 2-3`
#> <individual>
#> Public:
#> clone: function (deep = FALSE)
#> generateGametes: function (n = 1)
#> haplo: Haplotype, R6
#> initialize: function (name = "Unnamed", specie = specie$new(), parent1 = NA,
#> name: Off 2-3
#> parent1: Ind 2
#> parent2: Ind 3
#> specie: Specie, R6
#> Private:
#> checkHaplo: function ()
#>