open2c / cooltools

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

cooltools eigdecomp module not found #62

Closed ancient-learner closed 5 years ago

ancient-learner commented 5 years ago

with in conda env I used pip install cooltools to install cooltools. While I was trying to import eigendecomp it throws an error like this

import cooltools.eigdecomp ModuleNotFoundError: No module named 'cooltools.eigdecomp'

nvictus commented 5 years ago

The cooltools currently on PyPI is not ours. For now, clone the repo and install (pip install -e), or point pip to a release tarball.

ancient-learner commented 5 years ago

Wow! Thank you very much for your super quick reply.

ancient-learner commented 5 years ago

Hi I have installed cooltools successfully. But got another problem. I am trying to get the PC1 and PC2 it throws this error

for cond in conditions:
     lam[cond], eigs[cond] = cooler_cis_eig(
             clrs[cond], 
             bins,
             n_eigs=3, 
             sort_metric='var_explained')

Traceback (most recent call last): File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 4380, in get_value return libindex.get_value_box(s, key) File "pandas/_libs/index.pyx", line 52, in pandas._libs.index.get_value_box File "pandas/_libs/index.pyx", line 48, in pandas._libs.index.get_value_at File "pandas/_libs/util.pxd", line 113, in pandas._libs.util.get_value_at File "pandas/_libs/util.pxd", line 98, in pandas._libs.util.validate_indexer TypeError: 'str' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 4, in File "/home/mylab/Downloads/cooltools-0.1.0/cooltools/eigdecomp.py", line 293, in cooler_cis_eig if regions is None File "/home/mylab/Downloads/cooltools-0.1.0/cooltools/eigdecomp.py", line 292, in for chrom in bins['chrom'].unique()] File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/series.py", line 868, in getitem result = self.index.get_value(self, key) File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 4388, in get_value raise e1 File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 4374, in get_value tz=getattr(series.dtype, 'tz', None)) File "pandas/_libs/index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value File "pandas/_libs/index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'chrM'

In my data I don't have chrY and chrM . while i was loading genome through bioframe entire genome is been loaded.

golobor commented 5 years ago

The most likely explanation is that your bins table is not consistent with your cooler. Specifically, it seems to contain some chromosomes that are not present in the cooler ('chrM'). I added a check for this case.

On Tue, 19 Feb 2019 at 03:56, ancient-learner notifications@github.com wrote:

Hi I have installed cooltools successfully. But got another problem. I am trying to get the PC1 and PC2 it throws this error

for cond in conditions: lam[cond], eigs[cond] = cooler_cis_eig( clrs[cond], bins, n_eigs=3, sort_metric='var_explained')

Traceback (most recent call last): File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 4380, in get_value return libindex.get_value_box(s, key) File "pandas/_libs/index.pyx", line 52, in pandas._libs.index.get_value_box File "pandas/_libs/index.pyx", line 48, in pandas._libs.index.get_value_at File "pandas/_libs/util.pxd", line 113, in pandas._libs.util.get_value_at File "pandas/_libs/util.pxd", line 98, in pandas._libs.util.validate_indexer TypeError: 'str' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 4, in File "/home/mylab/Downloads/cooltools-0.1.0/cooltools/eigdecomp.py", line 293, in cooler_cis_eig if regions is None File "/home/mylab/Downloads/cooltools-0.1.0/cooltools/eigdecomp.py", line 292, in for chrom in bins['chrom'].unique()] File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/series.py", line 868, in getitem result = self.index.get_value(self, key) File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 4388, in get_value raise e1 File "/home/mylab/miniconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 4374, in get_value tz=getattr(series.dtype, 'tz', None)) File "pandas/_libs/index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value File "pandas/_libs/index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'chrM'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mirnylab/cooltools/issues/62#issuecomment-465044423, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3uCsKLvoRDTMwZ4AWdUV-VDmnu4NGFks5vO7w-gaJpZM4bCN8g .

ancient-learner commented 5 years ago

Yeah Now it says

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/home/jplab/Downloads/cooltools-master/cooltools/eigdecomp.py", line 300, in cooler_cis_eig
    'in the cooler: '+str(chroms_not_in_clr)
ValueError: The following chromosomes are found in the bin table, but not in the cooler: ['chrM']

But Please add an exception for chromosomes like chrM. Because usually for HI-C We only expect nuclear DNA not the mitochondrial. So While Aligning itself I didn't consider ChrM. For Now as a solution can I change Bioframe chromosome list +sizes and try?

Update I just did mm10[21]="0" and it worked :)

golobor commented 5 years ago

hmm, I think, the issue that you have is that your bin table, for some reason, does not match the bin table in the cooler. The two possible solutions: (a) just use the bin table from the cooler, i.e. clrs[cond].bins()[:]. You'd still need to add the phasing vector (like GC content). (b) remove the chrM bins from the bin table: bins[bins.chrom!='chrM']

On Wed, 20 Feb 2019 at 00:11, ancient-learner notifications@github.com wrote:

Yeah Now it says

Traceback (most recent call last): File "", line 5, in File "/home/jplab/Downloads/cooltools-master/cooltools/eigdecomp.py", line 300, in cooler_cis_eig 'in the cooler: '+str(chroms_not_in_clr) ValueError: The following chromosomes are found in the bin table, but not in the cooler: ['chrM']

But Please add an exception for chromosomes like chrM. Because usually for HI-C We only expect nuclear DNA not the mitochondrial. So While Aligning itself I didn't consider ChrM. For Now as a solution can I change Bioframe chromosome list +sizes and try?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mirnylab/cooltools/issues/62#issuecomment-465426842, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3uCo4kp0Q4zNI58rSVCmlOBBpCB4wvks5vPNjrgaJpZM4bCN8g .

ancient-learner commented 5 years ago

Thank you For your help as I mentioned in my previous comment I did mm10[21]="0" and it worked

golobor commented 5 years ago

glad to hear it worked!

yanchunzhang commented 3 years ago

hmm, I think, the issue that you have is that your bin table, for some reason, does not match the bin table in the cooler. The two possible solutions: (a) just use the bin table from the cooler, i.e. clrs[cond].bins()[:]. You'd still need to add the phasing vector (like GC content). (b) remove the chrM bins from the bin table: bins[bins.chrom!='chrM'] On Wed, 20 Feb 2019 at 00:11, ancient-learner @.***> wrote: Yeah Now it says Traceback (most recent call last): File "", line 5, in File "/home/jplab/Downloads/cooltools-master/cooltools/eigdecomp.py", line 300, in cooler_cis_eig 'in the cooler: '+str(chroms_not_in_clr) ValueError: The following chromosomes are found in the bin table, but not in the cooler: ['chrM'] But Please add an exception for chromosomes like chrM. Because usually for HI-C We only expect nuclear DNA not the mitochondrial. So While Aligning itself I didn't consider ChrM. For Now as a solution can I change Bioframe chromosome list +sizes and try? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#62 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3uCo4kp0Q4zNI58rSVCmlOBBpCB4wvks5vPNjrgaJpZM4bCN8g .

Hi, do you know how to add the phasing vector to clr when do compartment calling?

Thanks! Yanchun

Phlya commented 3 years ago

Dear Yanchun,

Could you create a new issue and explain the problem?