hic的ice命令的问题

把ice的代码更新为下面的代码就可以了

#!/home/%000/miniconda3/envs/rna/bin/python

import sys
import argparse
import numpy as np
from scipy import sparse

import iced
from iced.io import loadtxt, savetxt

parser = argparse.ArgumentParser(“ICE normalization”)
parser.add_argument(‘filename’,
metavar=‘File to load’,
type=str,
help=‘Path to file of contact counts to load’)
parser.add_argument("–results_filename",
“-r”,
type=str,
default=None,
help=“results_filename”)
parser.add_argument("–filtering_perc", “-f”,
type=float,
default=None,
help=“Percentage of reads to filter out”)
parser.add_argument("–filter_low_counts_perc",
type=float,
default=0.02,
help=“Percentage of reads to filter out”)
parser.add_argument("–filter_high_counts_perc",
type=float,
default=0,
help=“Percentage of reads to filter out”)
parser.add_argument("–remove-all-zeros-loci", default=False,
action=“store_true”,
help=“If provided, all non-interacting loci will be "
“removed prior to the filtering strategy chosen.”)
parser.add_argument(”–max_iter", “-m”, default=100, type=int,
help=“Maximum number of iterations”)
parser.add_argument("–eps", “-e”, default=0.1, type=float,
help=“Precision”)
parser.add_argument("–dense", “-d”, default=False, action=“store_true”)
parser.add_argument("–output-bias", “-b”, default=False, help=“Output the bias vector”)
parser.add_argument("–verbose", “-v”, default=False)

args = parser.parse_args()
filename = args.filename

Deprecating filtering_perc option

filter_low_counts = None
if “–filtering_perc” in sys.argv:
DeprecationWarning(
"Option ‘–filtering_perc’ is deprecated. Please use "
“’–filter_low_counts_perc’ instead.’”)
# And print it again because deprecation warnings are not displayed for
# recent versions of python
print “–filtering_perc is deprecated. Please use filter_low_counts_perc”
print “instead. This option will be removed in ice 0.3”
filter_low_counts = args.filtering_perc
if “–filter_low_counts_perc” in sys.argv and “–filtering_perc” in sys.argv:
raise Warning(“This two options are incompatible”)
if “–filtering_perc” is None and “–filter_low_counts_perc” not in sys.argv:
filter_low_counts_perc = 0.02
elif args.filter_low_counts_perc is not None:
filter_low_counts_perc = args.filter_low_counts_perc

if args.verbose:
print(“Using iced version %s” % iced.version)
print “Loading files…”

Loads file as i, j, counts

i, j, data = loadtxt(filename).T

Detecting whether the file is 0 or 1 based.

if min(i.min(), j.min()) == 0:
index_base = 0
N = max(i.max(), j.max()) + 1
counts = sparse.coo_matrix((data, (i, j)), shape=(N, N), dtype=float)
else:
index_base = 1
N = max(i.max(), j.max())
counts = sparse.coo_matrix((data, (i - 1, j - 1)), shape=(N, N), dtype=float)

if args.dense:
counts = np.array(counts.todense())
else:
counts = sparse.csr_matrix(counts)

if args.verbose:
print “Normalizing…”

if filter_low_counts_perc != 0:
counts = iced.filter.filter_low_counts(counts,
percentage=filter_low_counts_perc,
remove_all_zeros_loci=args.remove_all_zeros_loci,
copy=False, sparsity=False, verbose=args.verbose)
if args.filter_high_counts_perc != 0:
counts = iced.filter.filter_high_counts(
counts,
percentage=args.filter_high_counts_perc,
copy=False)

counts, bias = iced.normalization.ICE_normalization(
counts, max_iter=args.max_iter, copy=False,
verbose=args.verbose, eps=args.eps, output_bias=True)

if args.results_filename is None:
results_filename = “.”.join(
filename.split(".")[:-1]) + “_normalized.” + filename.split(".")[-1]
else:
results_filename = args.results_filename

counts = sparse.coo_matrix(counts)

if args.verbose:
print “Writing results…”

savetxt(
results_filename, counts.col + index_base, counts.row + index_base, counts.data)

if args.output_bias:
np.savetxt(results_filename + “.biases”, bias)

旧代码
另外一个版本的代码运行失败
#!/data/zhangyong/miniconda3/envs/rna/bin/python
from future import print_function
import sys
import argparse
import numpy as np
from scipy import sparse

import iced
from iced.io import load_counts, savetxt, write_counts

parser = argparse.ArgumentParser(“ICE normalization”)
parser.add_argument(‘filename’,
metavar=‘File to load’,
type=str,
help=‘Path to file of contact counts to load’)
parser.add_argument("–results_filename",
“-r”,
type=str,
default=None,
help=“results_filename”)
parser.add_argument("–filtering_perc", “-f”,
type=float,
default=None,
help=“Percentage of reads to filter out”)
parser.add_argument("–filter_low_counts_perc",
type=float,
default=0.02,
help=“Percentage of reads to filter out”)
parser.add_argument("–filter_high_counts_perc",
type=float,
default=0,
help=“Percentage of reads to filter out”)
parser.add_argument("–remove-all-zeros-loci", default=False,
action=“store_true”,
help=“If provided, all non-interacting loci will be "
“removed prior to the filtering strategy chosen.”)
parser.add_argument(”–max_iter", “-m”, default=100, type=int,
help=“Maximum number of iterations”)
parser.add_argument("–eps", “-e”, default=0.1, type=float,
help=“Precision”)
parser.add_argument("–dense", “-d”, default=False, action=“store_true”)
parser.add_argument("–output-bias", “-b”, default=False, help=“Output the bias vector”)
parser.add_argument("–verbose", “-v”, default=False, type=bool)

args = parser.parse_args()
filename = args.filename

Deprecating filtering_perc option

filter_low_counts = None
if “–filtering_perc” in sys.argv:
DeprecationWarning(
“Option ‘–filtering_perc’ is deprecated. Please use "
“’–filter_low_counts_perc’ instead.’”)
# And print it again because deprecation warnings are not displayed for
# recent versions of python
print(”–filtering_perc is deprecated. Please use filter_low_counts_perc")
print(“instead. This option will be removed in ice 0.3”)
filter_low_counts = args.filtering_perc
if “–filter_low_counts_perc” in sys.argv and “–filtering_perc” in sys.argv:
raise Warning(“This two options are incompatible”)
if “–filtering_perc” is None and “–filter_low_counts_perc” not in sys.argv:
filter_low_counts_perc = 0.02
elif args.filter_low_counts_perc is not None:
filter_low_counts_perc = args.filter_low_counts_perc

if args.verbose:
print(“Using iced version %s” % iced.version)
print(“Loading files…”)

Loads file as i, j, counts

counts = load_counts(filename, base=0)

if args.dense:
counts = np.array(counts.todense())
else:
counts = sparse.csr_matrix(counts)

if args.verbose:
print(“Normalizing…”)

if filter_low_counts_perc != 0:
counts = iced.filter.filter_low_counts(counts,
percentage=filter_low_counts_perc,
remove_all_zeros_loci=args.remove_all_zeros_loci,
copy=False, sparsity=False, verbose=args.verbose)
if args.filter_high_counts_perc != 0:
counts = iced.filter.filter_high_counts(
counts,
percentage=args.filter_high_counts_perc,
copy=False)

counts, bias = iced.normalization.ICE_normalization(
counts, max_iter=args.max_iter, copy=False,
verbose=args.verbose, eps=args.eps, output_bias=True)

if args.results_filename is None:
results_filename = “.”.join(
filename.split(".")[:-1]) + “_normalized.” + filename.split(".")[-1]
else:
results_filename = args.results_filename

counts = sparse.coo_matrix(counts)

if args.verbose:
print(“Writing results…”)

#write_counts(results_filename, counts)
write_counts(
results_filename,
counts)

if args.output_bias:
np.savetxt(results_filename + “.biases”, bias)

从新跑
source activate
/dathic/liyutingHIC/dataall
for i in RKO WT MKO
do
/data/zhaox/HiC-Pro_2.11.4/bin/HiC-Pro -i /data/zhaningHIC/dataall/ i / o u t p u t / h i c r e s u l t s / m a t r i x − o / d a t a / z h a i c / l i y u t i n g H I C / d a t a a l l / i/output/hic_results/matrix -o /data/zhaic/liyutingHIC/dataall/ i/output/hicresults/matrixo/data/zhaic/liyutingHIC/dataall/i/output/ -c /data/zhaingHIC/dataall/$i/config-hicpro.txt -s ice_norm
done

(hic) myod@LAPTOP-PD8J6FNB:/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master$ pip install iced
Collecting iced
Downloading iced-0.5.8.tar.gz (28.5 MB)
|████████████████████████████████| 28.5 MB 10.4 MB/s
Installing build dependencies … error
ERROR: Command errored out with exit status 2:
command: /home/myod/miniconda3/bin/python /home/myod/miniconda3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-c4u1236x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple – setuptools wheel numpy
cwd: None
Complete output (58 lines):
Collecting setuptools
Downloading setuptools-57.0.0-py3-none-any.whl (821 kB)
ERROR: Exception:
Traceback (most recent call last):
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 437, in _error_catcher
yield
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_vendor/cachecontrol/filewrapper.py”, line 62, in read
data = self.__fp.read(amt)
File “/home/myod/miniconda3/lib/python3.8/http/client.py”, line 458, in read
n = self.readinto(b)
File “/home/myod/miniconda3/lib/python3.8/http/client.py”, line 502, in readinto
n = self.fp.readinto(b)
File “/home/myod/miniconda3/lib/python3.8/socket.py”, line 669, in readinto
return self._sock.recv_into(b)
File “/home/myod/miniconda3/lib/python3.8/ssl.py”, line 1241, in recv_into
return self.read(nbytes, buffer)
File “/home/myod/miniconda3/lib/python3.8/ssl.py”, line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/cli/base_command.py”, line 228, in _main
status = self.run(options, args)
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/cli/req_command.py”, line 182, in wrapper
return func(self, options, args)
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/commands/install.py”, line 323, in run
requirement_set = resolver.resolve(
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py”, line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py”, line 388, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py”, line 340, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 467, in prepare_linked_requirement
local_file = unpack_url(
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 255, in unpack_url
file = get_http_url(
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 129, in get_http_url
from_path, content_type = _download_http_url(
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/operations/prepare.py”, line 282, in _download_http_url
for chunk in download.chunks:
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py”, line 168, in iter
for x in it:
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_internal/network/utils.py”, line 64, in response_chunks for chunk in response.raw.stream(
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File “/home/myod/miniconda3/lib/python3.8/contextlib.py”, line 131, in exit
self.gen.throw(type, value, traceback)
File “/home/myod/miniconda3/lib/python3.8/site-packages/pip/_vendor/urllib3/response.py”, line 442, in _error_catcher
raise ReadTimeoutError(self._pool, None, “Read timed out.”)
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.

ERROR: Command errored out with exit status 2: /home/myod/miniconda3/bin/python /home/myod/miniconda3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-c4u1236x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple – setuptools wheel numpy Check the logs for full command output.
(hic) myod@LAPTOP-PD8J6FNB:/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master$ conda install iced
Collecting package metadata (current_repodata.json): done
Solving environment: done

> WARNING: A newer version of conda exists. <
current version: 4.9.2
latest version: 4.10.1

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: /home/myod/miniconda3/envs/hic

added / updated specs:
- iced

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
cycler-0.10.0              |             py_2           9 KB  conda-forge
iced-0.5.8                 |   py39h70b41aa_1         2.0 MB  bioconda
joblib-1.0.1               |     pyhd8ed1ab_0         206 KB  conda-forge
kiwisolver-1.3.1           |   py39h1a9c180_1          80 KB  conda-forge
lcms2-2.12                 |       hddcbb42_0         443 KB  conda-forge
matplotlib-base-3.4.2      |   py39h2fa2bec_0         7.2 MB  conda-forge
olefile-0.46               |     pyh9f0ad1d_1          32 KB  conda-forge
openjpeg-2.4.0             |       hb52868f_1         444 KB  conda-forge
pandas-1.2.4               |   py39hde0f152_0        12.1 MB  conda-forge
pillow-8.2.0               |   py39hf95b381_1         690 KB  conda-forge
pyparsing-2.4.7            |     pyh9f0ad1d_0          60 KB  conda-forge
python-dateutil-2.8.1      |             py_0         220 KB  conda-forge
pytz-2021.1                |     pyhd8ed1ab_0         239 KB  conda-forge
scikit-learn-0.24.2        |   py39h4dfa638_0         7.6 MB  conda-forge
six-1.16.0                 |     pyh6c4a22f_0          14 KB  conda-forge
threadpoolctl-2.1.0        |     pyh5ca1d4c_0          15 KB  conda-forge
tornado-6.1                |   py39h3811e60_1         646 KB  conda-forge
------------------------------------------------------------
                                       Total:        31.9 MB

The following NEW packages will be INSTALLED:

cycler conda-forge/noarch::cycler-0.10.0-py_2
iced bioconda/linux-64::iced-0.5.8-py39h70b41aa_1
joblib conda-forge/noarch::joblib-1.0.1-pyhd8ed1ab_0
kiwisolver conda-forge/linux-64::kiwisolver-1.3.1-py39h1a9c180_1
lcms2 conda-forge/linux-64::lcms2-2.12-hddcbb42_0
matplotlib-base conda-forge/linux-64::matplotlib-base-3.4.2-py39h2fa2bec_0
olefile conda-forge/noarch::olefile-0.46-pyh9f0ad1d_1
openjpeg conda-forge/linux-64::openjpeg-2.4.0-hb52868f_1
pandas conda-forge/linux-64::pandas-1.2.4-py39hde0f152_0
pillow conda-forge/linux-64::pillow-8.2.0-py39hf95b381_1
pyparsing conda-forge/noarch::pyparsing-2.4.7-pyh9f0ad1d_0
python-dateutil conda-forge/noarch::python-dateutil-2.8.1-py_0
pytz conda-forge/noarch::pytz-2021.1-pyhd8ed1ab_0
scikit-learn conda-forge/linux-64::scikit-learn-0.24.2-py39h4dfa638_0
six conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
threadpoolctl conda-forge/noarch::threadpoolctl-2.1.0-pyh5ca1d4c_0
tornado conda-forge/linux-64::tornado-6.1-py39h3811e60_1

Proceed ([y]/n)? y

Downloading and Extracting Packages
olefile-0.46 | 32 KB | ################################################################################################################################################## | 100%
kiwisolver-1.3.1 | 80 KB | ################################################################################################################################################## | 100%
pillow-8.2.0 | 690 KB | ################################################################################################################################################## | 100%
tornado-6.1 | 646 KB | ################################################################################################################################################## | 100%
matplotlib-base-3.4. | 7.2 MB | ################################################################################################################################################## | 100%
six-1.16.0 | 14 KB | ################################################################################################################################################## | 100%
iced-0.5.8 | 2.0 MB | ################################################################################################################################################## | 100%
python-dateutil-2.8. | 220 KB | ################################################################################################################################################## | 100%
lcms2-2.12 | 443 KB | ################################################################################################################################################## | 100%
threadpoolctl-2.1.0 | 15 KB | ################################################################################################################################################## | 100%
cycler-0.10.0 | 9 KB | ################################################################################################################################################## | 100%
pandas-1.2.4 | 12.1 MB | ######################################################6 | 37%

ImportError: Error - iced cannot be imported
Can not proceed without the required Python libraries, please install them and re-run
make[1]: *** [scripts/install/Makefile:41: configure] Error 1
make[1]: Leaving directory ‘/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master’
make: *** [Makefile:40: configure] Error 2
(hic) myod@LAPTOP-PD8J6FNB:/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master$ python
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import iced
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘iced’

quit()
(hic) myod@LAPTOP-PD8J6FNB:/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master$ conda install iced
Collecting package metadata (current_repodata.json): done
Solving environment: done

> WARNING: A newer version of conda exists. <
current version: 4.9.2
latest version: 4.10.1

Please update conda by running

$ conda update -n base -c defaults conda

All requested packages already installed.

(hic) myod@LAPTOP-PD8J6FNB:/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master$ pip3 install iced
Collecting iced
Using cached iced-0.5.8.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) … done
Created wheel for iced: filename=iced-0.5.8-cp38-cp38-linux_x86_64.whl size=28590126 sha256=1940675f051b778954fdbeb5c2cab75fc7959a7712e73b8ad349ba2643c5a9ad
Stored in directory: /home/myod/.cache/pip/wheels/f9/f6/21/1816c2cbc88574a8e484fdcddaa268e464ba4d299973520abc
Successfully built iced
Installing collected packages: iced
Successfully installed iced-0.5.8
(hic) myod@LAPTOP-PD8J6FNB:/mnt/h/soft/mm9_ref/hicpro/HiC-Pro-master$

Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐