etal / cnvkit

Copy number variant detection from targeted DNA sequencing
http://cnvkit.readthedocs.org
Other
540 stars 164 forks source link

Error running test #661

Open ytakemon opened 2 years ago

ytakemon commented 2 years ago

I'm rather new to python, so apologies for the naive question. I installed all the dependencies as in your tutorial but for some reason, I can't get the test to run correctly. It seems to be that pandas was not installed, but after checking pandas seemed to have been installed correctly.

Also, I am using an alias for python py-3.9 (due to how my institution had structured our environment), which I see wasn't used properly below in the error message. Is there a way to specify which Python version to use in this make execution?

$ cd test
$ make

python ../cnvkit.py import-picard picard/p2-5_5.antitargetcoverage.csv picard/p2-9_5.targetcoverage.csv picard/p2-9_5.antitargetcoverage.csv picard/p2-20_5.targetcoverage.csv picard/p2-5_5.targetcoverage.csv picard/p2-20_5.antitargetcoverage.csv -d build/
Traceback (most recent call last):
  File "../cnvkit.py", line 4, in <module>
    from cnvlib import commands
  File "/home/ytakemon/.local/lib/python3.9/site-packages/cnvkit-master/cnvlib/__init__.py", line 1, in <module>
    from skgenome.tabio import write
  File "/home/ytakemon/.local/lib/python3.9/site-packages/cnvkit-master/skgenome/__init__.py", line 1, in <module>
    from . import tabio
  File "/home/ytakemon/.local/lib/python3.9/site-packages/cnvkit-master/skgenome/tabio/__init__.py", line 10, in <module>
    import pandas as pd
ImportError: No module named pandas
make: *** [build/reference-picard.cnn] Error 1
tetedange13 commented 2 years ago

Hi @ytakemon ,

Not an author of CNVkit, but if I understand correctly you installed CNVkit from sources ? Installing each Python package through pip associated to your py-3.9 installation? => If so, your problem is probably due to using an alias for Python3.9

Makefile file that should be present under test/ directory contains hard-written python calls => A quick fix could be to 1st create a temporary alias, typing in your shell: alias python=/absolute/path/to/your/py-3.9/executable and then re-run make

Also using conda is the recommended and much easier way to install CNVKit (and a lot of other tools by the way) => No root required so you should not have any issue related to your institution's permissions => So maybe give it a try?

Hope this helps. Have a nice day. Felix.

ytakemon commented 2 years ago

Thanks for the tip, Felix!

I was semi-resolved this initial issue by opening the Makefile and editing the 5th file to cnvkit=/absolute/path/to/bin/python3.9 /absolute/path/to/bin/cnvkit.py. (Changing the alias didn't work as the alias isn't recognized within the Makefile).

This partially ran the Makefile, but now similar to the first issue I need to specify which executable Rscript to use which is a bit more of a hassle as I need to add the --rscript-path option to each line for the segment function. Anyways, I am satisfied my installation is working, it's just a matter of pointing to the right executable python/R files.

Perhaps a note to the authors of CNVkit is to allow the paths to python/R to be set initially to avoid this problem as not everyone will be running this in a local environment with only a single version of python or R is installed.

tetedange13 commented 2 years ago

Good to know it is working for you!

Here you were in a specific case of running CNVkit's tests, meaning a serie of commands on internal test data through a written Makefile => But CNVkit is basically a Python script, so on a "normal" (not-testing) usage you just have to run: py-39 /path/to/bin/cnvkit.py (+ using --rscript-path parameter if needed) => As you would do for any Python script and you can even set a permanent alias for this (should work this time)

A not-costly way to do what you say would be to set a variable inside Makefile, similar to 5th line cnvkit= but for rscript=Rscript => And to explicitly set by default --rscript-path $(rscript) at every segment call => Like that people wanting to run tests and having a specific Python/R installation can modify these variables by hand to match their paths

Have a nice day. Felix.

tetedange13 commented 2 years ago

Should be closed by #699.

Kind regards, Felix.