BamDeal: a comprehensive toolkit for bam manipulation

BamDeal is a full-featured toolkit for comprehensive analysis of bam file,
BamDeal is implemented in C/C++ language, available for Linux and Mac OS X operating system.

1) Download and Install

The new version will be updated and maintained in hewm2008/BamDeal, please click below Link to download the latest version



For linux/Unix static

you can use the statically compiled programs directly

             chmod 755 ./bin/BamDeal_Linux
             ./bin/BamDeal_Linux       # mv BamDeal_Linux    BamDeal

For linux/Unix and macOS compile

Pre-installations of 4 libraries or softs are required before installing BamDeal
1 htslib: samtools-1.12/htslib-1.12 htslib >=1.12
2 g++ : g++ with –std=c++11 > 4.8+ is recommended
3 zlib : zlib > 1.2.3 is recommended
4 R : R with ggplot is recommended

  • To compile BamDeal, do [ ./configure] first, then [make]
  • Final software can be found in the direcoty [bin/BamDeal]
        tar -zxvf  BamDeal-XXX.tar.gz
        cd BamDeal-XXX;
        chmod 755  configure;      ./configure
        mv BamDeal bin/;   ./bin/BamDeal 

Note1: If fail in [./configure], to find library htslib, you can add LDFLAGS to find the htslib library and CXXFLAGS and CFLAGS to find the htslib header [ ./configure LDFLAGS=-L/usr/lib/ CXXFLAGS=-I/usr/include/ CFLAGS=-I/usr/include/];

export ‘LIBRARY/CFLAGS/CXXFLAGS’ environment variables to set the htslib path also can be a way to compile, such : export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH;

Note2: you can use the statically compiled programs directly [chmod 755 ./bin/BamDeal_Linux; ./bin/BamDeal_Linux]

2) Features

Parameter description

Program: BamDeal
Version: 0.26   [email protected]      2021-12-02


                convert        convert tools
                modify         modify tools
                statistics     statistics analysis tools
                visualize      visualize tools for bam

                Help           Show help in detail


Module Function Description
soap2bam soap –> bam/sam Format
bam2soap bam/sam –> soap Format
bam2fq bam/sam –> Fastq Format
bam2fa bam/sam –> Fasta Format


Module Function Description
bamFilter filter low quality read in bam
bamSplit split single/muti-Bam by chr
bamAssign split single/muti-Bam by assign chr
bamCat Merge/Cat diff header muti bam to one bam
bamRand random out partly of bam read
bamSubChr get/remove some chr form bam
bamShiftQ modify seq phred quality in bam
bamLimit Limit big bam to muti subbam by fix line


Module Function Description
Coverage Calculate Genome Coverage/Depth/GC Dis based Bam (v1.32)
BasesCount Calculate Genome every Site’s four base Depth
DeteCNV Detect CNV/Deletion Region by merge Depth info based Bam
DeteSV Detect SV by Pair End Read insert size in Bam
LowDepth GiveOut bed file of low Depth Region(may BigDeletion)
SiteRead Extract the read (with base) covering the SNP site


Module Function Description
StatQC Basic Stat and qualty control,Show gc-depth… result Fig
DepthCov Show pdf Fig of Depth Dis & Depth~Coverage
DepthGC Show pdf Fig of Depth~RefGC
DepthSlide Show Manhattan Fig of Depth sliding Windows along genome

3) Examples

    1. convert

    #convert soap 2 bam 
   ./bin/BamDeal   convert   soap2bam   -InSoap <in.soap> -OutBam <out.bam>  -Dict Ref.fa
    #convert bam 2 soap 
    ./BamDeal  convert   bam2soap   -InFile <in.bam>  -OutPut <Out.soap>
    1. modify

    #  cat diff header bam  to one bam 
    ./BamDeal    modify  bamCat  -InFile A.bam -InFile B.bam  -OutFile C.bam
    #  merge  muti sort bam  to an sort bam 
    ./BamDeal    modify  bamCat  -InList  <bam.Sort.list>  -OutFile <out.sort.bam>  -Merge
    #  split bam by chr 
     ./BamDeal   modify   bamSplit  -InList  <bam.list>  -ReSetHead   -OutDir  ./
    1. statistics

    # detect CNV/Deletion Region based bam file  
      ./BamDeal   statistics  DeteCNV  -List  <bam.list>  -OutPut  <outPrefix>
    # stat coverage and depth each chr 
      ./BamDeal  statistics  Coverage   -List  <bam.list>  -OutPut  <out>  -Ref  Ref.fa  -Stat
    # GiveOut bed file of low Depth Region 
      ./BamDeal   statistics  LowDepth   -InList     <bam.list>  -OutPut  <out.bed>
    1. statistics

    #  Show Manhattan Fig of Depth sliding Windows along genome
      ./BamDeal    visualize  DepthSlide   -InList  <bam.list>  -Ref  <Ref.fa> -OutPut  <outPrefix>
    # Show pdf Fig of Depth~RefGC
       ./BamDeal    visualize DepthGC  -InList  <bam.list>  -Ref  <Ref.fa> -OutPut  <outPrefix>
    # Show pdf Fig of Depth Dis & Depth~Coverage 
     ./BamDeal    visualize DepthCov    -InList     <bam.list> -OutPut  <outPrefix>

see more other Usage in the Documentation

4) Format

Format Introduction

5) Discussing

######################swimming in the sky and flying in the sea ########################### ##


View Github