Cross two individuals together
Arguments
- ind1
parent 1
- ind2
parent 2
- names
names of the descendants
- n
number of descendants
- verbose
print informations
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)
# 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)
offspring <- makeSingleCross(myInd1, myInd2, names = "off 1")
offspring
#> $`off 1`
#> <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
#> parent1: Ind 1
#> parent2: Ind 2
#> specie: Specie, R6
#> Private:
#> checkHaplo: function ()
#>