Skip to content
/ hgb Public

A read alignment visualization library for long reads

Notifications You must be signed in to change notification settings

6br/hgb

Repository files navigation

hgb

ci

See jbrowse-plugin-hgb for interactive browser

A hybrid genome browser for zooming out long-read alignments

Screenshots in seconds.

alignments

Integrated with Udon:

udon

Features

  • A light-weight binary to visualize read alignments as PNG/JPG/BMP files.
  • Visualize read alignments more than 100 samples at once.
  • Much more options to visualize read alignments.

Install

If you didn't install Rust/cargo, you need to install rustup.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Library dependencies are the same as amethyst. In addition, HGB requires to use nighty version of rustc.

git clone https://github.com/6br/hgb
cd hgb
rustup override set nightly
cargo build --release
cargo run --release -- vis --help

Usage

The input BAM file must be indexed using samtools index. The input BAM file needed to be calculated MD tag using samtools calmd if mismatches are to be visualized.

samtools calmd -b aln.bam ref.fasta > input1.bam
samtools index input1.bam

Examples

  • A simple example:
cargo run --release -- vis -a test/input1.bam -o fig/output1.png -r chr1:93234-94334

output1

  • A simple example with Udon mode:
cargo run --release -- vis -a test/input1.bam -o fig/output2.png -l -U -r chr1:93234-94334

output2

  • A simple example with two bam files:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output3.png -r chr1:93234-94334

output3

  • A simple example with two bam files of split alignments:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output4.png -r chr1:93234-94334 -s

output4

  • A simple example with two bam files with base colors:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output5.png -r chr1:93234-93334 -B

output5

  • A simple example with two bam files with read quality:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output6.png -r chr1:93234-94334 -q

output6

  • A simple example with two bam files with hidden legends:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output7.png -r chr1:93234-94334 -l

output7

  • A simple example with two bam files within 10x coverages at most:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output8.png -r chr1:93234-94334 -m 10

output8

  • A simple example with two bam files without insertion cigars:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output9.png -r chr1:93234-94334 -I

output9

Advanced Examples

  • A simple example with two distant ranges:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output10.png -r chr1:91234-92334 chr1:93234-94334 

output10

  • A simple example with a custom caption:
cargo run --release -- vis -a test/input1.bam -o fig/output11.png -r chr1:93234-94334 '-<' "Caption"

output11

  • A simple example with bases of a reference genome:
cargo run --release -- vis -a test/input1.bam -! test/hg38.2bit -o fig/output12.png -r chr1:93234-93334

output12

  • A simple example with different preset color:
cargo run --release -- vis -a test/input1.bam -o fig/output13.png -r chr1:93234-94334 -# hgb

output13

  • A simple example with colored by CpG motif:
cargo run --release -- vis -a test/input1.bam -o fig/output14.png -r chr1:93234-94334 -E

output14

  • A simple example with different labels on tracks:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output15.png -r chr1:93234-94334 '-}' "SampleA" "SampleB"

output15

  • A simple example with alignment coverage tracks:
cargo run --release -- vis -a test/input1.bam test/input2.bam -o fig/output16.png -r chr1:93234-94334 -P

output16

  • A simple example with different read colors:
cargo run --release -- vis -a test/input1.bam -o fig/output17.png -r chr1:93234-94334 -n

output17

  • A simple example without rulers:
cargo run --release -- vis -a test/input1.bam -o fig/output18.png -r chr1:93234-94334 -S

output18

  • A simple example with read ids:
cargo run --release -- vis -a test/input1.bam -o fig/output19.png -r chr1:93234-94334 -H

output19

  • A simple example with insertion sequences:
cargo run --release -- vis -a test/input1.bam -o fig/output20.png -r chr1:93234-94334 '-{'

output20

  • A simple example with a frequency bed file:
cargo run --release -- vis -a test/input1.bam -o fig/output21.png -r chr1:93234-94334 -F test/input.bed -P

output21

  • A simple example with a range bed file:
cargo run --release -- vis -a test/input1.bam -o fig/output22.png -r chr1:93234-94334 -J test/input.bed -F test/input.bed -P -S

output22

Gallery

large

jupyter

Author

6br

About

A read alignment visualization library for long reads

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages