This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bbMAP truncating problem: converting SAM to BAM?

There is no truncating performed in the SAM file construction. This quickly leads to the inability to convert bbMAP's native SAM output to BAM. The query name the full read name supplied by Polyester during RNASeq dataset construction, which is far beyond the SAM specification of 256 characters maximum. Trying to convert with samtools (or with bbMAP's own BAM output flag) will result in errors.

Is there a way to convert the SAM to BAM with bbMap?

rna-seq alignment bbmap samtools

1 answer

Use the Use reformat.sh from BBMap suite to trim readnames in existing SAM files using trimname=t

trimrname=f             For sam/bam files, trim rname/rnext fields after the first space.

If you want to trim the names during alignment use trd=t

trimreaddescription=f   (trd) Trim the names of reads after the first whitespace.

If you have samtools available in path then following should work:

reformat.sh in=your.sam out=your.bam trimname=t

Log in to answer this question.