X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Question: Question: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Neel
2252 days ago

Question: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

whatshap phase -o seeWhat.vcf --reference genome.fa see.vcf genome.fa.sorted.bam

This is WhatsHap 0.17 running under Python 3.6.6
Traceback (most recent call last):
File "/home/anaconda3/bin/whatshap", line 11, in <module>
load_entry_point('whatshap==0.17', 'console_scripts', 'whatshap')()
File "/home/anaconda3/lib/python3.6/site-packages/whatshap/__main__.py", line 83, in main
module.main(args)
File "/home/anaconda3/lib/python3.6/site-packages/whatshap/phase.py", line 1089, in main
run_whatshap(**vars(args))
File "/home/anaconda3/lib/python3.6/site-packages/whatshap/phase.py", line 580, in run_whatshap
out_file=output, tag=tag)
File "/home/anaconda3/lib/python3.6/site-packages/whatshap/vcf.py", line 478, in __init__
self._reader = vcf.Reader(filename=in_path)
File "/home/anaconda3/lib/python3.6/site-packages/vcf/parser.py", line 300, in __init__
self._parse_metainfo()
File "/home/anaconda3/lib/python3.6/site-packages/vcf/parser.py", line 317, in _parse_metainfo
line = next(self.reader)
File "/home/anaconda3/lib/python3.6/site-packages/vcf/parser.py", line 280, in <genexpr>
self.reader = (line.strip() for line in self._reader if line.strip())
File "/home/anaconda3/lib/python3.6/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

 

How to fix this error ? 

Answers
0

I guess, your bam file is zipped.

Try renaming your *.vcf file to *.vcf.gz and run it. Hopefully this will fix the error ...