Category

Sam/Bam Manipulation


Usage

bam2wig.py -s chrom.sizes -i sample.bam -o out [options]


Manual

bam2wig.py converts all types of RNA-seq data from BAM format into wiggle format. If UCSC wigToBigWig tool was found, output wiggle file will be converted into bigwig format automatically. BAM file must be sorted and indexed properly using samtools. Below example shows how to sort and index BAM file using samTools

Options

  • --version: show program's version number and exit
  • -h, --help: show this help message and exit
  • -i INPUT_FILE, --input-file=INPUT_FILE: Alignment file in BAM format. BAM file must be sorted and indexed properly using samtools. .bam and .bai files should be placed in the same directory.
  • -s CHROMSIZE, --chromSize=CHROMSIZE: Chromosome size file. Tab or space separated text file with 2 columns: first column is chromosome name/ID, second column is chromosome size. Chromosome names (such as “chr1”) should be consistent between this file and the BAM file. You can get chromosome size file by using tools like fetchChromSize and twoBitInfo.
  • -o OUTPUT_PREFIX, --out-prefix=OUTPUT_PREFIX: Prefix of output wiggle files(s). One wiggle file will be generated for non strand-specific data, two wiggle files (“Prefix_Forward.wig” and “Prefix_Reverse.wig”) will be generated for strand-specific RNA-seq data.
  • -t TOTAL_WIGSUM, --wigsum=TOTAL_WIGSUM: Specified wigsum. Eg: 1,000,000,000 equals to coverage of 10 million 100nt reads. Ignore this option to disable normalization
  • -u, --skip-multi-hits: Skip non-unique hit reads.
  • -d STRAND_RULE, --strand=STRAND_RULE: How read(s) were stranded during sequencing. For example: --strand='1++,1--,2+-,2-+' means that this is a pair-end, strand-specific RNA-seq data, and the strand rule is:
    • read1 mapped to '+' => parental gene on '+';
    • read1 mapped to '-' => parental gene on '-';
    • read2 mapped to '+' => parental gene on '-';
    • read2 mapped to '-' => parental gene on '+'.

    If you are not sure about the strand rule, run infer_experiment.py. default=none (Not a strand specific RNA-seq data).

  • -q MAP_QUAL, --mapq=MAP_QUAL: Minimum mapping quality for an alignment to be called “uniquely mapped”. default=30

Note

  • Reads aligners, like STAR, can directly generate wig files.
  • If you want to extract only signals at the end of reads, for example transcription start sites or pause sites, you can use tools like PINTS visualizer.


Share your experience or ask a question