samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
663 stars 240 forks source link

bcftools call: Segmentation fault. vcfcall.c:597 ` if ( als[1][0]=='<' ) return 0;` #2095

Closed lindenb closed 7 months ago

lindenb commented 8 months ago

Asking for a colleague :-P

He said he used bcftools and mpileup this way:

./bcftools-1.19/bcftools mpileup  -f genome.fasta -I -E -a FORMAT/DP -r 21:9411302-9411302 -T chr21.1kg.phase3.v5a.vcf.gz -Ou in.cram |\
./bcftools-1.19/bcftools call  -Aim -C alleles -T minimal_set.RP.vcf.gz -Ov -

and he got the following error:

Program received signal SIGSEGV, Segmentation fault.

I used gdb to get a backtrace:

#0  0x0000000000477d39 in is_indel (als=0x823c10, nals=1) at vcfcall.c:470
#1  next_line (args=args@entry=0x7fffffffb340) at vcfcall.c:597
#2  0x0000000000479a9d in main_vcfcall (argc=<optimized out>, argv=<optimized out>) at vcfcall.c:1133
#3  0x00001555547f4d85 in __libc_start_main () from /lib64/libc.so.6
#4  0x000000000040e8ce in _start () at main.c:282

the output of mpileup was:

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  SAMPLE
21  9411302 .   G   <*> 0   .   DP=6;I16=4,2,0,0,174,5058,0,0,294,15422,0,0,132,3174,0,0;QS=1,0;MQ0F=0  PL:DP   0,18,140:6

and minimal_set.RP.vcf.gz

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO
21  9411302 rs531010746 G   T   .   PASS    .

is there any way to avoid this error ?

thanks !

pd3 commented 7 months ago

As described in the documentation, the file format for -C alleles -T is expected to be

CHROM\tPOS\tREF,ALT

https://github.com/samtools/bcftools/blob/ad04cdcf552c23e84f745566f667654b0f057f7d/doc/bcftools.txt#L296

I added a check so that the program exits with an informative error message when the format is different.

Thanks for the bug report.