biostat0903 / DBSLMM

Deterministic Bayesian Sparse Linear Mixed Model
https://biostat0903.github.io/DBSLMM/
5 stars 3 forks source link

Debugging Segmentation Fault in calcBlock function and Compiling a C++ Executable #9

Closed brycerowland closed 3 years ago

brycerowland commented 4 years ago

Good afternoon,

Are the scripts in the scr/ subdirectory the most up to date scripts for the executable dbslmm program? I have been trying to debug a Segmentation Fault bug in the calcBlock function in the dbslmmfit.cpp file after compiling the executable myself but can not seem to resolve the issue. I noticed that these scripts are several months older than the executable file. Are they the most up to date scripts?

Additionally, could you please supply a series of commands to compile the executable on our own for debugging purposes?

Best, Bryce

brycerowland commented 4 years ago

One additional piece of information, when I clone the repository and try to compile an executable with the following commands from the scr directory, I am unable to generate an executable.

g++ -c main_dbslmm.cpp -I ~/bin/armadillo-9.880.1/include/ -DARMA_DONT_USE_WRAPPER -lblas -llapack g++ -c dbslmm.cpp -I ~/bin/armadillo-9.880.1/include/ -DARMA_DONT_USE_WRAPPER -lblas -llapack dbslmm.cpp: In member function ‘void DBSLMM::BatchRun(PARAM&)’: dbslmm.cpp:240:29: error: variable-sized object ‘badsnp_s’ may not be initialized bool badsnp_s[n_s] = {false}; ^ dbslmm.cpp:251:29: error: variable-sized object ‘badsnp_l’ may not be initialized bool badsnp_l[n_l] = {false}; ^

I am able to iterate through a series of bug fixes to get a compiled executable file, but fear that I'm changing an essential piece of the code in doing so. Thanks for your help.

biostat0903 commented 4 years ago

Hi, Thanks for your attention to our method. You can compile it like:

g++ -c dtpr.cpp -std=c++11
g++ -c dbslmm.cpp -std=c++11
g++ -c dbslmmfit.cpp -std=c++11 -O2 -larmadillo -fopenmp -llapacke -llapack -lblas -lm -Wall
ar -r libdbslmm.a dtpr.o dbslmm.o dbslmmfit.o
g++ main_dbslmm.cpp libdbslmm.a -o dbslmm -O2 -larmadillo -fopenmp -llapacke -llapack -lblas -lm -Wall

If there is any problem, please feel free to tell me. Best, Sheng

brycerowland commented 4 years ago

Hi Sheng,

Thanks for your quick response. I also had to add the gfortran library to the 5th g++ command to successfully compile. Could you add the above commands to the installation instructions?

Best, Bryce

biostat0903 commented 4 years ago

Hi Bryce, Thanks for your suggestion. I have uploaded the Makefile file to scr folder. I hope it helps you compile the dbslmm. Best, Sheng

brycerowland commented 4 years ago

Great! This is definitely helpful in compiling the code and adding the additional cpp libraries that I need to run the code. Thanks, Sheng!

brycerowland commented 4 years ago

Hi Sheng,

Could you also provide a similar statement compiling valid?

Best, Bryce

biostat0903 commented 4 years ago

Hi Bryce, I am so sorry for the late reply. I will provide the makefile for valid.

Best, Sheng

ChongWu-Biostat commented 3 years ago

I also have the Segmentation Fault error by using both the static version and the version complied by the commands provided in this thread? Is there any thoughts on how to solve this problem?

biostat0903 commented 3 years ago

Hi, Thanks for your attention! I will update the external function using R. The new version will be finished in tomorrow. Best, Sheng

ChongWu-Biostat commented 3 years ago

Thank you so much!

Thanks, Chong

Chong Wu Assistant Professor Department of Statistics Florida State University

On Jan 5, 2021, at 10:28 PM, Sheng Yang notifications@github.com<mailto:notifications@github.com> wrote:

Hi, Thanks for your attention! I will update the external function using R. The new version will be finished in tomorrow. Best, Sheng

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/biostat0903/DBSLMM/issues/9*issuecomment-755054028__;Iw!!PhOWcWs!gzBZ-PEN93RqnrbzWQGp4fZ5Sx_VHaAezARKywwRErGzod0ZwuldLulibObGgA$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ACCTNPJS26HLIB3APLCBYUTSYPKEZANCNFSM4NP662GA__;!!PhOWcWs!gzBZ-PEN93RqnrbzWQGp4fZ5Sx_VHaAezARKywwRErGzod0ZwuldLulf1ZU_LQ$.

biostat0903 commented 3 years ago

Hi, We have updated the new version of external test, including software/MAKELD.R and software/EXTERNAL.R. The tutorial has also been updated in ReadME.md. If there is any problem, please feel free to contact me. Thanks for you attention to DBSLMM. Best, Sheng

ChongWu-Biostat commented 3 years ago

Hi Sheng,

I met the error when running the following command: Rscript ${DBSLMM} --summary ${summf}${chr}.assoc.txt --outPath ${outPath} --plink ${plink} --dbslmm ${dbslmm} --ref ${ref}${chr} --n ${n} --nsnp ${m} --block ${blockf}${chr}.bed --h2 0.5

It relates to the core function dbslmm at the very last few lines. The error is Segmentation Fault error. Can you help me to figure this out?

biostat0903 commented 3 years ago

Hi Chong, Thanks for you attention! I have update the DBSLMM.R code. After running my example data, I do not meet your error. Please check whether you use the tab to separate each column of summary statistics. If you also meet the error, you can send me your data to the e-mail address: biostat0903@163.com. Best, Sheng

ChongWu-Biostat commented 3 years ago

Hi Sheng,

Do we need to use “ “ (tab) to separate each column?

Thanks, Chong

On Jan 7, 2021, at 9:03 PM, Sheng Yang notifications@github.com<mailto:notifications@github.com> wrote:

Hi Chong, Thanks for you attention! I have update the DBSLMM.R code. After running my example data, I do not meet your error. Please check whether you use the tab to separate each column of summary statistics. If you also meet the error, you can send me your data to the e-mail address: biostat0903@163.commailto:biostat0903@163.com. Best, Sheng

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/biostat0903/DBSLMM/issues/9*issuecomment-756499113__;Iw!!PhOWcWs!j75RKy1p1VxE30raMKyS5OltO6rtukvZPtUjILwupeVizfk4zPknQEHOnoOGKA$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ACCTNPJIGX457SUP735V5BLSYZRVTANCNFSM4NP662GA__;!!PhOWcWs!j75RKy1p1VxE30raMKyS5OltO6rtukvZPtUjILwupeVizfk4zPknQEH0ZuRusQ$.

biostat0903 commented 3 years ago

Hi Chong, Sure. The format of DBSLMM summary statistics is the same as that of GEMMA . Thanks! Best, Sheng

biostat0903 commented 3 years ago

Hi Chong, Can the default version of DBSLMM work? Best, Sheng

ChongWu-Biostat commented 3 years ago

No, it does not work and has the same bug. I create the GEMMA format by the following R codes:

colnames(dat2) = c("chr","rs","ps","n_mis","n_obs","allele1","allele0","af","beta","se","p_wald")

inputfile = paste(out_dir,"summary_gemma_chr",chr.id,".assoc.txt",sep="") write.table(dat2,file = inputfile,col.names=TRUE,row.names=FALSE,quote=FALSE,sep=" ")

Does the DBSLMM really uses n_mis and n_obs column? If the summary data do not provide these two columns, can we assign n_mis = 0 and n_obs = the sample size?

biostat0903 commented 3 years ago

Hi Chong, DBSLMM does not use the n_miss. You can use the n_obs=the sample size and n_miss=0. The output code is: inputfile = paste(out_dir,"summary_gemma_chr",chr.id,".assoc.txt",sep="\t") Best, Sheng

biostat0903 commented 3 years ago

Hi Chong, The problem is ok? Best, Sheng

ChongWu-Biostat commented 3 years ago

It works now. Thank you so much! I think my bug is the summary data have not been read in properly. Once we use sep=“\t”, it works.

Thanks, Chong

On Jan 14, 2021, at 8:02 AM, Sheng Yang notifications@github.com<mailto:notifications@github.com> wrote:

Hi Chong, The problem is ok? Best, Sheng

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/biostat0903/DBSLMM/issues/9*issuecomment-760183070__;Iw!!PhOWcWs!gUcvqRiKLYVP6IPcnQ77Wvg1QGmxyzyYlqs2NMhzqqPquSBpHTHb_0_iO3fElg$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ACCTNPMLKORFWBSLIYHSKRDSZ3TPNANCNFSM4NP662GA__;!!PhOWcWs!gUcvqRiKLYVP6IPcnQ77Wvg1QGmxyzyYlqs2NMhzqqPquSBpHTHb_0-G6rtZaw$.