Git Product home page Git Product logo

iced's Introduction

Travis Coveralls

iced

The python module iced implements the ICE normalization of hic data

Depends on

python >= 2.7 numpy >= 1.16 scipy >= 0.19 sklearn pandas

iced's People

Contributors

matthiasblum avatar nellev avatar nservant avatar robomics avatar thomasgilgenast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

iced's Issues

Install iced for python 2.7

Hi,
I am trying to install iced in python 2.7 but met with the following error. Do you know what happened?

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting iced
Using cached iced-0.5.7.tar.gz (28.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Building wheels for collected packages: iced
Building wheel for iced (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\solei\miniconda3\envs\py2\python.exe' 'c:\users\solei\miniconda3\envs\py2\lib\site-packages\pip_vendor\pep517_in_process.py' build_wheel 'c:\users\solei\appdata\local\temp\tmpsj3zq0'
cwd: c:\users\solei\appdata\local\temp\pip-install-bixxjm\iced
Complete output (52 lines):
non-existing path in 'iced': '..\src\cblas'
non-existing path in 'iced': '..\src\cblas'
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "iced.normalization/normalization" sources
building extension "iced.filter" sources
building data_files sources
build_src: building npy-pkg config files
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\iced
copying iced\filter.py -> build\lib.win-amd64-2.7\iced
copying iced\setup.py -> build\lib.win-amd64-2.7\iced
copying iced_init_.py -> build\lib.win-amd64-2.7\iced
creating build\lib.win-amd64-2.7\iced\utils
copying iced\utils\validation.py -> build\lib.win-amd64-2.7\iced\utils
copying iced\utils_genome.py -> build\lib.win-amd64-2.7\iced\utils
copying iced\utils_validation.py -> build\lib.win-amd64-2.7\iced\utils
copying iced\utils_vis.py -> build\lib.win-amd64-2.7\iced\utils
copying iced\utils_init_.py -> build\lib.win-amd64-2.7\iced\utils
creating build\lib.win-amd64-2.7\iced\datasets
copying iced\datasets\base.py -> build\lib.win-amd64-2.7\iced\datasets
copying iced\datasets\dldata.py -> build\lib.win-amd64-2.7\iced\datasets
copying iced\datasets\setup.py -> build\lib.win-amd64-2.7\iced\datasets
copying iced\datasets_init_.py -> build\lib.win-amd64-2.7\iced\datasets
creating build\lib.win-amd64-2.7\iced\io
copying iced\io\setup.py -> build\lib.win-amd64-2.7\iced\io
copying iced\io_io_else.py -> build\lib.win-amd64-2.7\iced\io
copying iced\io_io_pandas.py -> build\lib.win-amd64-2.7\iced\io
copying iced\io_init_.py -> build\lib.win-amd64-2.7\iced\io
creating build\lib.win-amd64-2.7\iced\normalization
copying iced\normalization_ca_utils.py -> build\lib.win-amd64-2.7\iced\normalization
copying iced\normalization_init_.py -> build\lib.win-amd64-2.7\iced\normalization
running build_ext
customize MSVCCompiler using build_ext
compiling C sources
creating build\temp.win-amd64-2.7\Release\iced
creating build\temp.win-amd64-2.7\Release\iced\normalization
C:\Users\solei\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I..\src\cblas -Ic:\users\solei\appdata\local\temp\pip-build-env-1tyth1\overlay\Lib\site-packages\nuIc:\users\solei\miniconda3\envs\py2\include -Ic:\users\solei\miniconda3\envs\py2\PC /Tciced\normalization_normalization_.c /Fobuild\temp.win-amd64-2.7\Release\iced\normalization_normalization_.obj
C:\Users\solei\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\users\solei\miniconda3\envs\py2\libs /LIBPATH:c:\users\solei\miniconda3\envs\py2\PCbuild\amd64 /LIBPATH:c:\users\solei\miniconda3\envs\py2\PC\VS9.0\amd64 /EXPORT:initnormalization/normalization build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.obj /OUT:build\lib.win-amd64-2.7\iced\normalization/normalization.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.pyd.manifest
LINK : error LNK2001: unresolved external symbol initnormalization/normalization
build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.lib : fatal error LNK1120: 1 unresolved externals
error: Command "C:\Users\solei\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\users\solei\miniconda3\envs\py2\libs /LIBPATH:c:\users\solei\miniconda3\envs\py2\PCbuild\amd64 /LIBPATH:c:\users\solei\miniconda3\envs\py2\PC\VS9.0\amd64 /EXPORT:initnormalization/normalization build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.obj /OUT:build\lib.win-amd64-2.7\iced\normalization/normalization.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\iced\normalization_normalization_.pyd.manifest" failed with exit status 1120

ERROR: Failed building wheel for iced
Failed to build iced
ERROR: Could not build wheels for iced which use PEP 517 and cannot be installed directly

some basic questions about ICE normalization

Dear @NelleV

Some questions about the HiC normalization have confused me a long time. As the normalization is critical for the correct identification of different chromation interactions between samples, so I here want to ask you for help. Thank you very much.

1 Does ICE normalization take sequence depth into account?
2 Is there any differences between normalization by chromosome and by genome-wide? Which pipeline can generate more comparable results among different chromosomes?

sincerely,
Zheng zhuqing

SCN element wise production issue

Hi, thanks for the normalization algorithm. I found an issue about the element-wise product(**2, iced/iced/normalization/init.py line 101).
If the input of X is the type of matrix, the expression "**2" will make a production of matrices.
If the input of X is the type of ndarray the expression "**2" will make element-wise production.

I think the "**2" in the algorithm is supposed to be element-wise production. So, it might be the explicit expression of element-wise production or check the type of X.
Reproduction:

A = np.matrix(np.ones((2,2)))
print(A**2)
[[2. 2.]
[2. 2.]]

A = np.asarray(np.ones((2,2)))
print(A**2)"
[[1. 1.]
[1. 1.]]

Thanks.

ice matrix bias file inconsistency

Hi, I'm trying to use iced 0.5.8 on the raw matrix output of HiC-Pro. Hower, I'm getting inconsistent bin counts.

If I run iced like:

ice --results_filename {output.icematrix} --filter_low_counts_perc 0.02 \
    --filter_high_counts_perc 0 --max_iter 100 --eps 0.1 --base 0 \
    --remove-all-zeros-loci --output-bias 1 {input.matrix} > {log} 2>&1

the output files look like this:

(iced) [bcro-big ice-matrix main*]$ wc -l N2P_D0_1000000*
 3594245 N2P_D0_1000000.icematrix
    3115 N2P_D0_1000000.icematrix.biases
 3597360 total
(iced) [bcro-big ice-matrix main*]$ head -n 2 N2P_D0_1000000*
==> N2P_D0_1000000.icematrix <==
1	1	3590.512980
1	2	1465.522789

==> N2P_D0_1000000.icematrix.biases <==
nan
3.456610107735157977e-01

However, if I check the raw matrix:

[bcro-big 1000000 main*]$ wc -l *
    3114 N2P_D0_1000000_abs.bed
 3594245 N2P_D0_1000000.matrix
 3597359 total
[bcro-big 1000000 main*]$ head -n 2 *
==> N2P_D0_1000000_abs.bed <==
chr1	0	1000000	1
chr1	1000000	2000000	2

==> N2P_D0_1000000.matrix <==
1	1	429
1	2	481

So the size of the matrices is the same, the bin numbering seems to be ok, both of them start at 1, but:

  • the ice matrix bias file seems to have one more line compared to the number of bins in the bed file
  • it is a bit counterintuitive to me that I have to specify --base 0 to get 1 based bin numbers

The resulting bias file breaks the hicpro2fithic.py script from HiC-Pro. Some HiC-Pro issues might be relevant: this, this, this.

Can I just simply remove the first line of the bias file? It seems to always contain a nan regardless of sample or resolution.

Pysam

Hi!

I had an issue with pysam.

I had this error message:
File "/home/apps/HiC-Pro/HiC-Pro_2.7.4b/scripts/mergeSAM.py", line 220, in
outfile = pysam.AlignmentFile(output, "wb", template=hr1)
AttributeError: 'module' object has no attribute 'AlignmentFile'
make: *** [bowtie_pairing] Error 1

My pysam version was 0.7.5
$ python
Python 2.7.2 (default, Feb 3 2012, 08:01:33)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pysam
print pysam.version
0.7.5

Pysam 0.7.5 does not have AlignmentFile.

Now I use Pysam 0.9 and it works great!

Thank you Nicolas and Dave for your help!!! :)

undefined symbol: PyUnicodeUCS2_Format

Hi,I am trying to use iced module to normalized Hi-C data.However , there is something wrong 'ImportError: ……/anaconda2/lib/python2.7/site-packages/iced/normalization.so: undefined symbol: PyUnicodeUCS2_Format
make: *** [ice_norm]'

What does that error mean?How can I fix it?
Thanks!

ICE Normalization for HiC Dataset Comparison

I am thinking how should I do if I want to compare 2 experiments with different sequence depths. Here is two ways come up to me but I am not sure whether they are correct:

  1. Set the total_counts parameter of each experiments's normalization be the same. Then I can compare the normalized counts of them?

  2. Output the bias of each experiment. And transform the raw count map into probability matrix by calculating Tij=Oij/BiBj. Is this calculation for probability matrix correct? Or there is some ways to calculate the probability matrix from the output normalized count matrix?

Thanks

memory error

Hi,
I used HiC-Pro to get the ICE normalization matrix implemented by hiclib, I used 1kb resolution, but meet the memory problem, so I split the genome matrix into 24 matrices per chromosome, and get the 24 ICE matrices per chromosome, but the ICE assumption of equal visibility (genome-wide) change to equal visibility (per chromosome). Dose this will effect my result greatly? I don't know whether this is right.

bug in verbose mode using python 3.7.X

Hi Nelle,
There is a small bug in the verbose option using python 3.7, with --verbose 1

Using iced version 0.5.6
Loading files...
Normalizing...
Filter 9 out of 237 bins ...
Matrix is triangular superior
Traceback (most recent call last):
  File "/home/nservant/Apps/conda/envs/hic-pro/bin/ice", line 97, in <module>
    verbose=args.verbose, eps=args.eps, output_bias=True)
  File "/home/nservant/.local/lib/python3.7/site-packages/iced/normalization/__init__.py", line 129, in ICE_normalization
    if verbose > 1 and old_bias is not None:
TypeError: '>' not supported between instances of 'str' and 'int'

warning when running the latest (0.5.7) ice

Dear @NelleV

After installing the latest iced using pip, I found it gives me following warnings when running ice.

/anaconda3/bin/ice:63: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if "--filtering_perc" is None and "--filter_low_counts_perc" not in sys.argv:
/anaconda3/lib/python3.8/site-packages/iced/normalization/_ca_utils.py:8: UserWarning: The API of this module is likely to change. Use only for testing purposes
  warnings.warn(
usage: ICE normalization [-h] [--results_filename RESULTS_FILENAME] [--filtering_perc FILTERING_PERC] [--filter_low_counts_perc FILTER_LOW_COUNTS_PERC]
                         [--filter_high_counts_perc FILTER_HIGH_COUNTS_PERC] [--remove-all-zeros-loci] [--max_iter MAX_ITER] [--eps EPS] [--dense]
                         [--output-bias OUTPUT_BIAS] [--verbose VERBOSE]
                         File to load
ICE normalization: error: the following arguments are required: File to load

Best wishes,
Zheng zhuqing

ImportError: No module named numpy.distutils.core when installing using pip

When installing iced using pip:

$ pip install iced
...
Building wheels for collected packages: iced
  Building wheel for iced (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/tgg/venv-test/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jD4T4X/iced/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jD4T4X/iced/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-vT3ByC
       cwd: /tmp/pip-install-jD4T4X/iced/
  Complete output (7 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-jD4T4X/iced/setup.py", line 112, in <module>
      setup_package()
    File "/tmp/pip-install-jD4T4X/iced/setup.py", line 104, in setup_package
      from numpy.distutils.core import setup
  ImportError: No module named numpy.distutils.core
  ----------------------------------------
  ERROR: Failed building wheel for iced
  Running setup.py clean for iced
Failed to build iced
Installing collected packages: iced
    Running setup.py install for iced ... error
    ERROR: Command errored out with exit status 1:
     command: /home/tgg/venv-test/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jD4T4X/iced/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jD4T4X/iced/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-N3SMcO/install-record.txt --single-version-externally-managed --compile --install-headers /home/tgg/venv-test/include/site/python2.7/iced
         cwd: /tmp/pip-install-jD4T4X/iced/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-jD4T4X/iced/setup.py", line 112, in <module>
        setup_package()
      File "/tmp/pip-install-jD4T4X/iced/setup.py", line 104, in setup_package
        from numpy.distutils.core import setup
    ImportError: No module named numpy.distutils.core
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/tgg/venv-test/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jD4T4X/iced/setup.py'"'"'; __file__='"'"'/tmp/pip-install-jD4T4X/iced/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-N3SMcO/install-record.txt --single-version-externally-managed --compile --install-headers /home/tgg/venv-test/include/site/python2.7/iced Check the logs for full command output.

The issue appears to be related to numpy not being present before iced is installed. This specific example is intended to be a minimal example and is somewhat contrived, but the same issue arises when doing a standard pip install -r requirements.txt with a requirements.txt file that includes both iced and numpy: pip builds wheels for all packages first before installing any packages, so even though the requirements.txt file includes numpy, pip will attempt to build the wheel for iced before numpy is installed.

A typical "old-school" workaround is to perform the installation in two steps, e.g.:

$ pip install $(grep requirements.txt numpy) && pip install -r requirements.txt

It is possible to avoid this extra step and recover the simplicity of "pip install -r requirements.txt" by declaring that the installation depends on numpy using PEP 518. The implementation for this could simply be to add a pyproject.toml file with the following contents:

[build-system]
requires=['setuptools', 'wheel', 'numpy']

This would have no impact on users using older versions of the Python packaging tools (these older versions just ignore pyproject.toml), but users using newer versions would be able to directly install iced using pip without knowing anything about the confusing history of Python packaging.

Segmentation fault

Hi :
the script python /data1/liuzunpeng/04_Softwares/iced-0.5.1/iced/scripts/ice --results_filename hic_results/matrix/$sample/iced/${res}/${sample}_${res}_iced.matrix --filter_low_counts_perc 0.02 --filter_high_counts_perc 0 --max_iter 100 --eps 0.1 --remove-all-zeros-loci --output-bias 1 --verbose 1 hic_results/matrix//${sample}/raw/${res}/${sample}_${res}.matrix
the error iced.sh: line 9: 25355 Segmentation fault
When I cat ice ,I found the line 9 is from iced.io import loadtxt, savetxt
But the python /data1/liuzunpeng/04_Softwares/iced-0.5.1/iced/scripts/ice -h worked ,and the python ~/iced-0.5.1/iced/tests/test_filter.py also worked .
Can you give me some advices?
Thanks for your time !
Best wishes
Qianzhao

ValueError: The matrix should be symmetric on .matrix files made with HiC-Pro

When I try to manually do ice normalization on matrix files from HiC-Pro ice fails with the following error:

Traceback (most recent call last):
  File "/home/balthasar/.local/bin/ice", line 95, in <module>
    counts, bias = iced.normalization.ICE_normalization(
  File "/home/balthasar/.local/lib/python3.8/site-packages/iced/normalization/__init__.py", line 66, in ICE_normalization
    is_symetric_or_tri(X)
  File "/home/balthasar/.local/lib/python3.8/site-packages/iced/utils/validation.py", line 13, in is_symetric_or_tri
    raise ValueError("The matrix should be symmetric")
ValueError: The matrix should be symmetric

The matrix file in question was made by downloading an allValidPairs file from Github and then building the matrix file with the build_matrix script from HiC-Pro.

When issuing the ice command like this:

ice output.matrix

The above error appears after a while.

Problem with io import

I'm experiencing an import issue with iced and io.

  File "/project/umw_rene_maehr/programs/HiC-Pro/scripts/ice", line 5, in <module>
    import numpy as np
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/__init__.py", line 170, in <module>
    from . import add_newdocs
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/core/__init__.py", line 46, in <module>
    from numpy.testing import Tester
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/testing/__init__.py", line 13, in <module>
    from .utils import *
  File "/share/pkg/python/2.7.9_packages/numpy/1.9.2/lib/python2.7/site-packages/numpy/testing/utils.py", line 15, in <module>
    from tempfile import mkdtemp
  File "/share/pkg/python/2.7.9/lib/python2.7/tempfile.py", line 32, in <module>
    import io as _io
  File "/share/pkg/python/2.7.9_packages/iced/0.2.1/lib/python2.7/site-packages/io/__init__.py", line 1, in <module>
    from .fastio_ import loadtxt, savetxt
  File "__init__.pxd", line 155, in init iced.io.fastio_ (iced/io/fastio_.c:4789)
AttributeError: 'module' object has no attribute 'dtype'

Have you encountered this before, and can you recommend a fix? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.