[BioC] rsamtools scanBcf segfault

Rob Syme rob.syme at gmail.com
Thu Jul 28 09:08:47 CEST 2011

> Thanks Rob for the nice reproducible example. The problem is when you open
> the BcfFile; 'mode' should be 'rb' to indicate that you want to read a
> binary file. Or leave it unspecified and the heuristic will do the right
> thing.

Thanks Martin, the manual at
includes a minor error that threw me off. The "Usage" section is
correct (and I should have read this more closely), but in the
"Arguments" section, the mode argument is described as:
"A character(1) vector; mode="rw" indicates a binary (BCF) file,
mode="r" a text (VCF) file"
when it should probably be
"A character(1) vector; mode="rb" indicates a binary (BCF) file,
mode="r" a text (VCF) file"

I have another error - and I've had a closer read of the manual this time ;)
I have generated a filtered vcf using freebayes, but the following
commands throw an error:

wget http://gist.github.com/raw/1111101/f8629dfa20b15893684c78a586f321dbc65c6b6c/subset.vcf
grep -v "^#" subset.vcf | cut -f 1 | sort -u > subset.dict
bcftools view -bSD subset.dict subset.vcf > subset.bcf
bcftools index subset.bcf
wget http://gist.github.com/raw/1111101/5684d61541b39fb8c02e765d5f7891d9d122244e/scanBcf_error.R
Rscript scanBcf_error.R

# This gives the error:
Error: scanBcf: failed to find fmt encoded as '21057'
  path: <<redacted>>/subset.bcf
Execution halted

# Calling scanBcfHeader also gives an error:
Error in mapply(f, ..., SIMPLIFY = FALSE) :
  'names' attribute [5] must be the same length as the vector [4]

I can't see anything wrong with the VCF, am I missing something obvious again?

More information about the Bioconductor mailing list