timothyfrasier / related

8 stars 7 forks source link

Error running 'coancestry' function - TrioR.DAT does not exist #22

Open MboiTui opened 2 months ago

MboiTui commented 2 months ago

Hello!

I am trying to run related on a Mac within RStudio, but I encounter the following error:

Input file TrioR.DAT does not exist! Program stoped in subroutine ReadData Error in system.time(.Fortran("related", PACKAGE = "related")) : Related encountered a fatal error. Timing stopped at: 1.009 0.998 2.027

I produced the input genotype data with the 'readgenotypedata' function, after using gl2related from the dartR package to convert a genlight to the required input dataframe.

I tried to look at the source code to understand why I am receiving that error but couldn't really get anywhere.

Any help is appreciated

Cheers, L.V.B.

timothyfrasier commented 2 months ago

Hi:

Could you please send me the exact commands that used? That should help me trouble-shoot what the issue is.

-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: MboiTui @.> Sent: Saturday, May 25, 2024 2:04 AM To: timothyfrasier/related @.> Cc: Subscribed @.***> Subject: [timothyfrasier/related] Error running 'coancestry' function - TrioR.DAT does not exist (Issue #22)

Hello!

I am trying to run related on a Mac within RStudio, but I encounter the following error:

Input file TrioR.DAT does not exist! Program stoped in subroutine ReadData Error in system.time(.Fortran("related", PACKAGE = "related")) : Related encountered a fatal error. Timing stopped at: 1.009 0.998 2.027

I produced the input genotype data with the 'readgenotypedata' function, after using gl2related from the dartR package to convert a genlight to the required input dataframe.

I tried to look at the source code to understand why I am receiving that error but couldn't really get anywhere.

Any help is appreciated

Cheers, L.V.B.

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/22, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA3NYWP6FZE44KLY3BR3IX3ZEALW3AVCNFSM6AAAAABIISVMHOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMYTMNZQHEYDGNQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

MboiTui commented 2 months ago

Hello Tim,

Apologies that was a pretty poor description of my issue. Here is more info:

Read vcf file into R:

my.gl <- gl.read.vcf("my.vcf")

Convert from genlight to related format

gl2related(my.gl, outfile = "my.related", outpath="outpath")

Import related formatted data:

my.related <- readgenotypedata("my.related")

Run coancestry function

coancestry(my.related$gdata, allele.freqs = my.related$freqs, wang = 2, lynchli = 2, lynchrd = 2, ritland = 2, quellergt = 2, dyadml = 2, output.file = "my.related.output"

This is the traceback

Error in system.time(.Fortran("related", PACKAGE = "related")) : Related encountered a fatal error.
7. system.time(.Fortran("related", PACKAGE = "related"))
6. print(system.time(.Fortran("related", PACKAGE = "related")))
5. doTryCatch(return(expr), name, parentenv, handler)
4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
3. tryCatchList(expr, classes, parentenv, handlers)
2. tryCatch({ print(system.time(.Fortran("related", PACKAGE = "related"))) }, interrupt = function(ex) { .Fortran("clean_mem", PACKAGE = "related") ...
1. coancestry(relLN2$gdata, allele.freqs = relLN2$freqs, wang = 2, lynchli = 2, lynchrd = 2, ritland = 2, quellergt = 2, dyadml = 2, output.file = "../9_relatedness/9_1_related/")

I followed the installation instruction on this github, and checked that all required packages and that the compiler installed successfully

Versions:

timothyfrasier commented 1 month ago

Hi:

Did you try running these same analyses on the example genotype file?

If that worked fine, then my guess is that your error is due to the large nature of your data set, and the related package not using space efficiently. Unfortunately, this is a common problem with people trying to use this package on larger SNP data sets. I wrote related long ago, when microsatellites were the main type of data set. I therefore did not have efficient space-use in mind when I wrote it (it just wasn't a problem with those data sets). I am currently trying to find a student who could help me re-write it so that it will use space much more efficiently, and will therefore work on larger data sets. That is still a bit in the future though.

If you got a similar error with the sample data set, please let me know, because then it is due to something else.

-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: MboiTui @.> Sent: Thursday, May 30, 2024 9:27 PM To: timothyfrasier/related @.> Cc: Timothy Frasier @.>; Comment @.> Subject: Re: [timothyfrasier/related] Error running 'coancestry' function - TrioR.DAT does not exist (Issue #22)

Hello Tim,

Apologies that was a pretty poor description of my issue. Here is more info:

Read vcf file into R:

my.gl <- gl.read.vcf("my.vcf")

Convert from genlight to related format

gl2related(my.gl, outfile = "my.related", outpath="outpath")

Import related formatted data:

my.related <- readgenotypedata("my.related")

Run coancestry function

coancestry(my.related$gdata, allele.freqs = my.related$freqs, wang = 2, lynchli = 2, lynchrd = 2, ritland = 2, quellergt = 2, dyadml = 2, output.file = "my.related.output"

This is the traceback

Error in system.time(.Fortran("related", PACKAGE = "related")) : Related encountered a fatal error.

  1. system.time(.Fortran("related", PACKAGE = "related"))
  2. print(system.time(.Fortran("related", PACKAGE = "related")))
  3. doTryCatch(return(expr), name, parentenv, handler)
  4. tryCatchOne(expr, names, parentenv, handlers[[1L]])
  5. tryCatchList(expr, classes, parentenv, handlers)
  6. tryCatch({ print(system.time(.Fortran("related", PACKAGE = "related"))) }, interrupt = function(ex) { .Fortran("clean_mem", PACKAGE = "related") ...
  7. coancestry(relLN2$gdata, allele.freqs = relLN2$freqs, wang = 2, lynchli = 2, lynchrd = 2, ritland = 2, quellergt = 2, dyadml = 2, output.file = "../9_relatedness/9_1_related/")

Versions:

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

MboiTui commented 1 month ago

Hello Timothy,

Thank you for your reply.

I tried with the GenotypeData.txt file as input and got the same error. This was the code I used.

relLN2 <- readgenotypedata("../in/GenotypeData.txt")

coancestry(relLN2$gdata, allele.freqs = relLN2$freqs,
                    wang = 2,lynchli = 2,
                    lynchrd = 2,ritland = 2,
                    quellergt = 2,dyadml = 2,
                    output.file = "../out")
timothyfrasier commented 1 month ago

Hi:

Since you are having issues with the example data, it suggests that there is something wrong with the commands that you are using.

Could you just try:

relLN2 <- readgenotypedata("../in/GenotypeData.txt", header = FALSE, sep = " ")

coancestry(relLN2$gdata, wang = 1,lynchli = 1, lynchrd = 1,ritland = 1, quellergt = 1,dyadml = 1)

Please let me know how this goes.

-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: MboiTui @.> Sent: Tuesday, June 4, 2024 4:13 AM To: timothyfrasier/related @.> Cc: Timothy Frasier @.>; Comment @.> Subject: Re: [timothyfrasier/related] Error running 'coancestry' function - TrioR.DAT does not exist (Issue #22)

Hello Timothy,

Thank you for your reply.

I tried with the GenotypeData.txt file as input and got the same error. This was the code I used.

relLN2 <- readgenotypedata("../in/GenotypeData.txt")

coancestry(relLN2$gdata, allele.freqs = relLN2$freqs, wang = 2,lynchli = 2, lynchrd = 2,ritland = 2, quellergt = 2,dyadml = 2, output.file = "../out")

— Reply to this email directly, view it on GitHubhttps://github.com/timothyfrasier/related/issues/22#issuecomment-2146777641, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA3NYWKMARPGFMNMBBNKBRTZFVSJZAVCNFSM6AAAAABIISVMHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBWG43TONRUGE. You are receiving this because you commented.