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.
Header
@HD VN:1.6 SO:unsorted GO:query: records are grouped by read, not sorted.- One
@SQline per annotated transcript:SNis the transcript ID andLNthe length of its spliced exons. - The
@PG,@RGand@COlines of the input are copied, and bramble adds its own@PGline.
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
- bramble finds a read's mate from the positions the two records point at
(
POSandPNEXT). When the aligner reports several alignments of a pair at the same positions, as STAR does, the mates are also matched on theirHItag. WithoutHI, positions alone decide. - When both mates project onto some of the same transcripts, bramble writes one pair per
shared transcript, as a proper pair (
0x2) with the mate on the same transcript (RNEXTis=) and a template length. - When the mates share no transcript but each projects onto exactly one, bramble writes one pair across the two transcripts, not a proper pair, with template length 0.
- Otherwise (one mate projects nowhere, or the mates share no transcript and one of them has several), the pair is not written.
- When the mate is unmapped in the input, the mapped read is written on its own, as a
paired read with an unmapped mate (
0x1and0x8). - When the two mates are on different chromosomes, they can't share a transcript, so each is projected and written on its own, in the same way.
- The two mates of a pair are always written next to each other.
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.
NHis the number of records of that read end.HInumbers the read's placements from 1; the two mates of a pair share the sameHI.MAPQfollows fromNH: for short reads 255 for one record, 3 for two, 1 for three or four, and 0 for more; for long reads 3 for one record and 0 for more.
Tags
| Tag | Meaning |
|---|---|
NH | number of records of this read end |
HI | placement index, shared by the two mates of a pair |
AS | short reads: the aligner's AS, unchanged; long reads: rescaled by the similarity score |
NM | edit 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.