XiaoTaoWang/NeoLoopFinder

Fail on correct-cnv

wzhang42 opened this issue · 2 comments

Hi, XiaoTao,
I continuously use the following command lines for calculate-cnv, segment-cnv and correct-cnv.
1.) calculate-cnv -g hg19 -H hic_SH-SY5Y.inter_5000.cool --output ./calculate-cnv.txt -e MboI --cachefolder ./neoloopfinder
2.) segment-cnv --cnv-file ./calculate-cnv.txt --binsize 5000 --output ./segmented_cnv.txt --nproc 12
3.) correct-cnv -H hic_SH-SY5Y.inter_5000.cool --cnv-file ./segmented_cnv.txt --nproc 12 --logFile cnv-norm.log

The first two, calculate-cnv, and segment-cnv are ok. But correct-cnv throw the following Error message. Could you give me any clues or suggestions to fix it. Thank you in advance.
....
root INFO @ 07/22/21 20:42:28:

ARGUMENT LIST:

Cooler URI = hic_SH-SY5Y.inter_5000.cool

CNV Profile = ./segmented_cnv.txt

Number of Processes = 12

Log file name = cnv-norm.log

root INFO @ 07/22/21 20:42:38: Match CNV segmentation to matrix bins
Traceback (most recent call last):
File "/home/wzhang42/.conda/envs/neoloop/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 4554, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 4562, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'weight'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/wzhang42/.conda/envs/neoloop/bin/correct-cnv", line 92, in run
bincnv.assign_cnv(args.hic)
File "/home/wzhang42/.conda/envs/neoloop/lib/python3.7/site-packages/neoloop/cnv/loadcnv.py", line 87, in assign_cnv
bias = cooler_lib.bins().fetch(ref_k)['weight'].values
File "/home/wzhang42/.conda/envs/neoloop/lib/python3.7/site-packages/pandas/core/frame.py", line 3024, in getitem
indexer = self.columns.get_loc(key)
File "/home/wzhang42/.conda/envs/neoloop/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3082, in get_loc
raise KeyError(key) from err
KeyError: 'weight'

Ah, the error occurred because the current version assumes there is a column "weight" in the bin table of the input cool file, which stores the bias vector from the standard ICE normalization. To avoid the error, just run "cooler balance" on your cool file.

This works. Thank you so much