This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Changing BCF genome coordinates (Picard LiftOverVcf error)

Hello all,

I am trying to convert my BCF files from GrCH38 to GrCH37. I am using Picard LiftOverVcf as it can work with BCF too. The BCF's I'm using are valid, I worked with these files (but only made a BED out of it) already and everything was fine.

My command line is

java -jar "/home/user/binaries/Picard/picard.jar" LiftoverVcf  \
  I=./Input.bcf  O=./Output_GRCH37.bcf  CHAIN=GRCh38_to_GRCh37.chain  \
  REJECT=./rejected_variants.vcf  R=./Homo_sapiens.GRCh37.dna.toplevel.fasta \
  ALLOW_MISSING_FIELDS_IN_HEADER=true

For some reason, it doesn't work and I get the following error message:

Exception in thread "main" htsjdk.tribble.TribbleException$MalformedFeatureFile: Unable to parse header with error: Input stream does not contain a BCF encoded file; BCF magic header info not found, at record 0 with position 0:, for input source: file:./Input.bcf`

The header of my BCF:

bcftools view -h input.bcf | head

##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=chr1,length=248956422>
##Bunch of contigs
##bcftools_viewVersion=1.3+htslib-1.3
##bcftools_viewCommand=view -iFILTER="PASS" -m2 -M2 -O b ./input.bcf
##bcftools_viewCommand=view -h input.bcf
#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT

I initially thought it was because the version of my file was too "new" for Picard, but it gives the same error with the latest build. I am fairly confident I'm inputting the right files as well.

Any thought on how to fix that/my headers?

Thanks a lot!

genome software error sequencing

1 answer

I'm not sure picard/htsjdk can properly handle bcf. Convert the bcf to vcf with bcftools view and retry with a vcf file.

Log in to answer this question.