Error and Warning regarding userGWAS function

823 views
Skip to first unread message

Austin Park

unread,
Jan 21, 2022, 1:40:17 AM1/21/22
to Genomic SEM Users

Hi all,

I ran into problem using userGWAS function.

Problem 1:

Before running full userGWAS function, I tried to run first few SNPs as recommended in the tutorial video. I ran first 50 SNPs and everything’s fine except that all the SNPs have warning as below:

"lavaan WARNING: The variance-covariance matrix of the estimated parameters (vcov) does not appear to be positive definite! The smallest eigenvalue (= -3.275359e-11) is smaller than zero. This may be a symptom that the model is not identified."

Do you have any idea on what is causing this warning? Is it safe to ignore these warnings?

Problem 2:

If I run first 100 SNPs instead of 50 SNPs, then I get an error message as below,

Error in { : task 30 failed - "Lapack routine dgesv: system is exactly singular: U[29,29] = 0" Calls: userGWAS -> %dopar% -> <Anonymous> Execution halted

What does it mean by system is exactly singular?

I have attached userGWAS output (L_50SNPs.RData), LDSC output (G122_Q_ldsc.RData), and first 100 SNPs of sumstat output (Q_sumstat.RData).

Additionally, below is the model specification,

model <- 'F1 =~ NA*V3 + V4 + V5

F2 =~ NA*V8 + V9 

F3 =~ NA*V6 + V7 

F4 =~ NA*V1 + V2 

L =~ NA*F1 + F2 + F3 + F4 

V7 ~~ a*V7 

V5 ~~ b*V5 

a > 0.001 

b > 0.001 

L ~ SNP '


Thanks,

Austin

Q_sumstat.RData
L_50SNPs.RData
G122_Q_ldsc.RData

Austin Park

unread,
Jan 26, 2022, 7:37:09 AM1/26/22
to Genomic SEM Users
Hi,

Meanwhile, I encountered another type of error as below:

error calling combine function:
<simpleError in rbind(deparse.level, ...): numbers of columns of arguments do not match>
Error in order(results$i) : argument 1 is not a vector
Calls: userGWAS -> order
Execution halted

Can I get some help here?

Thanks,

Austin

agro...@gmail.com

unread,
Feb 7, 2022, 1:25:06 PM2/7/22
to Genomic SEM Users
Hi Austin, 

Apologies for late response on this. I'm unable to reproduce that most recent error you posted, but I'm assuming that must be from running a separate piece of code since you weren't getting it before? What specific code did you run for that one? 

For your first message, this error is oftentimes SNP specific, and oftentimes occurs when you estimating something with a really small effect. This can happen when you have a SNP that just has null effects across traits (or for instances when you are estimating residual covariances across traits with very little variance left over, but I don't think that's the culprit here). The fix is relatively easy, and involves setting the tolerance to some lower number using the toler argument. So you might write: 
Test<-userGWAS(covstruc=G122_Q_LDSCoutput,SNPs=Q_sumstat,model=model,toler=1e-50)

When I run this it will finish for all 100 SNPs that you sent along, but is still going to print warnings about the variance covariance matrix not being positive definite. If the model otherwise looks fine with respect to specification and point estimates, sometimes I would consider this safe to ignore. In this case, I have some concerns about the number of two-indicator factors you are specifying and issues with local identification. You could set equality constraints on those two-indicator factors (e.g., F1=~c*V1 + c*V2), but that seems to produce other warnings and errors. So with that said, I think this is a tricky model that is going to cause you a number of headaches as specified, and you might reconsider the structure you are specifying. 

Best, 
Andrew

qh...@wisc.edu

unread,
Feb 17, 2022, 3:13:40 PM2/17/22
to Genomic SEM Users
I am running into the same error about the combine function and ordering of results. The error message says: 

error calling combine function: <simpleError in rbind(deparse.level, ...): numbers of columns of arguments do not match> Error in order(results$i) : argument 1 is not a vector

The error occurs after running the userGWAS function:
userGWAS(covstruc = LDSCoutput_wsub, SNPs = p_sumstats_wsub_CHR1, estimation = "DWLS", model = cfa_wsub_4fmod_syn, printwarn = TRUE, sub=c("F1 ~ SNP","F2 ~ SNP","F3 ~ SNP","F4 ~ SNP"), core = 45, toler = FALSE, SNPSE = FALSE, parallel = TRUE,GC="standard",MPI=FALSE)

This is really quite interesting and confusing because I used the same code to run the same analyses for other chromosomes (Chromosome 2 - Chromosome 22), and I don't see this error. Seems like this error was only occurring for Chromosome 1 in our data. I also don't see this error if I run a small subset (1000 or 10,000 or 20,000) of the SNPs in Chromosome 1.
Wondering if others have run into similar things and if there are workarounds. Thanks!

Frank

DP Wightman

unread,
Feb 18, 2022, 7:47:43 AM2/18/22
to Genomic SEM Users
Hi all, 

I also get this error when using: 
commonfactorGWAS(covstruc=LDSCoutput, SNPs=tmp, estimation="DWLS", cores=NULL, toler=1e-20, SNPSE=FALSE, parallel=TRUE, GC="standard", MPI=FALSE, smooth_check=TRUE)
error calling combine function:
<simpleError in match.names(clabs, names(xi)): names do not match previous names>

Error in order(results$i) : argument 1 is not a vector
Calls: commonfactorGWAS -> order
Execution halted


but it works fine when parallel=FALSE.

I am guessing it is a problem when recombining the individual snps into a larger dataframe (line 225 commonfactorGWAS.R). Any ideas why the output of some snps would have different column names? Or how to overcome this error?

Cheers,
Doug

matthijs Z

unread,
Feb 23, 2022, 10:51:20 AM2/23/22
to Genomic SEM Users
Hi all,

I apologize for the late response and this major bug. The reason why this happened was different between commonfactor and userGWAS, which made it more confusing to fix.
The bug in userGWAS is fixed in the current live version (as far as I can tell, please let me know if it's not I'll be more active here from now on).
The bug in commonfactorGWAS should also be fixed (again, please let me know if it's not), though this was a less clean solution for now so you may see unnamed columns where you would have run into this error before. There will be a cleaner solution in version 0.0.5 which I'm hoping to release tommorow but is currently still being tested.

Best,
Matthijs

Op vrijdag 18 februari 2022 om 13:47:43 UTC+1 schreef d.p.wi...@vu.nl:

Austin Park

unread,
Mar 1, 2022, 7:28:02 PM3/1/22
to Genomic SEM Users
Hi Matthijs,

Thanks for the updates. I installed the latest version of Genomic SEM and ran userGWAS. But now I'm getting another error regarding unequal length of vectors.

 There were 24 warnings (use warnings() to see them)
 [1] "Please note that an update was made to userGWAS on 11/21/19 so that it combines addSNPs and userGWAS." 
[1] "Starting GWAS Estimation" 
Error in .userGWAS_main(i, n_phenotypes, n, I_LD, V_LD, S_LD, std.lv, : 
 task 1 failed - "'names' attribute [23] must be the same length as the vector [22]" 
Calls: userGWAS -> %dopar% -> <Anonymous> 
Execution halted  

Is there any solution to this?

Best,

Austin

Matthijs van der Zee

unread,
Mar 3, 2022, 3:16:48 AM3/3/22
to Genomic SEM Users
Hi Austin,

Thanks for getting back so quickly, that's a bug, N (chunk number) is not included in the output anymore but was still in the column names (I fear something went wrong in a push somewhere), regardless this should be fixed now. Apologies for the inconvenience!

Best,
Matthijs

Op woensdag 2 maart 2022 om 01:28:02 UTC+1 schreef Austin Park:

Austin Park

unread,
Mar 4, 2022, 12:07:17 AM3/4/22
to Genomic SEM Users
Hi Matthijs,

Thanks for a quick update. The problem with the size of vectors seems to be solved.

But I get another error as below. This error has appeared several times before, but I still didn't find a solution to tackle this.
I'll appreciate if you could suggest some idea.
What I know is that the error with singular appears if the inverse of a given matrix cannot be obtained.

I'm wondering where has this matrix come from and what can I do to resolve it.

I'm using 9 traits and have set the toler=1e-50.

  There were 24 warnings (use warnings() to see them) 
[1] "Please note that an update was made to userGWAS on 11/21/19 so that it combines addSNPs and userGWAS." 
[1] "Starting GWAS Estimation" 
Error in .userGWAS_main(i, n_phenotypes, n, I_LD, V_LD, S_LD, std.lv, : 
 task 2 failed - "Lapack routine dgesv: system is exactly singular: U[29,29] = 0" 
Calls: userGWAS -> %dopar% -> <Anonymous> 
Execution halted

Best,

Austin

DP Wightman

unread,
Mar 21, 2022, 2:02:40 PM3/21/22
to Genomic SEM Users
Hello, 

I updated to 66c1751 and parallel=TRUE works for me if I have more SNPs than I have threads available. If I try to run on only 10 SNPs then I get this error
task 1 failed - "infinite or missing values in 'x'" but it works fine if I run those 10 SNPs and additional 10 SNPs.

Cheers,
Doug

Matthijs van der Zee

unread,
Mar 22, 2022, 4:16:22 AM3/22/22
to Genomic SEM Users

Hi Doug,

Thanks for bringing this to my attention. This happens because when parallel is enabled the SNPs are split across all available (or specified) cores, running GenomicSEM with more cores than SNPs results in empty chunks which is what caused this error.
I've patched GenomicSEM such that it will now automatically decrease the number of cores if the number of provided SNPs is lower. Could you download the latest version to verify this fixed your issue?
I'm assuming you were using 10 SNPs for testing purposes (if so, disregard this note of course), but just to note, it is likely that when you run an analysis on very few (like <100) SNPs performance will be better with parallel=FALSE due to overhead induced by parallel R instances, though I haven't tested this explicitly.

Best,
Matthijs
Op maandag 21 maart 2022 om 19:02:40 UTC+1 schreef DP Wightman:
Reply all
Reply to author
Forward
0 new messages