Skip to main content

A converter from .bam to .png for specific genomic region.

Project description

 BAMsnap

BAMSNAP is high-performed command-based visualization tool for the aligned BAM file.

Installation

Prerequisites

  • python 3.4+
  • [Pillow (Python Imaging Library)][pil] (5.0.0+)
  • [pysam][ps] (1.8.1+)
  • pyfaidx
  • pytabix

Install with pip

pip install bamsnap

Install with github

git clone https://github.com/parklab/bamsnap
cd bamsnap
python setup.py install

Usage

Simple usage

$ bamsnap -bam test.bam -pos 1:7364529 -out test.png

Options

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -bam [BAM [BAM ...]]  bam file(s)
  -bamlist BAMLIST      list file with bam file paths
  -title [TITLE [TITLE ...]]
                        title (name) of bam file(s)
  -pos [POS [POS ...]]  genomic position (ex. 1:816687-818057, 12:7462545)
  -vcf VCF              list file with genomic positions with VCF format
  -bed BED              list file with genomic positions with BED format
  -out OUT              output file or title of output file
  -imagetype IMAGETYPE  output file type
  -conf CONF            configuration file
  -ref REF              Reference sequence fasta file (ex. hg19.fa)
  -save_image_only      save image only
  -image_dir_name IMAGE_DIR_NAME
                        image directory name
  -draw [DRAW [DRAW ...]]
                        plot (default: -draw coordinates bamplot base gene)
  -bamplot [BAMPLOT [BAMPLOT ...]]
                        plot (default: -bamplot coverage base read)
  -width WIDTH          image file size : width (unit:px)
  -height HEIGHT        image file size : height (unit:px)
  -bgcolor BGCOLOR      background color
  -plot_margin_top PLOT_MARGIN_TOP
                        top margin size of plot
  -plot_margin_bottom PLOT_MARGIN_BOTTOM
                        bottom margin size of plot
  -plot_margin_left PLOT_MARGIN_LEFT
                        left margin size of plot
  -plot_margin_right PLOT_MARGIN_RIGHT
                        right margin size of plot
  -border               draw border in plot
  -read_thickness READ_THICKNESS
                        read thickness (unit:px)
  -read_gap_height READ_GAP_HEIGHT
                        read gap height (unit:px)
  -read_gap_width READ_GAP_WIDTH
                        read gap width (unit:px)
  -read_bgcolor READ_BGCOLOR
                        read background color
  -read_color READ_COLOR
                        read color
  -read_pos_color READ_POS_COLOR
                        positive strand read color
  -read_neg_color READ_NEG_COLOR
                        negative strand read color
  -read_group READ_GROUP
                        read group
  -margin MARGIN        genomic margin size
  -center_line          draw center line
  -no_target_line       do not draw target line
  -base_fontsize BASE_FONTSIZE
                        font size of base plot
  -base_height BASE_HEIGHT
                        base plot height
  -base_margin_top BASE_MARGIN_TOP
                        top margin size of base plot
  -base_margin_bottom BASE_MARGIN_BOTTOM
                        bottom margin size of base plot
  -coverage_height COVERAGE_HEIGHT
                        coverage plot height
  -coverage_fontsize COVERAGE_FONTSIZE
                        coverage font size
  -coverage_vaf COVERAGE_VAF
                        coverage variant allele fraction threshold (default:
                        0.2)
  -coverage_color COVERAGE_COLOR
                        coverage color
  -coverage_bgcolor COVERAGE_BGCOLOR
                        coverage plot background color
  -heatmap_height HEATMAP_HEIGHT
                        coverage heatmap height
  -heatmap_bgcolor HEATMAP_BGCOLOR
                        coverage heatmap plot background color
  -no_title             do not draw label.
  -gene_height GENE_HEIGHT
                        gene plot height
  -gene_fontsize GENE_FONTSIZE
                        font size of gene plot
  -gene_pos_color GENE_POS_COLOR
                        positive strand color
  -gene_neg_color GENE_NEG_COLOR
                        negative strand color
  -coordinates_height COORDINATES_HEIGHT
                        coordinate height
  -coordinates_fontsize COORDINATES_FONTSIZE
                        coordinate font size
  -coordinates_axisloc COORDINATES_AXISLOC
                        coordinate axis location
  -coordinates_bgcolor COORDINATES_BGCOLOR
                        coordinate background color
  -coordinates_labelcolor COORDINATES_LABELCOLOR
                        coordinate label color
  -separated_bam        draw a plot for each bam
  -title_fontsize TITLE_FONTSIZE
                        font size of title
  -debug                turn on the debugging mode
  -silence              don't print any log.

Examples

bamsnap -bam data/test11.bam -pos 1:715348 -out data/ex1
bamsnap -bam data/test11.bam -bed data/region.bed -out data/ex2
bamsnap -bamlist data/bamlist.txt -pos 1:817187 1:817848 -out data/ex3
bamsnap -bamlist data/bamlist.txt -bed data/region2.bed -out data/ex4
bamsnap -bam data/test11.bam -pos 1:715348 -out data/ex1 -draw_gene 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bamsnap-0.2.4.tar.gz (20.7 MB view details)

Uploaded Source

Built Distribution

bamsnap-0.2.4-py3-none-any.whl (20.7 MB view details)

Uploaded Python 3

File details

Details for the file bamsnap-0.2.4.tar.gz.

File metadata

  • Download URL: bamsnap-0.2.4.tar.gz
  • Upload date:
  • Size: 20.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for bamsnap-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c63d8ee036d7d500cf2a4ccfc642aa146b3e0f9961e2e55d2ba0dd7a8c890b01
MD5 1e77eeb1cf3c96eb8f45b5ea1a900629
BLAKE2b-256 96d5d85c970f6a2d1d655934de96e6ff30b6984ef08da8a4f1004123402869ac

See more details on using hashes here.

File details

Details for the file bamsnap-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: bamsnap-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 20.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for bamsnap-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bdf40179d7715c949d53f01c41e94fd97186787b74c6de54bf45552867a2aaac
MD5 acd21033538667d9c706f52738d1208e
BLAKE2b-256 dacfa3ceadd84d071a0fe00ebc39f6ed08c39ee3aed04a8e2b113c802a4470bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page