Error running smartpca from eigensoft
3
1
Entering edit mode
6.3 years ago
scho249 ▴ 30

Hi,

I have encountered an error trying to run smartpca from eigensoft.

I have converted ped file of my SNPs to eigensoft file format using fcgene and entered the following command line

to run smartpca:

perl ./bin/smartpca.perl -i out_eigensoft.ped -a out_eigensoft.pedsnp -b out_eigensoft.pedind -m 0 -o out.pca -p out.plot -l out.log -e out.eval

When I ran it, it gives an error claiming that:

OOPS couldn't open file out.pca.evec for reading at ./bin/smartpca.perl line 65.

All the files are in the bin folder, so I believe this is not the path problem...

I have been stuck for days now. Could someone help me please?

Shane

SNP software error • 9.3k views
1
Entering edit mode

Could you paste the whole content of "out.log" to pastebin.com or here, if it's not too big? smartpca.perl runs several steps internally and I believe one of them dies, an early step creates out.pca.evec and a later step depends on out.pca.evec and doesn't find it

0
Entering edit mode

Hi Philipp,

Thanks and sorry for the late reply.

There isn't any output in the out.log file but only in out.pca.par file and this is the content it output:

genotypename: /gpfs1m/projects/landcare00051/eigensoft/dart/all/out_eigensoft.ped
snpname: /gpfs1m/projects/landcare00051/eigensoft/dart/all/out_eigensoft.pedsnp
indivname: /gpfs1m/projects/landcare00051/eigensoft/dart/all/out_eigensoft.pedind
evecoutname: /gpfs1m/projects/landcare00051/eigensoft/dart/all/pca/out.pca.evec
evaloutname: /gpfs1m/projects/landcare00051/eigensoft/dart/all/pca/out.eval
altnormstyle: NO
numoutevec: 10
numoutlieriter: 0
numoutlierevec: 10
outliersigmathresh: 6
qtmode: 0


I have set the PATH variable as well, so I was thinking it shouldn't have any problem locating the binaries....

1
Entering edit mode

Have you tried using smartPCA.perl with the example data provided in the archive (run perl example.perl in the EIGENSTRAT folder)? That way you'll at least know that PATH is correctly set up

If it works, you may run the steps that smartpca.perl runs manually, these are the steps it runs:

smartpca -p your_par_file
ploteig -i your_evec_file -c 1:2 -p your_populations -x -y -o your_plot_file
evec2pca.perl your_principal_components_number(10) your_evec_file your_individuals_file your_pca_file

1
Entering edit mode

Hi Philipp,

Thank you so much for your advice. The example wasn't running as well and it turns out that the binary file 'smartpca' was not executable. So I used 'sudo chmod ug+x' and now it works fine.

Again thank you so much for your help!

Shane

1
Entering edit mode

Hi, everyone.

I've been stuck in an error for smartpca which is similar to the one described here. I do get the message:

OOPS couldn't open file out.pca.evec for reading at ./bin/smartpca.perl line 65


But, also, I get the following message:

sh: smartpca: command not found


I'm running the exact same code Shane was (except I'm using geno type files, not ped). I guess this error has something to do with what Shane mentioned about setting the PATH variable and this not being the "path" problem... I think mine is exactly the path problem... When I check the README files for the program, there is the sentence "For this to work, the bin directory containing smartpca MUST be in your path.", and the same advise is inside the perl script. However, I really didn't understand what this means. Should I move some files from the bin folder in eigensoft to the bin folder of my local user?

Thank you.
Rilquer

0
Entering edit mode

I have the exact same problem. I also set the bin folder into my $PATH but that didn't help. ADD REPLY 0 Entering edit mode Opening a new question may help , but let's try here: what is the output of echo$PATH


does the list contain the folder that has smartpca? You may have to run 'export PATH' once

0
Entering edit mode

I searched and there're one or two exact same questions on biostars as well without any answers. I checked my $PATH and the smartpca bin folder is in my$PATH, and it still doesn't work. So I've come up with a barbarian way to do it (answered below) and now it is running.

0
Entering edit mode

I am getting same error below. Sorry did not paste code cleanrly it but this platform isn't inputting correctly. I added both the bin folder and the eigensrc folder with the smartpca.c file and it still does not work.

EIGENSTRAT$perl example.perl smartpca.perl -i example.geno -a example.snp -b example.ind -k 2 -o example.pca -p example.plot -e example.eval -l example.log -m 5 -t 2 -s 6.0 smartpca -p example.pca.par >example.log sh: smartpca: command not found ploteig -i example.pca.evec -c 1:2 -p Case:Control -x -y -o example.plot.xtxt evec2pca.perl 2 example.pca.evec example.ind example.pca smarteigenstrat.perl -i example.geno -a example.snp -b example.ind -p example.pca -k 1 -o example.chisq -l example.log smarteigenstrat -p example.chisq.par >example.log sh: smarteigenstrat: command not found gc.perl example.chisq example.chisq.GC EIGENSTRAT$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/c/Users/bjwil/Anaconda3:/c/Users/bjwil/Anaconda3/Scripts:/c/ProgramData/Microsoft/Windows/Start Menu/Programs/Notepad++:/c/ProgramData/chocolatey/bin:/c/Program Files/git/cmd:/c/Program Files/MySQL/MySQL Server 5.7/bin:/c/Users/bjwil/Anaconda3/Lib/site-packages/pymol:/c/Program Files/R/R-3.4.0/bin:/c/ProgramData/Microsoft/Windows/Start Menu/Microsoft R Client:/c/Users/bjwil/OneDrive/Documents/R:/c/Program Files/sratoolkit.2.9.2-win64/bin:/c/Users/bjwil/EIG-7.2.1/bin:/c/Users/bjwil/EIG-7.2.1/src/eigensrc  ADD REPLY 0 Entering edit mode Hi @bri2237169, I am not sure if you managed to get your analysis running already, but just in case and for future reference, I had the same problem and I solved it by compiling as suggested by the README docs. So basically go to the src/ directory and run make and make install (may need root priviledges and install additional dependencies as seen in the README) After that the program worked fine. Hope that helped Dave ADD REPLY 1 Entering edit mode 4.1 years ago miaowzai ▴ 320 I have the exact same problem with Rilquer and setting the$PATH didn't help (I don't know why, very strange). I couldn't run the example.perl file, either. There is a very barbarian way to solve it.

Go to your smartpca.perl file and change the system(...) calls. There're not many of them, only three. Specifically, go to line58 and change $command = "smartpca" into $command = "/your/path/to/smartpca" if the script is executable or $command = "perl /your/path/to/smartpca.perl" if the script is not executable (or make it executable first!) Similarily, go to line 94 and change $command = "ploteig" into $command = "/your/path/to/ploteig". Lastly, go to line 110 and 113 and change the $command accordingly.

This is not a good solution, but it does the work.

0
Entering edit mode
4.6 years ago

Since example.evec should be an output from smartpca step, and its the input for evec2pca.perl step. But for smartpca.perl, there is no where to set this argument, so the second step cannot find example.evec. I suggest you to use the steps separately,

\$../POPGEN/example.perl smartpca -p par.example >example.log ploteig -i example.evec -c 1:2 -p Case:Control -x -o example.plot.xtxt # optional evec2pca.perl 2 example.evec example.ind example.pca

Notice that for ../POPGEN/par.eample, it uses '../CONVERTF/example.ped' as indivname, so actually you can modify the example as,

../bin/smartpca -p ../POPGEN/par.example > example.log ../bin/evec2pca-ped.perl 2 example.evec ../CONVERTF/example.ped example.pca

0
Entering edit mode

I have the exact same problem with Rilquer. I understand that doing it separately would help, but I didn't understand the code in your answer. Could you please explain a little bit more about how to do this separately? Thank you so much.

0
Entering edit mode
22 months ago

@David A.'s comment already pointed into the right direction: It seems as if the current EIGENSOFT version (7.2.1) does not have the compiled sources in the bin folder (there should be the corresponding files called "smartpca" etc. - I do NOT mean the perl files).

You could solve that by building it on your own as described in the README. However, for me this did not work out and I got errors.

Short workaround: Download version 6.x - they have all the compiled files available and you do not need to build it on your own.