samtools mpileup fails if .bam are differently ordered / headers are different
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Reproduce the two samtools mpileup commands using BAM files with the differing chromosome and header orders shown in the issue. Start at the mpileup entry point and determine why reversing the input order causes a segmentation fault; done means the command no longer crashes and the behavior is covered by a regression test or a clear diagnostic.
Written by the indexing model from the issue text.
Description
I have two .bam files from Encode: ENCFF879HJE and ENCFF731VMU. They were sorted by different algorithms, thus chromosome order / headers are slightly different.
First command fails with Segmentation fault (core dumped) and exit code 139, while second works fine. Why is that?
samtools mpileup -r chr1:249230621 ENCFF879HJE.bam ENCFF731VMU.bam > /dev/null
samtools mpileup -r chr1:249230621 ENCFF731VMU.bam ENCFF879HJE.bam > /dev/null
Theirs headers are as follows:
- ENCFF879HJE.bam
@HD VN:1.4 SO:coordinate
@SQ SN:chr10 LN:135534747
@SQ SN:chr11 LN:135006516
@SQ SN:chr12 LN:133851895
@SQ SN:chr13 LN:115169878
@SQ SN:chr14 LN:107349540
@SQ SN:chr15 LN:102531392
@SQ SN:chr16 LN:90354753
@SQ SN:chr17 LN:81195210
@SQ SN:chr18 LN:78077248
@SQ SN:chr19 LN:59128983
@SQ SN:chr1 LN:249250621
@SQ SN:chr20 LN:63025520
@SQ SN:chr21 LN:48129895
@SQ SN:chr22 LN:51304566
@SQ SN:chr2 LN:243199373
@SQ SN:chr3 LN:198022430
@SQ SN:chr4 LN:191154276
@SQ SN:chr5 LN:180915260
@SQ SN:chr6 LN:171115067
@SQ SN:chr7 LN:159138663
@SQ SN:chr8 LN:146364022
@SQ SN:chr9 LN:141213431
@SQ SN:chrM LN:16571
@SQ SN:chrX LN:155270560
@SQ SN:chrY LN:59373566
@PG ID:bwa PN:bwa VN:0.7.12-r1039 CL:bwa sampe -n 10 -a 750 /net/lebowski/vol2/solexa_genomes/illumina/Homo_sapiens/UCSC/hg19/genom
e-sets/bwa-0.7.0/hg19 /tmp/3948300.1.all.q/R1.sai /tmp/3948300.1.all.q/R2.sai /tmp/3948300.1.all.q/trimmed.R1.fastq.gz /tmp/3948300.1.all
.q/trimmed.R2.fastq.gz
...
- ENCFF731VMU.bam
@HD VN:1.4 SO:coordinate
@SQ SN:ERCC-00002 LN:1061
...
@SQ SN:ERCC-00171 LN:505
@SQ SN:chr1 LN:249250621
@SQ SN:chr10 LN:135534747
@SQ SN:chr11 LN:135006516
@SQ SN:chr12 LN:133851895
@SQ SN:chr13 LN:115169878
@SQ SN:chr14 LN:107349540
@SQ SN:chr15 LN:102531392
@SQ SN:chr16 LN:90354753
@SQ SN:chr17 LN:81195210
@SQ SN:chr18 LN:78077248
@SQ SN:chr19 LN:59128983
@SQ SN:chr2 LN:243199373
@SQ SN:chr20 LN:63025520
@SQ SN:chr21 LN:48129895
@SQ SN:chr22 LN:51304566
@SQ SN:chr3 LN:198022430
@SQ SN:chr4 LN:191154276
@SQ SN:chr5 LN:180915260
@SQ SN:chr6 LN:171115067
@SQ SN:chr7 LN:159138663
@SQ SN:chr8 LN:146364022
@SQ SN:chr9 LN:141213431
@SQ SN:chrM LN:16571
@SQ SN:chrX LN:155270560
@SQ SN:chrY LN:59373566
@PG ID:Samtools PN:Samtools CL:perl tophat_bam_xsA_tag_fix.pl tophat_out/accepted_hits.bam | samtools view -bS - | samtools sort - mapped_fixed; samtools merge -h newHeader.sam merged.bam mapped_fixed.bam out/unmapped.bam PP:Tophat VN:VN:0.1.17 (r973:277)
...
- Dominant language
- C
- Stars
- 950
- Forks
- 475
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
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/htslib
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
-
tabix performance Open
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