bramble 🌿🫐

Transcriptome BAM

What bramble writes to the -o file.

bramble writes one BAM file. Each record is one alignment of a read to one transcript, in transcript coordinates: the reference is the transcript, the position counts along the transcript from its 5′ end, and the CIGAR describes the alignment to the transcript's spliced sequence. Reads projected onto a transcript on the minus strand of the genome are reverse-complemented (sequence, qualities and the 0x10 flag), so everything reads along the transcript.

Which records are written

Every mapped input record is projected onto each transcript it is compatible with, and bramble writes one record per compatible transcript. Records that project onto no transcript, and unmapped input records, are not written. When the same genomic alignment lands on the same transcript at the same position more than once, it is written once.

Read pairs

Multiple transcripts: NH, HI and the primary alignment

A read usually fits several transcripts of a gene, so it gets several records. Each read end (a single-end read, or read 1 or read 2 of a pair) has exactly one primary record; the others are secondary (0x100). For long reads, the primary is the highest-scoring transcript. For short reads, and for ties, bramble picks among the best candidates using a fixed hash of the read name, so the choice is the same in every run and in both versions.

Tags

TagMeaning
NHnumber of records of this read end
HIplacement index, shared by the two mates of a pair
ASshort reads: the aligner's AS, unchanged; long reads: rescaled by the similarity score
NMedit distance to the transcript: mismatches (from the input's MD tag, or estimated from its NM) plus the insertions and deletions of the projected alignment

bramble's own tags come first, in this order. They are followed by the input tags that still make sense in transcript space, in their input order: the read group (RG); cell barcode and UMI tags (BC QT CB CR CY MI OX BZ RX QX UB UR UY BX); and base modification tags (MM ML MN Mm Ml). All other input tags describe the genome alignment, such as MD, XS or ts, and are dropped.

Using the output

salmon (alignment mode) and oarfish read the output directly; see Quick start.

Don't sort the output. salmon expects the two mates of a pair next to each other, and sorting by read name (samtools sort -n) separates them; oarfish does not accept coordinate-sorted input.