BWA DNA mapping工具


BWA 全名 Burrow-Wheeler Aligner,是一款将DNA序列mapping到参考基因组上的软件


yum groupinstall -y 'Development Tools'
yum install -y zlib.x86_64 zlib-devel.x86_64


tar jxvf bwa-0.7.17.tar.bz2
cd bwa-0.7.17
make -j 8


echo 'export PATH=/opt/bwa-0.7.17:$PATH' >> /etc/profile
source /etc/profile


[root@localhost bwa-0.7.17]# ./bwa

Program: bwa (alignment via Burrows-Wheeler transformation)
Version: 0.7.17-r1188
Contact: Heng Li <>

Usage:   bwa <command> [options]

Command: index         index sequences in the FASTA format
         mem           BWA-MEM algorithm
         fastmap       identify super-maximal exact matches
         pemerge       merge overlapping paired ends (EXPERIMENTAL)
         aln           gapped/ungapped alignment
         samse         generate alignment (single ended)
         sampe         generate alignment (paired ended)
         bwasw         BWA-SW for long queries

         shm           manage indices in shared memory
         fa2pac        convert FASTA to PAC format
         pac2bwt       generate BWT from PAC
         pac2bwtgen    alternative algorithm for generating BWT
         bwtupdate     update .bwt to the new format
         bwt2sa        generate SA from BWT and Occ

Note: To use BWA, you need to first index the genome with `bwa index'.
      There are three alignment algorithms in BWA: `mem', `bwasw', and
      `aln/samse/sampe'. If you are not sure which to use, try `bwa mem'
      first. Please `man ./bwa.1' for the manual.


# 建索引
bwa index -a bwtsw -p hg19 hg19.fa 1>hg19.bwa_index.log 2>&1
# 比对 t为线程数量
bwa mem -t 8 -M -R @RG\tID:KPGP-00001_L1\tSM:KPGP-00001_L1\tLB:WGS\tPL:Illumina ~/reference/index/bwa/hg19  KPGP-00001_L1_R1.fq.gz KPGP-00001_L1_R2.fq.gz 1>KPGP-00001_L1.sam 2>KPGP-00001_L1.bwa.align.log

[root@localhost ~]# bwa index  E.coli_K12_MG1655.fa 
[bwa_index] Pack FASTA... 0.04 sec
[bwa_index] Construct BWT for the packed sequence...
[bwa_index] 1.74 seconds elapse.
[bwa_index] Update BWT... 0.03 sec
[bwa_index] Pack forward-only FASTA... 0.02 sec
[bwa_index] Construct SA from BWT and Occ... 0.69 sec
[main] Version: 0.7.17-r1188
[main] CMD: bwa index E.coli_K12_MG1655.fa
[main] Real time: 2.546 sec; CPU: 2.534 sec
[root@localhost ~]# ls -l
-rw-r--r--. 1 root root 4699745 Nov  9 22:05 E.coli_K12_MG1655.fa
-rw-r--r--. 1 root root      12 Nov 10 00:03 E.coli_K12_MG1655.fa.amb
-rw-r--r--. 1 root root      98 Nov 10 00:03 E.coli_K12_MG1655.fa.ann
-rw-r--r--. 1 root root 4641732 Nov 10 00:03 E.coli_K12_MG1655.fa.bwt
-rw-r--r--. 1 root root      29 Nov  9 22:45 E.coli_K12_MG1655.fa.fai
-rw-r--r--. 1 root root 1160415 Nov 10 00:03 E.coli_K12_MG1655.fa.pac
-rw-r--r--. 1 root root 2320880 Nov 10 00:03


Captcha Code