How to obtain polled workers genotype across colonies? #593
Replies: 3 comments 1 reply
-
@DrMulusewFikere I am looking at this. So, the
giving
then
and finally
But, we did anticipate that people will want one block of genotypes, so we added the
But I appreciate that you want to get pooled workers genotype per colony and the collapsed into a matrix across colonies! So, how would we go about doing this in a clean way? Let's see what can already be done:
We get a list of genotype matrices. So, we should be able to just run
Right, that's not what I expected! But, looking at the
So, we now have a list of one row matrices (with mean allele dosage of workers per colony) which we can
giving us a matrix with colonies in rows and markers in columns. Alternative would be:
Does this help @DrMulusewFikere? I appreciate this looks a bit involved, but it's because we work across colonies and we try to have a consistent way of working across This will be a very common request, I think. So, we should probably add this to examples. |
Beta Was this translation helpful? Give feedback.
-
@DrMulusewFikere @janaobsteter I have changed the default to |
Beta Was this translation helpful? Give feedback.
-
Mulu,
You have to loop over colonies with *apply() functions;)
Please check the examples I provided at #593 (comment)
…--
With regards!
-----------------------------------------------------------------
University of Edinburgh Gregor Gorjanc, PhD
The Roslin Institute Professor & Royal Society Industry Fellow
Easter Bush @***@***.***<https://twitter.com/GregorGorjanc>
EH25 9RG @***@***.***>
Scotland, UK www.ed.ac.uk/roslin/highlanderlab<http://www.ed.ac.uk/roslin/highlanderlab>
-----------------------------------------------------------------
On Sun, Dec 15 2024 at 5:45 pm, DrMulusewFikere ***@***.******@***.***>> wrote:
This email was sent to you by someone outside the University.
You should only click on links or attachments if you are certain that the email is genuine and the content is safe.
The above scenario works, but if we add snpChip into SP. It doesn't work. since, the snpChip = 1; argument is under getSnpGeno function; whereas type = "mean"; is under getPooledGeno function.
Example
SP$addSnpChip(5)
tmp <- getPooledGeno(getSnpGeno(apiary,snpChip = 1, caste = "workers", collapse = T),type = "mean")
The above code generate pooledWorker genotype for the FIRST colony and has o be looped for the nconlonies
—
Reply to this email directly, view it on GitHub<#593 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAFRGSRH33PJHB4HTLY7F3L2FW52NAVCNFSM6AAAAABTUM3ALKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNJXGMZTOOA>.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.
|
Beta Was this translation helpful? Give feedback.
-
In multicolony setting "getSegSiteGeno" function generates a list instead of raw genotype data
Example
Create a founder genome
founderGenomes <- quickHaplo(nInd = 20, nChr = 3, segSites = 100)
Initialise SP
SP <- SimParamBee$new(founderGenomes,
nWorkers = 50,
nDrones = 10,
csdChr = 3,
nCsdAlleles = 32)
baseQueens <- createVirginQueens(founderGenomes)
apiary <- createMultiColony(x = baseQueens[1:20])
DCA <- createDrones(baseQueens[5:10],nInd = 50)
fun <- nFathersPoisson
droneGroups <- pullDroneGroupsFromDCA(DCA, n = 20,nDrones = fun)
apiary <- cross(apiary, drones = droneGroups)
apiary <- buildUp(apiary)
Below I have temporary addressed the issue and it works
start.time <- Sys.time()
library(parallel)
nColony <- nColonies(apiary)
process_colony <- function(colony_data) {
segSiteGeno <- getSegSiteGeno(colony_data, caste = "workers")
pooledGeno <- getPooledGeno(segSiteGeno,
type = "mean",
sex = getCasteSex(colony_data, caste = "workers"))
return(pooledGeno)
}
genoW <- lapply(seq_len(nColony), function(colony) {
process_colony(apiary@colonies[[colony]])
})
pooledGenoW <- do.call(rbind, genoW)
Another option
genoW <- vector("list", length = nColony)
nColony <- colonies(age_0)
for (colony in 1:nColony) {
pooledGenoW <- getPooledGeno(getSnpGeno(age_0, snpChip = 1, caste = "workers",collapse = T),type = "mean",
sex = getCasteSex(age_0@colonies[[colony]], caste = "workers"))
genoW[[colony]] <- pooledGenoW
}
pooledGenoW <- do.call(rbind, genoW)
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken
Beta Was this translation helpful? Give feedback.
All reactions