zengxiaofei / HapHiC

HapHiC: a fast, reference-independent, allele-aware scaffolding tool based on Hi-C data
https://www.nature.com/articles/s41477-024-01755-3
BSD 3-Clause "New" or "Revised" License
141 stars 10 forks source link

Error with "filter_bam" "[main_samview] fail to read the header from "-"." #52

Closed S-iff closed 2 months ago

S-iff commented 2 months ago

Hello, I encountered an error when running the command filter_bam HMHiC.bam 1 --nm 3 --threads 14 | samtools view - -b -@ 14 -o HMHiC.filtered.bam, which states "[main_samview] fail to read the header from "-"." I checked that my HMHiC.bam file and its path are correct, and I ran haphic check which also indicated that everything is normal. Additionally, when I tried to split the command into two parts, specifically filter_bam HMHiC.bam 1 --nm 3 --threads 14 > HMHiC.filtered.tmp.bam and samtools view HMHiC.filtered.tmp.bam -b -@ 64 -o HMHiC.filtered.bam, the first command filter_bam HMHiC.bam 1 --nm 3 --threads 14 > HMHiC.filtered.tmp.bam resulted in an error indicating "Segmentation fault (core dumped)." Do you have any suggestions?

[dir@c01n0002 ~]$ cd HiFi
[dir@c01n0002 HiFi]$ conda activate haphic
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/haphic check
Checking pysam... Successful (version: 0.20.0).
Checking portion... Successful (version: 2.4.2).
Checking numpy... Successful (version: 1.26.4).
Checking scipy... Successful (version: 1.14.0).
Checking scikit-learn... Successful (version: 1.5.1).
Checking networkx... Successful (version: 3.3).
Checking sparse_dot_mkl... Successful (version: 0.9.4).
Checking matplotlib... Successful (version: 3.9.1.post1).
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/utils/filter_bam HMHiC.bam 1 --nm 3 --threads 14 | samtools view - -b -@ 14 -o HMHiC.filtered.bam
[main_samview] fail to read the header from "-".
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/utils/filter_bam HMHiC.bam 1 --nm 3 --threads 14 > HMHiC.filtered.tmp.bam
Segmentation fault (core dumped)
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/utils/filter_bam -h
Segmentation fault (core dumped)
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/utils/filter_bam 
Segmentation fault (core dumped)
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/utils/filter_bam --H
Segmentation fault (core dumped)
(haphic) [dir@c01n0002 HiFi]$ /share/org/DIR/dir/HapHiC/utils/filter_bam --help
Segmentation fault (core dumped)

image

zengxiaofei commented 2 months ago

Maybe the binary version of filter_bam did not work properly on your system. I'm curious about what kind of CPU you are using. You can try the Python version (filter_bam.py) instead:

# --NM, not --nm here
/path/to/HapHiC/utils/filter_bam.py HiC.bam 1 --NM 3 --threads 14 | samtools view - -b -@ 14 -o HiC.filtered.bam
S-iff commented 2 months ago

It seems that using filter_bam.py worked fine. Thank you for your help. Also, my CPU model is Intel 8458P.