timothyfrasier / related

8 stars 7 forks source link

inbreeding estimates #2

Open mcLoretto opened 5 years ago

mcLoretto commented 5 years ago

Hi Timothy, I have a question concerning the inbreeding estimates in your package. if I set "allow.inbreeding=T" in the coancestry function, only inbreeding estimates for two methods are calculated: LH, LR - probably lynchrd and ritland, but not the likelihood methods? With your example data (code below) some inbreeding estimates of LH are very high (max 1.89) with my own data even up to a value of 6. Any idea how to get the inbreeding values for the likelihood methods and why some of these values are so high?

thanks, Matthias

input <- readgenotypedata("GenotypeData.txt") output_inbred2 <- coancestry(input$gdata, trioml=1, lynchli=1, lynchrd=1, quellergt=1, ritland=1, wang=1, dyadml=1, allow.inbreeding = T) str(output_inbred2$inbreeding) summary(output_inbred2$inbreeding$LH)

timothyfrasier commented 5 years ago

Hi Matthias:

Sorry about this, I didn’t explain this correctly in the tutorial.

related will always calculate the moment-based inbreeding coefficients, regardless of whether or not you set allow.inbreeding to TRUE. Setting this to TRUE is only needed if you are using the likelihood-based relatedness estimators, and are therefore accounting for inbreeding in the relatedness estimators. There is an error in the manual, in that none of the moment-based estimators can account for inbreeding, whereas I suggest that the Ritland and Lynch & Ritland methods can. It is only the two likelihood-based estimators that can account for inbreeding. I need to fix this soon…

Thus, if you are estimating relatedness using a moment-based estimator, and also want inbreeding coefficients, you do not need to set allow.inbreeding to TRUE. You will still get an inbreeding output file that will have two columns representing two different inbreeding estimates. The columns will be labeled LH and LR. These correspond to the inbreeding coefficients estimated using the Li & Horvitz (1953) method, as modified by Ritland (1996); and the method described in Lynch & Ritland (1999). Again, these will be estimated (and this file will be created) regardless of which moment-based relatedness estimator you are using.

The L2 and L3 columns correspond to the inbreeding coefficients associated with the diadml and trioml estimators, respectively.

Again, I apologize for the confusion. Please let me know if you have any other questions.

Sincerely, Tim Frasier

Li CC, Horvitz DG (1953) Some methods of estimating the inbreeding coefficient. American Journal of Human Genetics, 5, 107–117. Lynch M, Ritland K (1999) Estimation of pairwise relatedness with molecular markers. Genetics, 152, 1753–1766. Ritland K (1996) Estimators for pairwise relatedness and inbreeding coef- ficients. Genetical Research, 67, 175–186.


Timothy R. Frasier Coordinator - Forensic Sciences Program Associate Professor - Department of Biology Saint Mary's University 923 Robie Street Halifax, NS B3H 3C3, Canada Email: timothy.frasier@smu.camailto:timothy.frasier@smu.ca Tel: (902) 491-6382 www.frasierlab.cahttp://frasierlab.ca

On Dec 10, 2018, at 3:33 AM, Matthias Loretto notifications@github.com<mailto:notifications@github.com> wrote:

Hi Timothy, I have a question concerning the inbreeding estimates in your package. if I set "allow.inbreeding=T" in the coancestry function, only inbreeding estimates for two methods are calculated: LH, LR - probably lynchrd and ritland, but not the likelihood methods? With your example data (code below) some inbreeding estimates of LH are very high (max 1.89) with my own data even up to a value of 6. Any idea how to get the inbreeding values for the likelihood methods and why some of these values are so high?

thanks, Matthias

input <- readgenotypedata("GenotypeData.txt") output_inbred2 <- coancestry(input$gdata, trioml=1, lynchli=1, lynchrd=1, quellergt=1, ritland=1, wang=1, dyadml=1, allow.inbreeding = T) str(output_inbred2$inbreeding) summary(output_inbred2$inbreeding$LH)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADbcWU6sbK6kxHC5bmhw5yH5hczdP_OLks5u3g5WgaJpZM4ZKzfl.

mcLoretto commented 5 years ago

Hi Tim, thanks a lot for your detailed response! Based on the simulations to compare relatedness estimators, I'm in this case most interested in dyadml. However, if I set allow.inbreeding TRUE, there are no L2 and L3 columns. If I set it FALSE, these columns appear, but L3 shows the LH values and L2 (like LR) only zeros.

best, Matthias

duanedief commented 4 years ago

Tim,

Just a follow-up with mcLoretto's question. If I run this statement

output <- coancestry ("CUIS_2019updated.txt", allow.inbreeding = FALSE, ci95.num.bootstrap=999, trioml=2)

and view() the dataframe in RStudio I can see values for L2 but when I go to extract the values I only get zeros. Note that in the statement above I set allow.breeding=FALSE. If set to TRUE, L2 and L3 are not output to the dataframe.

I guess my question at this point is should I use these results? Some of the point estimates for L3 are outside the 95% CIs. I have run bootstraps of 999 and 2999 and get same results with point estimates outside the CI.

fabiomarroni commented 4 years ago

Same as @mcLoretto here, if I do not set use relatedness to TRUE I get that columns L3 and LH have values (although, in contrast to what @mcLoretto observed, they are different from each other, so they are probably two different estimators), and columns L2 and LR are all 0s.

timothyfrasier commented 4 years ago

Hi:

Yes, there are some issues with how I “explain” this in the tutorial and manual...

related will always calculate the moment-based inbreeding coefficients, regardless of whether or not you set allow.inbreeding to TRUE. Setting this to TRUE is only needed if you are using the likelihood-based relatedness estimators, and are therefore accounting for inbreeding in the relatedness estimators. There is an error in the manual, in that none of the moment-based estimators can account for inbreeding, whereas I suggest that the Ritland and Lynch & Ritland methods can. It is only the two likelihood-based estimators that can account for inbreeding. I need to fix this soon…

Thus, if you are estimating relatedness using a moment-based estimator, and also want inbreeding coefficients, you do not need to set allow.inbreeding to TRUE. You will still get an inbreeding output file that will have two columns representing two different inbreeding estimates. The columns will be labeled LH and LR. These correspond to the inbreeding coefficients estimated using the Li & Horvitz (1953) method, as modified by Ritland (1996); and the method described in Lynch & Ritland (1999). Again, these will be estimated (and this file will be created) regardless of which moment-based relatedness estimator you are using.

The L2 and L3 columns correspond to the inbreeding coefficients associated with the diadml and trioml estimators, respectively.

Again, I apologize for the confusion. Please let me know if you have any other questions.

Sincerely, Tim Frasier

Li CC, Horvitz DG (1953) Some methods of estimating the inbreeding coefficient. American Journal of Human Genetics, 5, 107–117. Lynch M, Ritland K (1999) Estimation of pairwise relatedness with molecular markers. Genetics, 152, 1753–1766. Ritland K (1996) Estimators for pairwise relatedness and inbreeding coef- ficients. Genetical Research, 67, 175–186.


Timothy R. Frasier Coordinator - Forensic Sciences Program Associate Professor - Department of Biology Saint Mary's University 923 Robie Street Halifax, NS B3H 3C3, Canada Email: timothy.frasier@smu.ca Tel: (902) 491-6382 www.frasierlab.ca http://frasierlab.ca/

On Apr 23, 2020, at 5:31 PM, duanedief notifications@github.com wrote:

CAUTION: This email is from an external sender. Do not click on links or open attachments unless you trust the sender. Please forward suspected phishing emails to reportphishing@smu.ca

Tim,

Just a follow-up with mcLoretto's question. If I run this statement

output <- coancestry ("CUIS_2019updated.txt", allow.inbreeding = FALSE, ci95.num.bootstrap=999, trioml=2)

and view() the dataframe in RStudio I can see values for L2 but when I go to extract the values I only get zeros. Note that in the statement above I set allow.breeding=FALSE. If set to TRUE, L2 and L3 are not output to the dataframe.

I guess my question at this point is should I use these results? Some of the point estimates for L3 are outside the 95% CIs. I have run bootstraps of 999 and 2999 and get same results with point estimates outside the CI.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/timothyfrasier/related/issues/2#issuecomment-618651137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3NYWPSGZJBVK4KSOZUXH3ROCQSNANCNFSM4GJLG7SQ.

Mabel-Agy commented 5 months ago

Hi, I'm new to scripting in R. I want to use coancestry to determine the genomic relatedness of my dataset. I saw that I have to first import the dataset from my computer using "readgenotypedata( )". My dataset is a ped file so i removed the columns containing the parent IDs of the animals, and the phenotypes, leaving only the animal IDs and the alleles on the various loci. Is that the right thing to do? Also when I did that and tried to read in the new data set with "readgenotype( )", I had this error:

Error in $<-.data.frame(*tmp*, "allele", value = integer(0)) : replacement has 0 rows, data has 1 In addition: Warning messages: 1: In storage.mode(genotype.data[[2 i]]) <- "integer" : NAs introduced by coercion 2: In storage.mode(genotype.data[[2 i + 1]]) <- "integer" : NAs introduced by coercion

Any help as to how I can solve this?

timothyfrasier commented 5 months ago

Hi:

I'm having a little trouble following the situation. Could you send me your infile and then I can take a look and see what may be causing the problem?

-Tim


Timothy R. Frasier Coordinator: Forensic Sciences Program Professor: Biology Saint Mary's University 923 Robie Street Halifax, Nova Scotia B3H 3C3 Canada Tel: (902) 491-6382 E-mail: @.*** frasierlab.ca


From: Mabel-Agy @.> Sent: Tuesday, February 27, 2024 10:14 AM To: timothyfrasier/related @.> Cc: Timothy Frasier @.>; Comment @.> Subject: Re: [timothyfrasier/related] inbreeding estimates (#2)

Hi, I'm new to scripting in R. I want to use coancestry to determine the genomic relatedness of my dataset. I saw that I have to first import the dataset from my computer using "readgenotypedata( )". My dataset is a ped file so i removed the columns containing the parent IDs of the animals, and the phenotypes, leaving only the animal IDs and the alleles on the various loci. Is that the right thing to do? Also when I did that and tried to read in the new data set with "readgenotype( )", I had this error:

Error in $<-.data.frame(tmp, "allele", value = integer(0)) : replacement has 0 rows, data has 1 In addition: Warning messages: 1: In storage.mode(genotype.data[[2 i]]) <- "integer" : NAs introduced by coercion 2: In storage.mode(genotype.data[[2 i + 1]]) <- "integer" : NAs introduced by coercion

Any help as to how I can solve this?

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2#issuecomment-1966645987, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA3NYWOLRFC2ENZHTMUWUSLYVXS3TAVCNFSM4GJLG7S2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWGY3DINJZHA3Q. You are receiving this because you commented.Message ID: @.***>

Mabel-Agy commented 5 months ago

Hi Timothy, thanks but i have been able to solve the issue. Besides it’s not data that I can share.

Thank you


From: timothyfrasier @.> Sent: Wednesday, February 28, 2024 5:19:37 PM To: timothyfrasier/related @.> Cc: Mabel-Agy @.>; Comment @.> Subject: Re: [timothyfrasier/related] inbreeding estimates (#2)

Hi:

I'm having a little trouble following the situation. Could you send me your infile and then I can take a look and see what may be causing the problem?

-Tim


Timothy R. Frasier Coordinator: Forensic Sciences Program Professor: Biology Saint Mary's University 923 Robie Street Halifax, Nova Scotia B3H 3C3 Canada Tel: (902) 491-6382 E-mail: @.*** frasierlab.ca


From: Mabel-Agy @.> Sent: Tuesday, February 27, 2024 10:14 AM To: timothyfrasier/related @.> Cc: Timothy Frasier @.>; Comment @.> Subject: Re: [timothyfrasier/related] inbreeding estimates (#2)

Hi, I'm new to scripting in R. I want to use coancestry to determine the genomic relatedness of my dataset. I saw that I have to first import the dataset from my computer using "readgenotypedata( )". My dataset is a ped file so i removed the columns containing the parent IDs of the animals, and the phenotypes, leaving only the animal IDs and the alleles on the various loci. Is that the right thing to do? Also when I did that and tried to read in the new data set with "readgenotype( )", I had this error:

Error in $<-.data.frame(tmp, "allele", value = integer(0)) : replacement has 0 rows, data has 1 In addition: Warning messages: 1: In storage.mode(genotype.data[[2 i]]) <- "integer" : NAs introduced by coercion 2: In storage.mode(genotype.data[[2 i + 1]]) <- "integer" : NAs introduced by coercion

Any help as to how I can solve this?

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2#issuecomment-1966645987, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA3NYWOLRFC2ENZHTMUWUSLYVXS3TAVCNFSM4GJLG7S2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWGY3DINJZHA3Q. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2#issuecomment-1969344902, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BGP7QA652G7HM5M4XTDLDLDYV5KJTAVCNFSM4GJLG7S2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWHEZTINBZGAZA. You are receiving this because you commented.Message ID: @.***>

timothyfrasier commented 5 months ago

Hi:

Okay great, I'm glad that a solution has been found.

-Tim


Timothy R. Frasier Coordinator: Forensic Sciences Program Professor: Biology Saint Mary's University 923 Robie Street Halifax, Nova Scotia B3H 3C3 Canada Tel: (902) 491-6382 E-mail: @.*** frasierlab.ca


From: Mabel-Agy @.> Sent: Wednesday, February 28, 2024 1:30 PM To: timothyfrasier/related @.> Cc: Timothy Frasier @.>; Comment @.> Subject: Re: [timothyfrasier/related] inbreeding estimates (#2)

Hi Timothy, thanks but i have been able to solve the issue. Besides it’s not data that I can share.

Thank you


From: timothyfrasier @.> Sent: Wednesday, February 28, 2024 5:19:37 PM To: timothyfrasier/related @.> Cc: Mabel-Agy @.>; Comment @.> Subject: Re: [timothyfrasier/related] inbreeding estimates (#2)

Hi:

I'm having a little trouble following the situation. Could you send me your infile and then I can take a look and see what may be causing the problem?

-Tim


Timothy R. Frasier Coordinator: Forensic Sciences Program Professor: Biology Saint Mary's University 923 Robie Street Halifax, Nova Scotia B3H 3C3 Canada Tel: (902) 491-6382 E-mail: @.*** frasierlab.ca


From: Mabel-Agy @.> Sent: Tuesday, February 27, 2024 10:14 AM To: timothyfrasier/related @.> Cc: Timothy Frasier @.>; Comment @.> Subject: Re: [timothyfrasier/related] inbreeding estimates (#2)

Hi, I'm new to scripting in R. I want to use coancestry to determine the genomic relatedness of my dataset. I saw that I have to first import the dataset from my computer using "readgenotypedata( )". My dataset is a ped file so i removed the columns containing the parent IDs of the animals, and the phenotypes, leaving only the animal IDs and the alleles on the various loci. Is that the right thing to do? Also when I did that and tried to read in the new data set with "readgenotype( )", I had this error:

Error in $<-.data.frame(tmp, "allele", value = integer(0)) : replacement has 0 rows, data has 1 In addition: Warning messages: 1: In storage.mode(genotype.data[[2 i]]) <- "integer" : NAs introduced by coercion 2: In storage.mode(genotype.data[[2 i + 1]]) <- "integer" : NAs introduced by coercion

Any help as to how I can solve this?

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2#issuecomment-1966645987, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA3NYWOLRFC2ENZHTMUWUSLYVXS3TAVCNFSM4GJLG7S2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWGY3DINJZHA3Q. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2#issuecomment-1969344902, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BGP7QA652G7HM5M4XTDLDLDYV5KJTAVCNFSM4GJLG7S2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWHEZTINBZGAZA. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/2#issuecomment-1969493432, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA3NYWLOCH4F6PGQF73D6CTYV5ST3AVCNFSM4GJLG7S2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJWHE2DSMZUGMZA. You are receiving this because you commented.Message ID: @.***>