This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Attempting to generate a sam file that can be converted to a bam file using samtools.

Hi! As the title says I have been trying to generate a bam file using a sam file generated from minimap2. Here is the script I am using to generated the SAM file.

  #Variables
export ASSEMBLY=PATH/BC01_racon3.fasta
export PFX=BC01_BLOB
export READS=PATH/barcode01_trimmed100.fastq

#Commands
PATH/minimap2 -t $SLURM_NTASKS $ASSEMBLY $READS > ${PFX}.sam

Once this file is generated I attempt to use the following:

samtools view -b BC01_BLOB.sam > BC01_BLOB.bam

And I recieve the following error:

[E::sam_parse1] missing SAM header
[W::sam_read1] parse error at line 1
[main_samview] truncated file.

Any help would be greatly appreciated! I just started working in bash recently so I really don't have much experience. I am trying to get a bam file for blobtools.

minimap2 samtools

1 answer

You need to add -a option to create SAM format files to your minimap2 command. By default minimap2 makes PAF format data.

I think the conversion is running now without issue, Thank you so much!

Great. You can accept the answer (green check mark) to provide closure to this thread.

Log in to answer this question.