bcftools mpileup does not use the correct chromosome when using multiple BAM files which have a different chromosome
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c
- Domain
- bioinformatics, cli
Research direction
Start by reproducing the issue with the provided bcftools mpileup command using BAM files whose chromosome orders differ, then inspect the mpileup entry point and the handling of chromosome IDs. Compare whole-file and -r chrM runs. Done means reads are associated with the correct chromosome for every BAM file without the reported out-of-range skips.
Written by the indexing model from the issue text.
Description
bcftools mpileup does not use the correct chromosome when using multiple BAM files which have a different chromosome order.
# List of BAM files with BAM files with 2 differn chromosome orders:
# - chr1 chr2 chr3 chr4 chr5 chr6 chr7 chr8 chr9 chr10 chr11 chr12 chr13 chr14 chr15 chr16 chr17 chr18 chr19 chr20 chr21 chr22 chrX chrY chrM
# - chrM chr1 chr2 chr3 chr4 chr5 chr6 chr7 chr8 chr9 chr10 chr11 chr12 chr13 chr14 chr15 chr16 chr17 chr18 chr19 chr20 chr21 chr22 chrX chrY
bam_filenames=*.bam
bcftools mpileup \
--threads 30 \
--output-type u \
--fasta-ref "${fasta_filename}" \
--max-depth 8000 \
--skip-indels \
${bam_filenames} \
| bcftools call \
--threads 4 \
--multiallelic-caller \
--variants-only \
--skip-variants indels \
--output-type b \
--output test.bcf
stderr
[mpileup] 30 samples in 30 input files
[mpileup] maximum number of reads per input file set to -d 8000
[mplp_func] Skipping because 17426 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17442 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17449 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17464 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17464 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17464 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17469 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17473 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17486 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17493 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17503 is outside of 16571 [ref:0]
[mplp_func] Skipping because 17532 is outside of 16571 [ref:0]
[mplp_func] Skipping because 19206 is outside of 16571 [ref:0]
...
I also tried with a specific region like: chrM
bcftools mpileup \
-r chrM \
--output-type v \
--fasta-ref "${fasta_filename}" \
--max-depth 8000 \
--skip-indels \
${bam_filenames}
[mpileup] maximum number of reads per input file set to -d 8000
[mplp_func] Skipping because 2756366 is outside of 16571 [ref:24]
[mplp_func] Skipping because 2781409 is outside of 16571 [ref:24]
[mplp_func] Skipping because 2804105 is outside of 16571 [ref:24]
[mplp_func] Skipping because 2806176 is outside of 16571 [ref:24]
[mplp_func] Skipping because 2819751 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3490449 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3550603 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3863042 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3903940 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3903941 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3903945 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3903951 is outside of 16571 [ref:24]
[mplp_func] Skipping because 3931577 is outside of 16571 [ref:24]
So I think bcftools mpileup needs to have a per BAM file chromosome name to tid mapping, so it get the data from the correct chromosome for each BAM file.
- Dominant language
- C
- Stars
- 891
- Forks
- 277
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from samtools/bcftools
-
needs-feedback
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
-
htslib-dependent P2: Desirable
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
-
needs-feedback requires-test-case
Difficulty 3/5 1-2 days Newbie friendliness 55/100
All issues in samtools/bcftools
Similar issues
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·
-
bug Self Built Image SNAPSHOT Supported Device target/ramips
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100