bam2wiggle.py - convert bam to wig/bigwig file

Tags

Genomics NGS Intervals Conversion BAM WIGGLE BIGWIG BEDGRAPH

Purpose

convert a bam file to a bigwig or bedgraph file.

Depending on options chosen, this script either computes the densities itself or makes use of faster solutions if possible. The script requires the executables wigToBigWig and bedToBigBed to be in the user’s PATH.

If no –shift-size or –extend option are given, the coverage is computed directly on reads. Counting can be performed at a certain resolution.

The counting currently is not aware of spliced reads, i.e., an inserted intron will be included in the coverage.

If –shift-size or –extend are given, the coverage is computed by shifting read alignment positions upstream for positive strand reads or downstream for negative strand reads and extend them by a fixed amount.

For RNASEQ data it might be best to run genomeCoverageBed directly on the bam file.

Usage

Type:

cgat bam2wiggle           --output-format=bigwig           --output-filename-pattern=out.bigwig in.bam

to convert the bam file file:in.bam to bigwig format and save the result in out.bigwig.

Command line options

usage: bam2wiggle [-h] [--version] [-o {bedgraph,wiggle,bigbed,bigwig,bed}]
                  [-s SHIFT] [-e EXTEND] [-p SPAN] [-m]
                  [--scale-base SCALE_BASE] [--scale-method {none,reads}]
                  [--max-insert-size MAX_INSERT_SIZE]
                  [--min-insert-size MIN_INSERT_SIZE] [--timeit TIMEIT_FILE]
                  [--timeit-name TIMEIT_NAME] [--timeit-header]
                  [--random-seed RANDOM_SEED] [-v LOGLEVEL]
                  [--log-config-filename LOG_CONFIG_FILENAME]
                  [--tracing {function}] [-? ?] [-P OUTPUT_FILENAME_PATTERN]
                  [-F] [-I STDIN] [-L STDLOG] [-E STDERR] [-S STDOUT]
bam2wiggle: error: argument -?: expected one argument