WGLab / PennCNV

Copy number vaiation detection from SNP arrays
http://penncnv.openbioinformatics.org
Other
88 stars 53 forks source link

detect_cnv.pl resulting in "Segmentation fault: 11" #7

Closed romanhaa closed 7 years ago

romanhaa commented 8 years ago

Just installed PennCNV 1.0.3 on my system (OSX 10.11.5, perl 5.14.2). Functions can be called without a problem, but when calling detect_cnv.pl, I receive a "Segmentation fault: 11" error. I heard that it might be a memory problem, but there seem to be many possible causes.

I installed perl 5.14.2 into a custom folder (only 1 test out of ~2000 failed) and linked it to my PATH. Then I made the suggested changes to Makefile, compiled and also added the PennCNV folder to PATH.

Any idea what this could be?

In a virtual machine running Linux Mint and perl 5.14.2, I had a similar problem. I could call detect_cnv.pl, but after: WARNING: Sample from /home/VM/Downloads/gw6.1_tumor does not pass default quality control criteria due to its large SD for LRR (0.473134003738753)! WARNING: Sample from /home/VM/Downloads/gw6.2_tumor does not pass default quality control criteria due to its drifting BAF values (drift=0.0067873951858485)! WARNING: Sample from /home/VM/Downloads/gw6.3_tumor does not pass default quality control criteria due to its waviness factor values (wf=-0.0841)! WARNING: Small-sized CNV calls may not be reliable and should be interpreted with caution! Segmentation fault

mpj5142 commented 8 years ago

I had a similar issue as well. Using Perl 5.8.7 (downloaded through Perlbrew) did the trick.

kaichop commented 8 years ago

romanhaa, please try use a different version of Perl and see if it helps.

romanhaa commented 8 years ago

Thank you both for your answers. As suggested by mpj5142 I used perlbrew to install perl 5.8.7, but it again results in the same error.

Also, I tried multiple Linux VMs, with different perl versions, installed with or without perlbrew. The furthest I got was being able to call and run detect_cnv.pl in a Linux Mint VM running perl-5.8.9, but after some warning messages (last one: 'WARNING: Small-sized CNV calls may not be reliable and should be interpreted with caution!') it says "Segmentation fault".

It's really sad because I have lots of data that I would love to analyze using PennCNV. It seems that many other people either had or still have this issue, so I was thinking a VM file or Docker image with a running setup would be very helpful. Perhaps someone has this already?

kaichop commented 8 years ago

When using VM, have you checked your memory size? Are there sufficient memory (for example 4Gb for a typical array). Which VM platform are you using? One additional issue may be the version of GCC when compiling PennCNV. The compatibility for new GCC with old code is not very well. Do you see any error/warning message when running 'make' during your compilation?

On Thu, Jul 28, 2016 at 4:58 AM, romanhaa notifications@github.com wrote:

Thank you both for your answers. As suggested by mpj5142 I used perlbrew to install perl 5.8.7, but it again results in the same error.

Also, I tried multiple Linux VMs, with different perl versions, installed with or without perlbrew. The furthest I got was being able to call and run detect_cnv.pl in a Linux Mint VM running perl-5.8.9, but after some warning messages (last one: 'WARNING: Small-sized CNV calls may not be reliable and should be interpreted with caution!') it says "Segmentation fault".

It's really sad because I have lots of data that I would love to analyze using PennCNV. It seems that many other people either had or still have this issue, so I was thinking a VM file or Docker image with a running setup would be very helpful. Perhaps someone has this already?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WGLab/PennCNV/issues/7#issuecomment-235839030, or mute the thread https://github.com/notifications/unsubscribe-auth/AFptuCeTUlzyb8U4X_9kyCJSsuhmvAaqks5qaG9IgaJpZM4JNYNk .

kaichop commented 8 years ago

By the way, if you are using one of the several perl versions that I already provide *.so file, and if you are using a standard perl (x86_64, multithreaded) then you should be able to directly run PennCNV. For example, you will need 5.8.8, not 5.8.9 or 5.8.7.

On Thu, Jul 28, 2016 at 8:25 AM, Kai Wang kaichop@gmail.com wrote:

When using VM, have you checked your memory size? Are there sufficient memory (for example 4Gb for a typical array). Which VM platform are you using? One additional issue may be the version of GCC when compiling PennCNV. The compatibility for new GCC with old code is not very well. Do you see any error/warning message when running 'make' during your compilation?

On Thu, Jul 28, 2016 at 4:58 AM, romanhaa notifications@github.com wrote:

Thank you both for your answers. As suggested by mpj5142 I used perlbrew to install perl 5.8.7, but it again results in the same error.

Also, I tried multiple Linux VMs, with different perl versions, installed with or without perlbrew. The furthest I got was being able to call and run detect_cnv.pl in a Linux Mint VM running perl-5.8.9, but after some warning messages (last one: 'WARNING: Small-sized CNV calls may not be reliable and should be interpreted with caution!') it says "Segmentation fault".

It's really sad because I have lots of data that I would love to analyze using PennCNV. It seems that many other people either had or still have this issue, so I was thinking a VM file or Docker image with a running setup would be very helpful. Perhaps someone has this already?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WGLab/PennCNV/issues/7#issuecomment-235839030, or mute the thread https://github.com/notifications/unsubscribe-auth/AFptuCeTUlzyb8U4X_9kyCJSsuhmvAaqks5qaG9IgaJpZM4JNYNk .

romanhaa commented 8 years ago

I always gave the machines ~16GB of RAM which I think should be more than enough :) But yes, when compiling the PennCNV it often gave me an error message, but I'm not very proficient in working with perl so I can't tell for sure.

But when I look at the several perl folders in /kext, there is only a khmm.dll file for Windows for version 5.8.8. For version 5.14.2 however, there are pre-compiled versions for Linux and OSX (which I have tried using). Am I missing files?

kaichop commented 8 years ago

Okay I see. Please try 5.14.2 then. I do not have a copy of the 5.8.8 so files now.

On Thu, Jul 28, 2016 at 8:36 AM, romanhaa notifications@github.com wrote:

I always gave the machines ~16GB of RAM which I think should be more than enough :) But yes, when compiling the PennCNV it often gave me an error message, but I'm not very proficient in working with perl so I can't tell for sure.

But when I look at the several perl folders in /kext, there is only a khmm.dll file for Windows for version 5.8.8. For version 5.14.2 however, there are pre-compiled versions for Linux and OSX (which I have tried using). Am I missing files?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WGLab/PennCNV/issues/7#issuecomment-235881756, or mute the thread https://github.com/notifications/unsubscribe-auth/AFptuNbMDLOyvaeLG9QA18PFkCH2608dks5qaKJPgaJpZM4JNYNk .

romanhaa commented 8 years ago

Perl 5.14.2 is what I used when describing the case in my original post :D I tried again to make sure nothing has changed, but it persists: 1) In OSX with 5.14.2, I get the "Segmentation fault" simply by calling detect_cnv.pl (without parameters) 2) In Linux Mint with 5.14.2, without parameters is fine, but when running actual data, I see the errors posted before: WARNING: Sample from /home/VM/Downloads/gw6.1_tumor does not pass default quality control criteria due to its large SD for LRR (0.473134003738753)! WARNING: Sample from /home/VM/Downloads/gw6.2_tumor does not pass default quality control criteria due to its drifting BAF values (drift=0.0067873951858485)! WARNING: Sample from /home/VM/Downloads/gw6.3_tumor does not pass default quality control criteria due to its waviness factor values (wf=-0.0841)! WARNING: Small-sized CNV calls may not be reliable and should be interpreted with caution! Segmentation fault

gcc version in linux is 5.3.1

kaichop commented 8 years ago

If you use 5.14.2 in a typical Linux machine (except ubuntu), you do not need to compile and can directly use the *.so files. But for OS X, then you need compile and version does not matter. GCC5 is too new and this is probably the reason for the failure in compilation.

On Thu, Jul 28, 2016 at 9:03 AM, romanhaa notifications@github.com wrote:

Perl 5.14.2 is what I used when describing the case in my original post :D I tried again to make sure nothing has changed, but it persists: 1) In OSX with 5.14.2, I get the "Segmentation fault" simply by calling detect_cnv.pl (without parameters) 2) In Linux Mint with 5.14.2, without parameters is fine, but when running actual data, I see the errors posted before: WARNING: Sample from /home/VM/Downloads/gw6.1_tumor does not pass default quality control criteria due to its large SD for LRR (0.473134003738753)! WARNING: Sample from /home/VM/Downloads/gw6.2_tumor does not pass default quality control criteria due to its drifting BAF values (drift=0.0067873951858485)! WARNING: Sample from /home/VM/Downloads/gw6.3_tumor does not pass default quality control criteria due to its waviness factor values (wf=-0.0841)! WARNING: Small-sized CNV calls may not be reliable and should be interpreted with caution! Segmentation fault

gcc version in linux is 5.3.1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WGLab/PennCNV/issues/7#issuecomment-235888141, or mute the thread https://github.com/notifications/unsubscribe-auth/AFptuCEZbaus9lL3fFGYDSYkL_1seb50ks5qaKi-gaJpZM4JNYNk .

mpj5142 commented 8 years ago

I looked back at what I had used when I installed Perl 5.8.7 with Perlbrew as I had a tough go to get this to work too. I had to add the " -D useshrplib " when installing the brew:

perlbrew install --notest perl-5.8.7 --thread --multi -D useshrplib

My system is a Debian x86-64 with gcc 4.9.2.

romanhaa commented 8 years ago

Indeed, with the command posted by mpj5142 I can install perl without any errors (in OSX). Then I made the respective changes to Makefile and tried compiling, but this is what I get:

gcc -dynamiclib -o khmm.dylib khmm_wrap.o khmm.o kc.o khmmDev.o 'perl -MExtUtils::Embed -e ldopts'
Undefined symbols for architecture x86_64:
  "_Perl_gv_add_by_type", referenced from:
      _SWIG_Perl_MakePtr in khmm_wrap.o
      _SWIG_Perl_ConvertPtrAndOwn in khmm_wrap.o
      _perl2C_vector in kc.o
      _perl2C_vectori in kc.o
      _perl2C_matrix in kc.o
      _perl2C_matrixi in kc.o
      _pack1D in kc.o
      ...
  "_Perl_sv_2bool_flags", referenced from:
      __wrap_estHMMFromFile_CHMM in khmm_wrap.o
      __wrap_testVit_CHMM in khmm_wrap.o
      __wrap_GetStateProb_CHMM in khmm_wrap.o
      __wrap_testVitTrio_CHMM in khmm_wrap.o
      __wrap_reg_linear in khmm_wrap.o
  "_Perl_sv_2nv_flags", referenced from:
      __wrap_estHMMFromFile_CHMM in khmm_wrap.o
      __wrap_testVit_CHMM in khmm_wrap.o
      __wrap_GetStateProb_CHMM in khmm_wrap.o
      _SWIG_AsVal_double in khmm_wrap.o
      __wrap_testVitTrio_CHMM in khmm_wrap.o
      __wrap_reg_linear in khmm_wrap.o
      _perl2C_vector in kc.o
      ...
  "_Perl_sv_free2", referenced from:
      _SWIG_Perl_MakePtr in khmm_wrap.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [khmm.dylib] Error 1

Can one of you make sense of that?

mpj5142 commented 8 years ago

That looks like an issue with clang, which is what OS X uses instead of gcc. You can use homebrew to install a proper version of gcc:

brew install gcc49

and then update your path to the gcc4.9 files (typically in /usr/local/bin).

Speaking of which, once everything was compiled for me, I needed to also update the path for Perl in the detect_cnv.pl file to the Perlbrew version of the script:

#!/PATH_TO_PERLBREW_DIRECTORY/perl5/perls/perl-5.8.9/bin/perl

romanhaa commented 8 years ago

Ok, I got gcc49 installed and it is indeed in /usr/local/bin. Am I wrong to assume that I need to make some changes to Makefile now? I tried changing

CC = gcc
LD = gcc

to

CC = gcc-4.9
LD = gcc-4.9

With these changes and perl-5.8.9 I get this error:

gcc-4.9 -dynamiclib -o khmm.dylib khmm_wrap.o khmm.o kc.o khmmDev.o `perl -MExtUtils::Embed -e ldopts`
Undefined symbols for architecture x86_64:
  "_Perl_gv_add_by_type", referenced from:
      _SWIG_Perl_MakePtr in khmm_wrap.o
      _SWIG_Perl_ConvertPtrAndOwn in khmm_wrap.o
      _perl2C_vector in kc.o
      _perl2C_vectori in kc.o
      _perl2C_matrix in kc.o
      _perl2C_matrixi in kc.o
      _pack1D in kc.o
      ...
  "_Perl_sv_2bool_flags", referenced from:
      __wrap_estHMMFromFile_CHMM in khmm_wrap.o
      __wrap_testVit_CHMM in khmm_wrap.o
      __wrap_GetStateProb_CHMM in khmm_wrap.o
      __wrap_testVitTrio_CHMM in khmm_wrap.o
      __wrap_reg_linear in khmm_wrap.o
  "_Perl_sv_2nv_flags", referenced from:
      __wrap_estHMMFromFile_CHMM in khmm_wrap.o
      __wrap_testVit_CHMM in khmm_wrap.o
      __wrap_GetStateProb_CHMM in khmm_wrap.o
      _SWIG_AsVal_double in khmm_wrap.o
      __wrap_testVitTrio_CHMM in khmm_wrap.o
      __wrap_reg_linear in khmm_wrap.o
      _perl2C_vector in kc.o
      ...
  "_Perl_sv_free2", referenced from:
      _SWIG_Perl_MakePtr in khmm_wrap.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [khmm.dylib] Error 1

With the same changes but perl-5.14.2 everything seems fine, this is what make returns:

gcc-4.9 -dynamiclib -o khmm.dylib khmm_wrap.o khmm.o kc.o khmmDev.o `perl -MExtUtils::Embed -e ldopts`
mkdir -p `perl -MConfig -e 'print $Config{version}'`
mkdir -p `perl -MConfig -e 'print $Config{version}'`/`perl -MConfig -e 'print $Config{archname}'`/
mkdir -p `perl -MConfig -e 'print $Config{version}'`/`perl -MConfig -e 'print $Config{archname}'`/auto/
mv khmm.dylib `perl -MConfig -e 'print $Config{version}'`/`perl -MConfig -e 'print $Config{archname}'`/

So then I also changed the perl path in the detect_cnv.pl script, but still...

Segmentation fault: 11

Everything done in OSX.

romanhaa commented 8 years ago

Update: It seems to work now in perl 5.8.9.

Turns out I forgot to 'make clean'. So now I was able to successfully compile PennCNV on OSX with perl 5.8.7, 5.8.9, and 5.14.2. Even though I didn't get any errors for either of them, only 5.8.9 runs detect_cnv.pl without an issue. But hey, it works :)

Thank you so much for the help guys! More discussion about this topic is obviously welcome. But coming back to my original idea, what do you guys think about a docker image? This would make it very easy for many people.

kaichop commented 8 years ago

Thank you for the update. If I understand it correctly, the combination of gcc4 plus perl 5.8.9 make it work?

In addition, did you make sure to list the correct perl in the PATH. For example, when you run gcc, the "perl -MExtUtils::Embed -e ldopts" will be used to infer header files for the perl, so the correct perl path must be in front of other perl versions in PATH before you do compilation. Same for running penncnv.

It is a great idea to make a docker image. There are some complaints in recent two years that penncnv no longer works in newer version of Linux (probably a result of gcc+perl version). I will try to address this soon.

On Fri, Jul 29, 2016 at 7:57 AM, romanhaa notifications@github.com wrote:

Update: It seems to work now in perl 5.8.9.

Turns out I forgot to 'make clean'. So now I was able to successfully compile PennCNV on OSX with perl 5.8.7, 5.8.9, and 5.14.2. Even though I didn't get any errors for either of them, only 5.8.9 runs detect_cnv.pl without an issue. But hey, it works :)

Thank you so much for the help guys! More discussion about this topic is obviously welcome. But coming back to my original idea, what do you guys think about a docker image? This would make it very easy for many people.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/WGLab/PennCNV/issues/7#issuecomment-236162323, or mute the thread https://github.com/notifications/unsubscribe-auth/AFptuGITEuFFo-DMw83g96b55JF9k-DCks5qaeqbgaJpZM4JNYNk .

romanhaa commented 8 years ago

Correct, it worked after using perl 5.8.9 and gcc4.9. I also added perl 5.8.9 to my PATH to make sure it's being used by gcc :)

Sabryr commented 6 years ago

Version 1.0.4 gives the Segmentation fault for khmm.so, tried with Perl 5.8.9 and gcc4.9 on CentOS 6.8. No luck (tried few other combinations as well). I am installing this on our cluster to be used by the University researchers and this has wasted a lot of my time.

kaichop commented 6 years ago

Sabryr, if you email me the exact issue (warning/error message) I can see whether I can give some more suggestions. I cannot tell from your description what is wrong. As I mentioned before, if you have a default perl 5.8.9 multithreaded installation, most likely you should not need to "make" and can directly use *.so files, so gcc version does not matter.

Manuelaio commented 6 years ago

I’ m trying to install on MacOs 10.12.6 (16G1408) PennCNV-1.0.3 e I’m following this recommendation: 1)Install compatible version with perlbrew:

wget -O - http://install.perlbrew.pl | bash source ~/perl5/perlbrew/etc/bashrc perlbrew install perl-5.8.8 cd /home/yourhomename/perl5/perlbrew/build/perl-5.8.8; make install source ~/perl5/perlbrew/etc/bashrc # loads perlbrew perlbrew use perl-5.8.8

I went in kext and I modified Makefile :

CC = gcc-4.9 LD= gcc-4.9 And I modified -shared with dynamiclib and -hmm.so with hmm.dylib I have gived make clean and make: gcc-4.9 perl -MExtUtils::Embed -e ccopts -fPIC -c -o khmm_wrap.o khmm_wrap.c gcc-4.9 perl -MExtUtils::Embed -e ccopts -fPIC -c -o khmm.o khmm.c gcc-4.9 perl -MExtUtils::Embed -e ccopts -fPIC -c -o kc.o kc.c gcc-4.9 perl -MExtUtils::Embed -e ccopts -fPIC -c -o khmmDev.o khmmDev.c gcc-4.9 -dynamiclib -o khmm.dylib khmm_wrap.o khmm.o kc.o khmmDev.o perl -MExtUtils::Embed -e ldopts mkdir -p perl -MConfig -e 'print $Config{version}' mkdir -p perl -MConfig -e 'print $Config{version}'/perl -MConfig -e 'print $Config{archname}'/ mkdir -p perl -MConfig -e 'print $Config{version}'/perl -MConfig -e 'print $Config{archname}'/auto/ mv khmm.dylib perl -MConfig -e 'print $Config{version}'/perl -MConfig -e 'print $Config{archname}'/

Even I modified #!/usr/bin/perl with /Users/../perl5/perlbrew/perls/perl-5.8.8/bin/perl in detect_cnv.pl

Finally I tryed to run:

Path/perl /path/to/pennCNV/detect_cnv.pl

But the following command don’t work and return this message Segmentation fault: 11

Could you help me to understand this problem ?