gaynorr / AlphaSimR

R package for breeding program simulations
https://gaynorr.github.io/AlphaSimR/
Other
43 stars 18 forks source link

manAddTrait() confusion with LociMap-class #39

Closed ruthkepstein closed 2 years ago

ruthkepstein commented 2 years ago

manAddTrait() takes in "lociMap" descended from LociMap-class but no specification on how to create an object from LociMap-class. Documentation says it takes in nLoci, lociPerChr, lociLoc but contains no function to take in values to make lociMap.

gaynorr commented 2 years ago

Hi Ruth. I'm sorry didn't get back to your email before. The LociMap object is an S4 class, so you create it using the new function.

Below is an example for a three chromosome organism. It selects the first and third locus on chromosome 1 and the second locus on chromosome 2. Note that the L after the number denotes an integer and is needed with S4 classes. You can alternatively write numbers without the L and place them in an as.integer call.

chip = new("LociMap", nLoci=3L, lociPerChr=c(2L,1L,0L), lociLoc=c(1L,3L,2L))

ruthkepstein commented 2 years ago
Hi Chris, Thanks for this information; I was looking through your GitHub to figure out parameters but was unsuccessful. Is there a way to designate only 1 QTL on 1 chromosome but have 10 chromosomes in total (so 9 without QTLs)?Again thank you for your help; I know you are busy so I appreciate it! RuthFrom: Chris GaynorSent: Monday, February 14, 2022 6:11 PMTo: gaynorr/AlphaSimRCc: ruthkepstein; AuthorSubject: Re: [gaynorr/AlphaSimR] manAddTrait() confusion with LociMap-class (Issue #39) Hi Ruth. I'm sorry didn't get back to your email before. The LociMap object is an S4 class, so you create it using the new function.Below is an example for a three chromosome organism. It selects the first and second loci on chromosome 1 and the second locus on chromosome 2. Note that the L after the number denotes an integer and is needed with S4 classes. You can alternatively write numbers without the L and place them in an as.integer call.chip = new("LociMap", nLoci=3L, lociPerChr=c(2L,1L,0L), lociLoc=c(1L,3L,2L))—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: ***@***.***> 
gaynorr commented 2 years ago

Yes. To do that use nLoci=1L. Set lociPerChr to vector of length 10 with a value of 1L for the chromosome that is suppose to have the QTL and 0L for all the rest. Then lociLoc will be a single value indicating which locus on the selected chromosome is being used as the QTL.

ruthkepstein commented 2 years ago
Hi Chris, Awesome! Thanks for your help! Ruth From: Chris GaynorSent: Tuesday, February 15, 2022 10:59 AMTo: gaynorr/AlphaSimRCc: ruthkepstein; AuthorSubject: Re: [gaynorr/AlphaSimR] manAddTrait() confusion with LociMap-class (Issue #39) Yes. To do that use nLoci=1L. Set lociPerChr to vector of length 10 with a value of 1L for the chromosome that is suppose to have the QTL and 0L for all the rest. Then lociLoc will be a single value indicating which locus on the selected chromosome is being used as the QTL.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: ***@***.***> 
ruthkepstein commented 2 years ago
Hi Chris, Sorry to bother again but I got an error with I used manAddTrait(). It says “Error in calcGenParam(lociMap, self$founderPop, self$nThreads) :   No such slot: addEff.”Is not a way to add Additive effects unless it is when adding an additive trait? I tried to set the variance of A with SP$varA but it is read only. Thank you & let me know if you can help,Ruth Epstein From: Chris GaynorSent: Tuesday, February 15, 2022 10:59 AMTo: gaynorr/AlphaSimRCc: ruthkepstein; AuthorSubject: Re: [gaynorr/AlphaSimR] manAddTrait() confusion with LociMap-class (Issue #39) Yes. To do that use nLoci=1L. Set lociPerChr to vector of length 10 with a value of 1L for the chromosome that is suppose to have the QTL and 0L for all the rest. Then lociLoc will be a single value indicating which locus on the selected chromosome is being used as the QTL.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: ***@***.***> 
ruthkepstein commented 2 years ago
Hi Chris, Hope you are well. We found class Trait A which extends class LociMap. We are trying to use it to add additive effects (addEff) before we use manAddTrait(). We are unsure how to add the information from class Trait A to the loci map or SimParams so that we do not get the error, I mentioned in the email I sent yesterday. If you have any code that demonstrates how to use class Trait A please let me know! Have a great Wednesday,Ruth EpsteinFrom: Chris GaynorSent: Tuesday, February 15, 2022 10:59 AMTo: gaynorr/AlphaSimRCc: ruthkepstein; AuthorSubject: Re: [gaynorr/AlphaSimR] manAddTrait() confusion with LociMap-class (Issue #39) Yes. To do that use nLoci=1L. Set lociPerChr to vector of length 10 with a value of 1L for the chromosome that is suppose to have the QTL and 0L for all the rest. Then lociLoc will be a single value indicating which locus on the selected chromosome is being used as the QTL.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: ***@***.***> 
gaynorr commented 2 years ago

You'll use similar syntax as described above. There will just be an additional slot for the additive effects of the QTL and a slot for an intercept. Below is an example with all the additive effects set to 1.

trait = new("TraitA", nLoci=3L, lociPerChr=c(2L,1L,0L), lociLoc=c(1L,3L,2L), addEff=c(1,1,1), intercept=0)

ruthkepstein commented 2 years ago
Hi Chris,Awesome! We were close!Have a great rest of your week,Ruth Epstein From: Chris GaynorSent: Thursday, February 17, 2022 11:43 AMTo: gaynorr/AlphaSimRCc: ruthkepstein; AuthorSubject: Re: [gaynorr/AlphaSimR] manAddTrait() confusion with LociMap-class (Issue #39) You'll use similar syntax as described above. There will just be an additional slot for the additive effects of the QTL and a slot for an intercept. Below is an example with all the additive effects set to 1.trait = new("TraitA", nLoci=3L, lociPerChr=c(2L,1L,0L), lociLoc=c(1L,3L,2L), addEff=c(1,1,1), intercept=0)—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: ***@***.***>