Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSL ERROR: function value is not finite in brent.c at line 202 errno 9 #210

Closed
peterdfields opened this issue Aug 21, 2019 · 26 comments
Closed
Assignees
Milestone

Comments

@peterdfields
Copy link

Hi,

I'm running into the following the error GSL ERROR: function value is not finite in brent.c at line 202 errno 9 when running gemma -bfile datafile -k datafile.cXX.txt -lmm 2 -maf 0.05 -o phenotype. The versions of gemma is 0.98.1 and it's running on a cent os 6 machine. When I run the same command with the -check flag I get the message FATAL ERROR: GEMMA caused a floating point error which suggests machine boundaries were reached. You can disable floating point tests with the -no-check switch (use at your own risk!). I tried to run the command with both the -no-check and no-fpe-check flags but the gemma analysis is still unable to finish and I see the same error. I tried subsetting the overall data to only include 100% genotyped individuals in case the error is being caused by something similar to issue #184 but the error still arises. Please let me know if any specific info would be useful in tracking down the cause of this error. Thank you for your time and advice.

@pjotrp
Copy link
Member

pjotrp commented Aug 22, 2019

Hmmm. If you send me your data files I can try and see what the problem is.

@pjotrp pjotrp self-assigned this Aug 22, 2019
@pjotrp pjotrp added the bug label Aug 22, 2019
@pjotrp pjotrp added this to the 0.99 release milestone Aug 22, 2019
@peterdfields
Copy link
Author

Hi pjotrp,

Is there an email address I could send a link to the file to?

@pjotrp
Copy link
Member

pjotrp commented Aug 22, 2019

pjotr public 673 at thebird dot nl

@pjotrp
Copy link
Member

pjotrp commented Sep 4, 2019

Looks like the number of phenotypes is very low.

@emc2rae
Copy link

emc2rae commented May 10, 2021

Were you able to determine the cause of this error? I am running into it as well. I've narrowed it down to a single feature that seems to cause the error, and making tiny changes to the values of that feature makes it work.

EDIT: FWIW, this issue seemed to occur with features that have very small differences between their min and max values, and, so far, I've been able to get around it by scaling all my features to have a min of 0 and a max of 2.

@pjotrp
Copy link
Member

pjotrp commented May 12, 2021

Scaling is a good idea

@hrwang
Copy link

hrwang commented Aug 11, 2021

I am having the same error, and scaling is not helping. In my case, I have other evidences to suggest that the error is likely to be caused by a precision problem: there are several SNPs that are highly associated with the phenotype, p value maybe lower than 1e-60, maybe it reaches the limit of precision of the computer? My dataset also do not have many phenotypes, not sure it also affects. Could you take a look at my files if I send you the data file?

@pjotrp
Copy link
Member

pjotrp commented Aug 11, 2021

Yes, I can take a look. You can E-mail me the files if you want. See the footer of https://thebird.nl/

pjotrp added a commit that referenced this issue Aug 14, 2021
GSL ERROR: function value is not finite in brent.c at line 202 errno 9
#210
@hrwang
Copy link

hrwang commented Aug 16, 2021

Yes, I can take a look. You can E-mail me the files if you want. See the footer of https://thebird.nl/

This update fixed my issue. Now at these SNPs, I got nan, and the main program was not crashing.

@pjotrp
Copy link
Member

pjotrp commented Aug 16, 2021

Reopening to publish fix.

@pjotrp pjotrp reopened this Aug 16, 2021
@pjotrp
Copy link
Member

pjotrp commented Aug 25, 2021

The fix is part of the 0.98.5 release I just put out!

@pjotrp pjotrp closed this as completed Aug 25, 2021
pjotrp added a commit to genenetwork/GEMMA that referenced this issue Aug 26, 2021
GSL ERROR: function value is not finite in brent.c at line 202 errno 9
genetics-statistics#210
@sql647
Copy link

sql647 commented Nov 12, 2021

I got a gsl error, too. I tried to use a parallel program to run gemma because I have a lot of phenotype. And now I'm in this follow error.gsl error:function value is not finite in brent.c at line 57 errno 9

@sql647
Copy link

sql647 commented Nov 12, 2021

I got a gsl error, too. I tried to use a parallel program to run gemma because I have a lot of phenotype. And now I'm in this follow error.gsl error:function value is not finite in brent.c at line 57 errno 9

And another errorgsl error:function value is not finite in brent.c at line 58 errno 9

@leegene1992
Copy link

leegene1992 commented Feb 9, 2022

Hi Pjotr,
It seems 0.98.5 release does not completely solved gsl error. It solved the problem when there are many SNPs that are highly associated with the phenotype, like p value is almost 0 or 0, but not with many SNPs that are highly associated with control.

@pjotrp
Copy link
Member

pjotrp commented Feb 10, 2022

Interesting. Do you have a data example you can share so I can look at providing a fix? Thanks. Also paste the error here.

@leegene1992
Copy link

Hi Pjotr,
Thanks for the quick response. Since my vcf is too large, I split it into different trunks. When running these trunks, some succeeded running, some not. Here I show you two cases (one succeeded, one failed) as example.

###the succeeded one
command:
gemma -bfile Chitili_Creek.split_5.txt.vcf -gk 1 -o relmatrix
gemma -bfile Chitili_Creek.split_5.txt.vcf -k output/relmatrix.cXX.txt -n 1 -lmm -o Chitili_Creek.split_5.txt.vcf
Logfile:
number of total individuals = 12
number of analyzed individuals = 12
number of covariates = 1
number of phenotypes = 1
number of total SNPs/var = 332207
number of analyzed SNPs = 263229
Start Eigen-Decomposition...
pve estimate =2.10768e-06
se(pve) =1.90547
**** WARNING: Brent did not converge 46%
**** WARNING: Brent did not converge= 76%
================================================== 100%
**** INFO: Done.

###the failed one
command:
gemma -bfile Chitili_Creek.split_4.txt.vcf -gk 1 -o relmatrix
gemma -bfile Chitili_Creek.split_4.txt.vcf -k output/relmatrix.cXX.txt -n 1 -lmm -o Chitili_Creek.split_4.txt.vcf
Logfile:
number of total individuals = 12
number of analyzed individuals = 12
number of covariates = 1
number of phenotypes = 1
number of total SNPs/var = 339566
number of analyzed SNPs = 268344
Start Eigen-Decomposition...
pve estimate =2.10194e-06
se(pve) =1.28465
GSL ERROR: function value is not finite in brent.c at line 57 errno 9

It seems GSL ERROR still exists. Here are the input files:

https://drive.google.com/drive/folders/14VzCub0hj5D-eyobGlildlcIITJbIOa6?usp=sharing

I would really appreciate if you can give me some help.
Best,
Jing

@pjotrp
Copy link
Member

pjotrp commented Feb 10, 2022

Wait, gemma does not take VCF files. I should give a warning on that.

@leegene1992
Copy link

Wait, gemma does not take VCF files. I should give a warning on that.

Sorry for the confusion. The Chitili_Creek.split_4.txt.vcf here is the prefix of plink file, but not VCF files.

@pjotrp
Copy link
Member

pjotrp commented Feb 10, 2022

Gotcha. I don't have the time to look into this right now, but if you leave the files I'll definitely take a look. Ping me in a week or so.

@pjotrp pjotrp reopened this Feb 10, 2022
@pjotrp
Copy link
Member

pjotrp commented Feb 14, 2022

It may be a bit tough to fix. I can reproduce the error with the following stack trace. It is happening in the call to

gsl_root_fsolver_set((gsl_root_fsolver*)s_f, &F, lambda_l, lambda_h);
Thread 1 "gemma" received signal SIGINT, Interrupt.
0x00007ffff5e1eeca in raise ()
   from /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libpthread.so.0
(gdb) bt
#0  0x00007ffff5e1eeca in raise ()
   from /gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/lib/libpthread.so.0
#1  0x00000000004245ca in gemma_gsl_error_handler (reason=<optimized out>, file=<optimized out>, 
    line=57, gsl_errno=<optimized out>) at src/gemma.cpp:75
#2  0x00007ffff7e5aa4d in brent_init ()
   from /gnu/store/hkzqndw8jik4vf48yf4kii8cz9y9lps1-profile/lib/libgsl.so.25
#3  0x0000000000472338 in CalcLambda (func_name=func_name@entry=82 'R', params=..., 
    l_min=l_min@entry=1.0000000000000001e-05, l_max=100000, n_region=<optimized out>, 
    lambda=@0x7fffffffcc98: nan(0x8000000000000), logf=@0x7fffffffcc70: nan(0x8000000000000))
    at src/lmm.cpp:2027
#4  0x00000000004762b8 in LMM::AnalyzePlink (this=this@entry=0x7fffffffd170, U=U@entry=0x4fbb20, 
    eval=eval@entry=0x4fbb60, UtW=UtW@entry=0x4fbb90, Uty=Uty@entry=0x7fffffffd110, 
    W=W@entry=0x4fd230, y=<optimized out>, gwasnps=...) at src/lmm.cpp:1863
#5  0x0000000000435a05 in GEMMA::BatchRun (this=this@entry=0x7fffffffe6f0, cPar=...)
    at src/gemma.cpp:2798
#6  0x000000000047c534 in main (argc=10, argv=0x7fffffffe858) at src/main.cpp:86

@pjotrp pjotrp closed this as completed in a78dc77 Feb 15, 2022
@pjotrp
Copy link
Member

pjotrp commented Feb 15, 2022

I made a fix. Try the static binary at https://biogems.info/download/gemma-0.98.6-pre1.gz

Note that 12 individuals is really not enough power to run GWA. Hits can only be suggestive.

@leegene1992
Copy link

Dear Pjotr, thanks a lot for the debugging. It works perfectly now. Cheers.

@sql647
Copy link

sql647 commented Dec 12, 2023 via email

@jasongallant
Copy link

I'm having a similar issue to the previous posters. The download link for gemma-0.98.6-pre1.gz no longer works-- is there somewhere else this can be obtained from?

@jgroh
Copy link

jgroh commented Mar 20, 2024

I am also experiencing this issue using 0.98.5, and can't access the download link for the newer version. Is there a known fix for this issue?

@vivekruhelaIIITD
Copy link

Hello,

I am also getting the same error: GSL ERROR: function value is not finite in brent.c at line 57 errno 9.

The download link for GEMMA verrsion 0.98.6 (https://biogems.info/download/gemma-0.98.6-pre1.gz) is not working. Can you please share the link again.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants