HighlanderLab / SIMplyBee

SIMplyBee R package extends AlphaSimR for simulating honeybee populations and breeding programmes
http://www.simplybee.info/
Other
0 stars 5 forks source link

Add a function that converts diploid drone haplotype&genotype data to haploid version #149

Closed gregorgorjanc closed 2 years ago

gregorgorjanc commented 2 years ago

This would be a way to "hack" the output (instead of the real genome) for drones - return just one haplotype (the two are identical anyway) and "half" of the genotype to reflect their haploid nature.

gregorgorjanc commented 2 years ago

I am addressing this in this pull request (ongoing work) by adding dronesHaploid argument to get*Geno/Haplo*() functions. By default it's set to TRUE so we get just one haplotype or half a diploid genotype for drones, despite them having internal diploid (as doubled haploid) genome. Here is an example:

> founderGenomes <- quickHaplo(nInd = 3, nChr = 3, segSites = 100)
> SP <- SimParamBee$new(founderGenomes)
> basePop <- asVirginQueen(newPop(founderGenomes))
> 
> drones <- createDrones(x = basePop[1], nInd = 10)
> colony1 <- createColony(queen = basePop[2], fathers = drones[1:5])
> colony2 <- createColony(queen = basePop[3], fathers = drones[6:10])
> colony1 <- addWorkers(colony1, nInd = 10)
> colony2 <- addWorkers(colony2, nInd = 20)
> colony1 <- addDrones(colony1, nInd = 2)
> apiary <- c(colony1, colony2)
> getCsdAlleles(getQueen(colony1))
    3_86 3_87 3_88 3_89 3_90 3_91 3_92
2_1    0    1    0    1    0    0    0
2_2    1    0    1    0    0    0    0
> getCsdAlleles(getFathers(colony1))
    3_86 3_87 3_88 3_89 3_90 3_91 3_92
4_1    1    1    0    1    1    0    0
5_1    1    1    0    1    1    0    0
7_1    1    1    0    1    1    0    0
8_1    1    1    0    1    1    0    0
6_1    1    1    0    1    1    0    0
> getCsdAlleles(getFathers(colony1), dronesHaploid = FALSE)
    3_86 3_87 3_88 3_89 3_90 3_91 3_92
4_1    1    1    0    1    1    0    0
4_2    1    1    0    1    1    0    0
8_1    1    1    0    1    1    0    0
8_2    1    1    0    1    1    0    0
7_1    1    1    0    1    1    0    0
7_2    1    1    0    1    1    0    0
5_1    1    1    0    1    1    0    0
5_2    1    1    0    1    1    0    0
6_1    1    1    0    1    1    0    0
6_2    1    1    0    1    1    0    0