open2c / cooltools

The tools for your .cool's
MIT License
140 stars 51 forks source link

Error Running compute-saddle CLI #494

Closed GregZs closed 9 months ago

GregZs commented 10 months ago

The code: module use /software/as/el7.2/EasyBuild/CRG/modules/all module load Python/3.8.2-GCCcore-9.3.0

cooltools compute-saddle --quantiles --qrange 0.02 0.98 --strength \ -o ${describer} --fig pdf --vmin 0.2 --vmax 4 \ ${describer}_100kb.Corrected_KR.cool \ ${describer}_ev.cis.vecs.tsv \ ${describer}_100kb_exp.tsv

The error: Traceback (most recent call last): File "/users/tgraf/gstik/.local/bin/cooltools", line 8, in sys.exit(cli()) File "/software/as/el7.2/EasyBuild/CRG/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/software/as/el7.2/EasyBuild/CRG/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/software/as/el7.2/EasyBuild/CRG/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/click/core.py", line 1668, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/software/as/el7.2/EasyBuild/CRG/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/software/as/el7.2/EasyBuild/CRG/software/Python/3.8.2-GCCcore-9.3.0/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(args, **kwargs) File "/users/tgraf/gstik/.local/lib/python3.8/site-packages/cooltools/cli/compute_saddle.py", line 393, in computesaddle if len(range): TypeError: object of type 'NoneType' has no len()

Thanks in advance. Greg

sergpolly commented 10 months ago

File "/users/tgraf/gstik/.local/lib/python3.8/site-packages/cooltools/cli/compute_saddle.py", line 393, in compute_saddle if len(range): TypeError: object of type 'NoneType' has no len()

This error (Python exception) refers to line 393 in cooltools/cli/compute_saddles.py - but such file does not exist anymore in the cooltools sourcecode (it has been heavily rearranged around 2021-2022)

Could you please try doing 1 of the following:

Also looking at this

module use /software/as/el7.2/EasyBuild/CRG/modules/all module load Python/3.8.2-GCCcore-9.3.0

it seems like you're using some software modules provided by the compute cluster and installing cooltools on top ... We strongly recommend using conda for creating isolated environments for installing software (Python-related and beyond), e.g. as here https://github.com/open2c/open2c_examples#installation . Is that something you'd be willing to try to install more recent version of cooltools/bioframe/etc ?

GregZs commented 10 months ago

Thanks for the reply. The version I am using is version 0.4.0. How should I do to update to the latest version ? I guess I need to reinstall the last version from Github, right ?

GregZs commented 10 months ago

I have created a conda open2c environment as you suggested and reinstall a new version but I have now having the following error: (open2c) [gstik@ant-login6 ~]$ /users/tgraf/gstik/.local/bin/cooltools --version Traceback (most recent call last): File "/users/tgraf/gstik/.local/bin/cooltools", line 5, in from cooltools.cli import cli File "/users/tgraf/gstik/.local/lib/python3.8/site-packages/cooltools/init.py", line 18, in from .lib import ( File "/users/tgraf/gstik/.local/lib/python3.8/site-packages/cooltools/lib/numutils.py", line 11, in from ._numutils import ( File "cooltools/lib/_numutils.pyx", line 1, in init cooltools.lib._numutils ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use 'numpy._import_array' to disable if you are certain you don't need it).

sergpolly commented 9 months ago

oh, sorry for this trouble ! often times installation could be the trickiest part ...

(open2c) [gstik@ant-login6 ~]$

it does look like you've installed conda and activated open2c environment, however looking at this:

File "/users/tgraf/gstik/.local/lib/python3.8/site-packages/cooltools/lib/numutils.py

it seems like you're not running cooltools installed in that environment - everything comes from your /users/tgraf/gstik/.local folder, it uses your previous python 3.8 installation in /users/tgraf/gstik/.local/lib/python3.8, and there are some version mismatches that cause errors ...

Since you've created and activated open2c environment:

If you try to look inside of that environment file https://github.com/open2c/open2c_examples/blob/master/environment.yml - you can see that it comes with cooltools already...

If that doesn't work, as is, I would try to remove your open2c env and starting over

GregZs commented 9 months ago

Using cooltools from the conda environment solved the issue !! The only weird remaining thing is the pdf output of the saddle plot (see attached file).

Thanks for your help !! HiC_UT.pdf

sergpolly commented 9 months ago

oh, yes - it is a known one #423

we are trying to separate plotting functionality from cooltools #313 - so this saddleplot functionality was "neglected" a little bit lately

You can try:

  1. not great solution - fiddle with matplotlib versions in your env, as they did in #423
  2. try running our open2c_examples jupyter notebooks https://github.com/open2c/open2c_examples/blob/master/compartments_and_saddles.ipynb
  3. create a little python script that would read output of your cooltools saddle command and use saddleplot function from the examples notebook

I can write the details on that python script here later, if this is something you would be willing to try

GregZs commented 9 months ago

I will try 1 or 2 ! Thanks for your help

sergpolly commented 9 months ago

Sounds good @GregZs ! I'm closing for now, but feel free to reopen if you're still struggling with plotting