tangerzhang / ALLHiC

ALLHiC: phasing and scaffolding polyploid genomes based on Hi-C data
170 stars 39 forks source link

ALLHiC_plot: error #147

Open MonsterLaplace opened 1 year ago

MonsterLaplace commented 1 year ago

[14:52:18] Step1: Get chromosome length [14:52:18] Step2: Get signal matrix [15:57:46] Step3: Draw heatmap [15:57:46] Drawing with bin size 500k Traceback (most recent call last): File "/home/xb/ALLHiC/ALLHiC/bin/ALLHiC_plot", line 250, in ALLHiC_plot(bam, agp, chrlist, npzfile, minsize, binsize, outdir) File "/home/xb/ALLHiC/ALLHiC/bin/ALLHiC_plot", line 235, in ALLHiC_plot draw_heatmap(read_count_whole_genome_min_size, bin_offset_min_size, ratio, chr_order, min_size) File "/home/xb/ALLHiC/ALLHiC/bin/ALLHiC_plot", line 131, in draw_heatmap data = np.pad(data, ((0, ratio_cntratio-total_cnt), (0, ratio_cntratio-total_cnt)), 'constant', constant_values=0) File "<__array_function__ internals>", line 180, in pad File "/home/xb/miniconda3/envs/HiC/lib/python3.10/site-packages/numpy/lib/arraypad.py", line 743, in pad pad_width = _as_pairs(pad_width, array.ndim, as_index=True) File "/home/xb/miniconda3/envs/HiC/lib/python3.10/site-packages/numpy/lib/arraypad.py", line 518, in _as_pairs return np.broadcast_to(x, (ndim, 2)).tolist() File "<__array_function__ internals>", line 180, in broadcast_to File "/home/xb/miniconda3/envs/HiC/lib/python3.10/site-packages/numpy/lib/stride_tricks.py", line 413, in broadcast_to return _broadcast_to(array, shape, subok=subok, readonly=True) File "/home/xb/miniconda3/envs/HiC/lib/python3.10/site-packages/numpy/lib/stride_tricks.py", line 349, in _broadcast_to it = np.nditer( ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (2,2) and requested shape (1,2)

sc-zhang commented 1 year ago

It seems that the "data" is an empty list, the first thing need be checked is that whether the chromosome list file empty or not, then remove npz file or not use npz parameter, and for large genome, the min_size should be set larger.

MonsterLaplace commented 1 year ago

It seems that the "data" is an empty list, the first thing need be checked is that whether the chromosome list file empty or not, then remove npz file or not use npz parameter, and for large genome, the min_size should be set larger.

Problem solved,Thank you! The chromosome list file is empty cased by the "cut -f1,2 groups.asm.fasta.fai|grep sample > chrn.list" in the line 111 of AllHiC.pep.sh, which should be "cut -f 1,2 groups.asm.fasta.fai > chrn.list". By the way, the line 112 "ALLHiC_plot sample.bwa_mem.bam groups.agp chrn.list $bin_size pdf" should be "ALLHiC_plot -b sample.bwa_mem.bam -a groups.agp -l chrn.list -s $bin_size"