Thank you ATpoint, I did your suggestion but still I get error.
I indexed the sorted.bam file samtools index tumor.sorted.bam and put the output tumor.sorted.bam.bai in the command
bam-readcount -f hg38.fa -q 1 -b 20 -l all.Somatic.hc.var tumor.sorted.bam.bai > all.Somatic.hc.readcount
I got this error:
[bam_header_read] EOF marker is absent. The input is probably truncated.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
Segmentation fault (core dumped)
Any help?