schneebergerlab / syri

Synteny and Rearrangement Identifier
https://schneebergerlab.github.io/syri/
MIT License
303 stars 36 forks source link

SAM read error for BAM file from minimap2 #218

Closed pdimens closed 8 months ago

pdimens commented 8 months ago

Hello,

Following the guide on the Syri documentation, when trying to load the alignments into Syri, this error is immediately shot out:

SAM reader - ERROR - Error in reading SAM file: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

The command to generate the alignment was

minimap2 -a -x asm5 -t 10 --MD --eqx reference.fasta query.fasta | samtools sort

Samtools reads the file no problem with samtools view and samtools view -h (or -H). Minimap version:

minimap2 --version
2.26-r1175
lrauschning commented 8 months ago

Hi, thanks for reporting this! Syri uses pysam to read SAM files. Can you check which version of pysam you have installed on your system? you can do this by opening a python command line and typing print(pysam.__version__) after importing pysam with import pysam.

lrauschning commented 8 months ago

Ah also, try calling syri with -F B. Maybe your samtools call is automatically converting the file to BAM format (you can also check by trying to open the file in a text editor).

pdimens commented 8 months ago

Ah, thank you. It seems -F B was the trick.