Pybamview

Browser-based application for viewing bam alignments


snapbam: automatically generate PyBamView snapshots

This page describes how to make alignment snapshots on the command line. It assumes you have already gone through the install instructions.

setup

In addition to installing the PyBamView package, you will also need to install Node.js and its installer npm, available at https://nodejs.org/en/. You then need to install the d3 and jsdom libraries, which can be done by:

npm install npm --global
npm install d3 --global
npm install jsdom --global
Finally, set NODE_PATH to where these libraries have been installed, usually:
export NODE_PATH=/usr/local/lib/node_modules/
To test that this worked, from the command line run:
node -e 'require("d3");require("jsdom");'
If this does not result in errors, you should be ready to go.

example command

To get started with files from the examples download:

snapbam \
    --bam examples/example.sorted.bam \
    --regions examples/example_targets.bed  \
    --zoom 1 \
    --samples mysample \
    --outdir . \
    --filetype html \
    --buffer 100
This will generate html files for each locus in the current directory, e.g. "PentaE.html".

full command line usage

To see the usage information for snapbam, type:
>snapbam --help
Usage: snapbam [options]

Automated generation of pybamview snapshots

Options:
  -h, --help            show this help message and exit
  --bam=BAM             Run Pybamview on this BAM file only. The file must be
                        indexed.
  --bamdir=BAMDIR       Directory to look for bam files. Bam files must be
                        indexed.
  --ref=REF             Path to reference fasta file. If no reference is
                        given, the reference track is displayed as "N"s
  --regions=REGIONS     Bed file with alignment regions to display. Columns:
                        chrom, start, end, name
  --zoom=ZOOM           Zoom level (Options: 1-10, 50, 100)
  --samples=SAMPLES     Comma-separated list of samples to display
  --outdir=OUTDIR       Directory to write output
  --buffer=BUFFER       Include this many nucleotides buffer upstream and
                        downstream. Between 0-500.
  --filetype=FILETYPE   Filetype of snapshots. Options: svg, pdf, html
  --downsample=DOWNSAMPLE
                        Downsample reads to this maximum coverage level.
                        Default: 50. Values over 100 not recommended since it
                        results in poor performance.