chr1swallace / coloc

Repo for the R package coloc
138 stars 44 forks source link

length of snp vector should be 1 less than ncol(res$lbf_variable) #127

Open shannjiang opened 11 months ago

shannjiang commented 11 months ago

Hi,

I bumped to this error when running susie on the attached test data:

** Examples

library(coloc) data(coloc_test_data) result=runsusie(coloc_test_data$D1) running max iterations: 100 converged: TRUE Error in annotate_susie(res, snp): length of snp vector should be 1 less than ncol(res$lbf_variable) summary(result) Error in summary(result): object 'result' not found

What is the ncol(res$lbf_variable) which should be greater than the length of snp vector specifically?

Thanks, Shan

chr1swallace commented 10 months ago

can you please download the latest version from github? This issue should be fixed.

shannjiang commented 10 months ago

Hi @chr1swallace ,

Thanks for figuring that out. After I successfully run the command runsusie(), the command summary(result) didn't show anything informative:

result=runsusie(coloc_test_data$D1) running max iterations: 100 converged: TRUE > summary(result) Mode FALSE logical 1

And also if I run the runsusie() on the D3 in the test data I got the error 'LD' object not found:

result=runsusie(coloc_test_data$D3) running max iterations: 100 converged: TRUE Error in .susie_setld(res$sets$cs, LD) : object 'LD' not found

But I checked the structure of D3, LD is there:

str(coloc_test_data$D3) List of 9 $ beta : num [1:500] 0.343 0.502 0.541 0.233 0.536 ... $ varbeta : num [1:500] 0.02321 0.0073 0.00991 0.0205 0.00875 ... $ N : int 1000 $ sdY : num 1.31 $ type : chr "quant" $ MAF : num [1:500] 0.0405 0.149 0.0955 0.0485 0.11 0.073 0.0795 0.038 0.234 0.131 ... $ LD : num [1:500, 1:500] 1 0.456 0.611 0.906 0.559 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:500] "s1" "s2" "s3" "s4" ... .. ..$ : chr [1:500] "s1" "s2" "s3" "s4" ... $ snp : chr [1:500] "s1" "s2" "s3" "s4" ... $ position: int [1:500] 1 2 3 4 5 6 7 8 9 10 ...

And I tested on my own data which also prompted me 'LD' object not found but I am sure it's in my data.

Thanks,

Shan

chr1swallace commented 10 months ago

It's not your data, sorry. I moved some code to help a user with a specific request and silently broke something. Now fixed. Could I ask you to download afresh from GitHub?

-- https://chr1swallace.github.io


From: shannjiang @.> Sent: Tuesday, August 22, 2023 6:17:31 PM To: chr1swallace/coloc @.> Cc: Chris Wallace @.>; Mention @.> Subject: Re: [chr1swallace/coloc] length of snp vector should be 1 less than ncol(res$lbf_variable) (Issue #127)

Hi @chr1swallacehttps://github.com/chr1swallace ,

Thanks for figuring that out. After I successfully run the command runsusie(), the command summary(result) didn't show anything informative:

result=runsusie(coloc_test_data$D1) running max iterations: 100 converged: TRUE

summary(result) Mode FALSE logical 1

And also if I run the runsusie() on the D3 in the test data I got the error 'LD' object not found:

result=runsusie(coloc_test_data$D3) running max iterations: 100 converged: TRUE Error in .susie_setld(res$sets$cs, LD) : object 'LD' not found

But I checked the structure of D3, LD is there:

str(coloc_test_data$D3) List of 9 $ beta : num [1:500] 0.343 0.502 0.541 0.233 0.536 ... $ varbeta : num [1:500] 0.02321 0.0073 0.00991 0.0205 0.00875 ... $ N : int 1000 $ sdY : num 1.31 $ type : chr "quant" $ MAF : num [1:500] 0.0405 0.149 0.0955 0.0485 0.11 0.073 0.0795 0.038 0.234 0.131 ... $ LD : num [1:500, 1:500] 1 0.456 0.611 0.906 0.559 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:500] "s1" "s2" "s3" "s4" ... .. ..$ : chr [1:500] "s1" "s2" "s3" "s4" ... $ snp : chr [1:500] "s1" "s2" "s3" "s4" ... $ position: int [1:500] 1 2 3 4 5 6 7 8 9 10 ...

And I tested on my own data which also prompted me 'LD' object not found but I am sure it's in my data.

Thanks,

Shan

— Reply to this email directly, view it on GitHubhttps://github.com/chr1swallace/coloc/issues/127#issuecomment-1688610575, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQWR2AO2GLEWRF3PRVWBC3XWTSSXANCNFSM6AAAAAA3ACDFVE. You are receiving this because you were mentioned.Message ID: @.***>

shannjiang commented 10 months ago

@chr1swallace the aboved mentioned information is what I updated coloc:

library(coloc) This is coloc version 5.2.3 data(coloc_test_data) result=runsusie(coloc_test_data$D1) running max iterations: 100 converged: TRUE > summary(result) Mode FALSE logical 1 result=runsusie(coloc_test_data$D3) running max iterations: 100 converged: TRUE Error in .susie_setld(res$sets$cs, LD) : object 'LD' not found

chr1swallace commented 10 months ago

so sorry, I failed to push the change to github. try again?

-- https://chr1swallace.github.iohttps://chr1swallace.github.io/


From: shannjiang @.> Sent: Tuesday, August 22, 2023 7:02 PM To: chr1swallace/coloc @.> Cc: Chris Wallace @.>; Mention @.> Subject: Re: [chr1swallace/coloc] length of snp vector should be 1 less than ncol(res$lbf_variable) (Issue #127)

@chr1swallacehttps://github.com/chr1swallace the aboved mentioned information is what I updated coloc:

library(coloc) This is coloc version 5.2.3 data(coloc_test_data) result=runsusie(coloc_test_data$D1) running max iterations: 100 converged: TRUE

summary(result) Mode FALSE logical 1 result=runsusie(coloc_test_data$D3) running max iterations: 100 converged: TRUE Error in .susie_setld(res$sets$cs, LD) : object 'LD' not found

— Reply to this email directly, view it on GitHubhttps://github.com/chr1swallace/coloc/issues/127#issuecomment-1688669860, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQWR2HC3JEMPYO5YZYLMJDXWTX3VANCNFSM6AAAAAA3ACDFVE. You are receiving this because you were mentioned.Message ID: @.***>

shannjiang commented 10 months ago

Hi @chr1swallace,

Thank you so much! It's working now.

Best, Shan