bramble 🌿🫐

Quick start

From reads to transcript quantities, through the genome.

0. Align to the genome

Any spliced aligner works. Giving the aligner the annotation's splice junctions helps it place reads at annotated exon boundaries, which is where bramble looks for them. For example:

# short reads: STAR, with the annotation built into the index
STAR --runMode genomeGenerate --genomeDir star_index --genomeFastaFiles genome.fa \
     --sjdbGTFfile annotation.gtf --sjdbOverhang 100
STAR --genomeDir star_index --readFilesIn reads_1.fq reads_2.fq --outSAMtype BAM Unsorted

# long reads: minimap2, with annotated junctions
paftools.js gff2bed annotation.gtf > junctions.bed
minimap2 -ax splice:hq --junc-bed junctions.bed genome.fa reads.fq > genome.sam   # PacBio
minimap2 -ax splice    --junc-bed junctions.bed genome.fa reads.fq > genome.sam   # ONT

HISAT2 works as well. Keep the aligner's secondary alignments: bramble projects them too.

1. Group each read's alignments together

bramble processes all alignments of a read at once, so every record of a read must be next to the others in the input. A coordinate-sorted BAM needs to be collated first:

samtools collate -o genome.collated.bam genome.bam

A BAM sorted by read name (samtools sort -n) works too, and so does aligner output that was never sorted, which normally already keeps each read's records together.

2. Run bramble

Pick the command for your sequencing technology (the presets page explains the difference):

# short reads (Illumina)
bramble genome.collated.bam -G annotation.gtf -o transcriptome.bam -p 8

# PacBio long reads
bramble genome.collated.bam -G annotation.gtf -S genome.fa -o transcriptome.bam --lr-hq -p 8

# Oxford Nanopore long reads
bramble genome.collated.bam -G annotation.gtf -S genome.fa -o transcriptome.bam --lr -p 8

-G is the annotation the reads are projected onto, -o the output BAM, and -p the number of threads. For long reads, -S gives the genome sequence, which bramble uses to rescue soft-clipped read ends; always give it when you have the genome, because it makes long-read quantification more accurate. If your short reads come from a stranded library, also add --rf or --fr. The Rust version takes the same arguments: replace bramble with bramble-rs.

3. Quantify

Give the transcriptome BAM to an alignment-based quantifier, as it is:

# salmon (alignment mode)
salmon quant -t transcripts.fa -l A -a transcriptome.bam -o salmon_out -p 8

# oarfish (long reads)
oarfish -a transcriptome.bam -o oarfish_out -j 8 --filter-group no-filters --model-coverage

For oarfish, use --filter-group no-filters: bramble has already decided which transcripts each read fits, so oarfish's alignment filters are not needed. --model-coverage turns on oarfish's model of read coverage along each transcript.

The output's reference sequences are the transcripts of the annotation, named by their transcript_id. If your quantifier needs transcript sequences, build them from the same annotation so the names match, for example with gffread -w transcripts.fa -g genome.fa annotation.gtf.

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