Skip to content
Wang Yunfei edited this page Feb 9, 2017 · 1 revision

SamToWig

SamToWig is used to convert SAM/BAM files to Wiggle files.

  • SAM/BAM files must contain headers.
  • SAM/BAM files are not necessarily sorted.
  • SAM/BAM reads should be uniquely mapped, or only one alignment is reported for each read.
  • This takes huge memory if binsize is too small. (genome_size/binsizefloat_size)(control = true and 2 or 1)
  • wSamToWig.py is independent of NGSLib for user convenient installation.

Strategy

  • SamToWig normalizes SAM/BAM files to same number of reads. (-n 10)
  • background is subtracted. Depth for treatment is set to zero if smaller than that of control.
  • binsize can be specified (-b 50)
  • SamToWig extend reads to fragment length. (-e 150)
  • If input are paired end reads, extension is not necessary. Overlapped pairs are merged into one fragment. (-P)
  • RNA reads are also acceptable. No extension for RNA-Seq reads.
  • Strand specific normalization (-f)
  • Split output file by chromosomes (-s)

Usage

usage: wSamToWig.py [-h] -t chip.bam [chip.bam ...] [-c control] [-b binsize]
                    [-e extend] [-n normedto] [-R] [-P] [-s] [-f] [-p prefix]
                    [-o ourputdir]

Convert BAM file to Wiggle file in specific binsize. Reads are counted
multiple times if not uniquely mapped. Contact Yunfei Wang to report any bugs
(yfwang0405@gmail.com).

Options:
  -h, --help            show this help message and exit
  -t chip.bam [chip.bam ...]
                        The ChIP experiment SAM/BAM file(s).
  -c control            The ChIP control SAM/BAM file.
  -b binsize            Binsize used to generate the Wiggle file. [default=50]
  -e extend             Extend read length by strand. Set "0" if no extension.
                        [default= 150bp]
  -n normedto           Reads normalization . Set "0" if no normalization. Set
                        "10" if want to normalize to 10 M reads. [default= 10]
  -R, --RNASeq          Input is RNA Seq reads. No extension. [default=
                        False].
  -P, --Paired          Input is paired end reads. No extension. [default=
                        False].
  -s, --split           Split wiggle into separate files by chromosomes.
                        [default= False].
  -f, --forcestrand     Force strand. [default= False].
  -p prefix             Prefix to the output file name in format:
                        Prefix_BamFileName_CtlBamFileName.wig. [default= ""]
  -o ourputdir          Directory to put wiggle file(s). [default= "."].

dependency pysam

Clone this wiki locally