{"id":1399,"date":"2013-06-05T14:51:54","date_gmt":"2013-06-05T06:51:54","guid":{"rendered":"http:\/\/www.hzaumycology.com\/chenlianfu_blog\/?p=1399"},"modified":"2014-02-18T13:21:46","modified_gmt":"2014-02-18T05:21:46","slug":"samtools%e4%bd%bf%e7%94%a8%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"http:\/\/www.chenlianfu.com\/?p=1399","title":{"rendered":"samtools\u5e38\u7528\u547d\u4ee4\u8be6\u89e3"},"content":{"rendered":"<p>samtools\u7684\u8bf4\u660e\u6587\u6863\uff1a<a href=\"http:\/\/samtools.sourceforge.net\/samtools.shtml\" target=\"_blank\">http:\/\/samtools.sourceforge.net\/samtools.shtml<\/a><br \/>\nsamtools\u662f\u4e00\u4e2a\u7528\u4e8e\u64cd\u4f5csam\u548cbam\u6587\u4ef6\u7684\u5de5\u5177\u5408\u96c6\u3002\u5305\u542b\u6709\u8bb8\u591a\u547d\u4ee4\u3002\u4ee5\u4e0b\u662f\u5e38\u7528\u547d\u4ee4\u7684\u4ecb\u7ecd<\/p>\n<h2>1. view<\/h2>\n<p>view\u547d\u4ee4\u7684\u4e3b\u8981\u529f\u80fd\u662f\uff1a\u5c06sam\u6587\u4ef6\u8f6c\u6362\u6210bam\u6587\u4ef6\uff1b\u7136\u540e\u5bf9bam\u6587\u4ef6\u8fdb\u884c\u5404\u79cd\u64cd\u4f5c\uff0c\u6bd4\u5982\u6570\u636e\u7684\u6392\u5e8f(\u4e0d\u5c5e\u4e8e\u672c\u547d\u4ee4\u7684\u529f\u80fd)\u548c\u63d0\u53d6(\u8fd9\u4e9b\u64cd\u4f5c\u662f\u5bf9bam\u6587\u4ef6\u8fdb\u884c\u7684\uff0c\u56e0\u800c\u5f53\u8f93\u5165\u4e3asam\u6587\u4ef6\u7684\u65f6\u5019\uff0c\u4e0d\u80fd\u8fdb\u884c\u8be5\u64cd\u4f5c)\uff1b\u6700\u540e\u5c06\u6392\u5e8f\u6216\u63d0\u53d6\u5f97\u5230\u7684\u6570\u636e\u8f93\u51fa\u4e3abam\u6216sam\uff08\u9ed8\u8ba4\u7684\uff09\u683c\u5f0f\u3002<\/p>\n<p>bam\u6587\u4ef6\u4f18\u70b9\uff1abam\u6587\u4ef6\u4e3a\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5360\u7528\u7684\u78c1\u76d8\u7a7a\u95f4\u6bd4sam\u6587\u672c\u6587\u4ef6\u5c0f\uff1b\u5229\u7528bam\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684\u8fd0\u7b97\u901f\u5ea6\u5feb\u3002<\/p>\n<p>view\u547d\u4ee4\u4e2d\uff0c\u5bf9sam\u6587\u4ef6\u5934\u90e8\u7684\u8f93\u5165(-t\u6216-T\uff09\u548c\u8f93\u51fa(-h)\u662f\u5355\u72ec\u7684\u4e00\u4e9b\u53c2\u6570\u6765\u63a7\u5236\u7684\u3002<\/p>\n<pre>Usage: samtools view [options] &lt;in.bam&gt;|&lt;in.sam&gt; [region1 [...]]\r\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u52a0 region\uff0c\u5219\u662f\u8f93\u51fa\u6240\u6709\u7684 region.\r\n\r\nOptions: -b       output BAM\r\n                  \u9ed8\u8ba4\u4e0b\u8f93\u51fa\u662f SAM \u683c\u5f0f\u6587\u4ef6\uff0c\u8be5\u53c2\u6570\u8bbe\u7f6e\u8f93\u51fa BAM \u683c\u5f0f\r\n         -h       print header for the SAM output\r\n                  \u9ed8\u8ba4\u4e0b\u8f93\u51fa\u7684 sam \u683c\u5f0f\u6587\u4ef6\u4e0d\u5e26 header\uff0c\u8be5\u53c2\u6570\u8bbe\u5b9a\u8f93\u51fasam\u6587\u4ef6\u65f6\u5e26 header \u4fe1\u606f\r\n         -H       print header only (no alignments)\r\n         -S       input is SAM\r\n                  \u9ed8\u8ba4\u4e0b\u8f93\u5165\u662f BAM \u6587\u4ef6\uff0c\u82e5\u662f\u8f93\u5165\u662f SAM \u6587\u4ef6\uff0c\u5219\u6700\u597d\u52a0\u8be5\u53c2\u6570\uff0c\u5426\u5219\u6709\u65f6\u5019\u4f1a\u62a5\u9519\u3002\r\n         -u       uncompressed BAM output (force -b)\r\n                  \u8be5\u53c2\u6570\u7684\u4f7f\u7528\u9700\u8981\u6709-b\u53c2\u6570\uff0c\u80fd\u8282\u7ea6\u65f6\u95f4\uff0c\u4f46\u662f\u9700\u8981\u66f4\u591a\u78c1\u76d8\u7a7a\u95f4\u3002\r\n         -c       Instead of printing the alignments, only count them and print the \r\n                  total number. All filter options, such as \u2018-f\u2019, \u2018-F\u2019 and \u2018-q\u2019 , \r\n                  are taken into account.\r\n         -1       fast compression (force -b)\r\n         -x       output FLAG in HEX (samtools-C specific)\r\n         -X       output FLAG in string (samtools-C specific)\r\n         -c       print only the count of matching records\r\n         -L FILE  output alignments overlapping the input BED FILE [null]\r\n         -t FILE  list of reference names and lengths (force -S) [null]\r\n                  \u4f7f\u7528\u4e00\u4e2alist\u6587\u4ef6\u6765\u4f5c\u4e3aheader\u7684\u8f93\u5165\r\n         -T FILE  reference sequence file (force -S) [null]\r\n                  \u4f7f\u7528\u5e8f\u5217fasta\u6587\u4ef6\u4f5c\u4e3aheader\u7684\u8f93\u5165\r\n         -o FILE  output file name [stdout]\r\n         -R FILE  list of read groups to be outputted [null]\r\n         -f INT   required flag, 0 for unset [0]\r\n         -F INT   filtering flag, 0 for unset [0] \r\n                  Skip alignments with bits present in INT [0]\r\n                  \u6570\u5b574\u4ee3\u8868\u8be5\u5e8f\u5217\u6ca1\u6709\u6bd4\u5bf9\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\r\n                  \u6570\u5b578\u4ee3\u8868\u8be5\u5e8f\u5217\u7684mate\u5e8f\u5217\u6ca1\u6709\u6bd4\u5bf9\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\r\n         -q INT   minimum mapping quality [0]\r\n         -l STR   only output reads in library STR [null]\r\n         -r STR   only output reads in read group STR [null]\r\n         -s FLOAT fraction of templates to subsample; integer part as seed [-1]\r\n         -?       longer help<\/pre>\n<p>\u4f8b\u5b50\uff1a<\/p>\n<pre>\u5c06sam\u6587\u4ef6\u8f6c\u6362\u6210bam\u6587\u4ef6\r\n<span style=\"color: #ff6600;\">$ samtools view -bS abc.sam &gt; abc.bam<\/span>\r\n$ samtools view -b -S abc.sam -o abc.bam\r\n\r\n\u63d0\u53d6\u6bd4\u5bf9\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\u7684\u6bd4\u5bf9\u7ed3\u679c\r\n<span style=\"color: #ff6600;\">$ samtools view -bF 4 abc.bam &gt; abc.F.bam<\/span>\r\n\r\n\u63d0\u53d6paired reads\u4e2d\u4e24\u6761reads\u90fd\u6bd4\u5bf9\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\u7684\u6bd4\u5bf9\u7ed3\u679c\uff0c\u53ea\u9700\u8981\u628a\u4e24\u4e2a4+8\u7684\u503c12\u4f5c\u4e3a\u8fc7\u6ee4\u53c2\u6570\u5373\u53ef\r\n$ samtools view -bF 12 abc.bam &gt; abc.F12.bam\r\n\r\n\u63d0\u53d6\u6ca1\u6709\u6bd4\u5bf9\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\u7684\u6bd4\u5bf9\u7ed3\u679c\r\n$ samtools view -bf 4 abc.bam &gt; abc.f.bam\r\n\r\n\u63d0\u53d6bam\u6587\u4ef6\u4e2d\u6bd4\u5bf9\u5230caffold1\u4e0a\u7684\u6bd4\u5bf9\u7ed3\u679c\uff0c\u5e76\u4fdd\u5b58\u5230sam\u6587\u4ef6\u683c\u5f0f\r\n$ samtools view abc.bam scaffold1 &gt; scaffold1.sam\r\n\r\n\u63d0\u53d6scaffold1\u4e0a\u80fd\u6bd4\u5bf9\u523030k\u5230100k\u533a\u57df\u7684\u6bd4\u5bf9\u7ed3\u679c\r\n<span style=\"color: #ff6600;\">$ samtools view abc.bam scaffold1:30000-100000 $gt; scaffold1_30k-100k.sam<\/span>\r\n\r\n\u6839\u636efasta\u6587\u4ef6\uff0c\u5c06 header \u52a0\u5165\u5230 sam \u6216 bam \u6587\u4ef6\u4e2d\r\n$ samtools view -T genome.fasta -h scaffold1.sam &gt; scaffold1.h.sam<\/pre>\n<h2>2. sort<\/h2>\n<p>sort\u5bf9bam\u6587\u4ef6\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n<pre>Usage: samtools sort [-n] [-m &lt;maxMem&gt;] &lt;in.bam&gt; &lt;out.prefix&gt;  \r\n-m \u53c2\u6570\u9ed8\u8ba4\u4e0b\u662f 500,000,000 \u5373500M\uff08\u4e0d\u652f\u6301K\uff0cM\uff0cG\u7b49\u7f29\u5199\uff09\u3002\u5bf9\u4e8e\u5904\u7406\u5927\u6570\u636e\u65f6\uff0c\u5982\u679c\u5185\u5b58\u591f\u7528\uff0c\u5219\u8bbe\u7f6e\u5927\u70b9\u7684\u503c\uff0c\u4ee5\u8282\u7ea6\u65f6\u95f4\u3002\r\n-n \u8bbe\u5b9a\u6392\u5e8f\u65b9\u5f0f\u6309short reads\u7684ID\u6392\u5e8f\u3002\u9ed8\u8ba4\u4e0b\u662f\u6309\u5e8f\u5217\u5728fasta\u6587\u4ef6\u4e2d\u7684\u987a\u5e8f\uff08\u5373header\uff09\u548c\u5e8f\u5217\u4ece\u5de6\u5f80\u53f3\u7684\u4f4d\u70b9\u6392\u5e8f\u3002<\/pre>\n<p>\u4f8b\u5b50\uff1a<\/p>\n<pre><span style=\"color: #ff6600;\">$ samtools sort abc.bam abc.sort<\/span>\r\n$ samtools view abc.sort.bam | less -S<\/pre>\n<h2>3.merge<\/h2>\n<p>\u5c062\u4e2a\u62162\u4e2a\u4ee5\u4e0a\u7684\u5df2\u7ecfsort\u4e86\u7684bam\u6587\u4ef6\u878d\u5408\u6210\u4e00\u4e2abam\u6587\u4ef6\u3002\u878d\u5408\u540e\u7684\u6587\u4ef6\u4e0d\u9700\u8981\u5219\u662f\u5df2\u7ecfsort\u8fc7\u4e86\u7684\u3002<\/p>\n<pre>Usage:   samtools merge [-nr] [-h inh.sam] &lt;out.bam&gt; &lt;in1.bam&gt; &lt;in2.bam&gt;[...]\r\n\r\nOptions: -n       sort by read names\r\n         -r       attach RG tag (inferred from file names)\r\n         -u       uncompressed BAM output\r\n         -f       overwrite the output BAM if exist\r\n         -1       compress level 1\r\n         -R STR   merge file in the specified region STR [all]\r\n         -h FILE  copy the header in FILE to &lt;out.bam&gt; [in1.bam]\r\n\r\nNote: Samtools' merge does not reconstruct the @RG dictionary in the header. Users\r\n      must provide the correct header with -h, or uses Picard which properly maintains\r\n      the header dictionary in merging.<\/pre>\n<h2>4.index<\/h2>\n<p>\u5fc5\u987b\u5bf9bam\u6587\u4ef6\u8fdb\u884c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u7684\u6392\u5e8f\u540e\uff0c\u624d\u80fd\u8fdb\u884cindex\u3002\u5426\u5219\u4f1a\u62a5\u9519\u3002<\/p>\n<p>\u5efa\u7acb\u7d22\u5f15\u540e\u5c06\u4ea7\u751f\u540e\u7f00\u4e3a.bai\u7684\u6587\u4ef6\uff0c\u7528\u4e8e\u5feb\u901f\u7684\u968f\u673a\u5904\u7406\u3002\u5f88\u591a\u60c5\u51b5\u4e0b\u9700\u8981\u6709bai\u6587\u4ef6\u7684\u5b58\u5728\uff0c\u7279\u522b\u662f\u663e\u793a\u5e8f\u5217\u6bd4\u5bf9\u60c5\u51b5\u4e0b\u3002\u6bd4\u5982samtool\u7684tview\u547d\u4ee4\u5c31\u9700\u8981\uff1bgbrowse2\u663e\u793areads\u7684\u6bd4\u5bf9\u56fe\u5f62\u7684\u65f6\u5019\u4e5f\u9700\u8981\u3002<\/p>\n<pre>Usage: samtools index &lt;in.bam&gt; [out.index]<\/pre>\n<p>\u4f8b\u5b50\uff1a<\/p>\n<pre>\u4ee5\u4e0b\u4e24\u79cd\u547d\u4ee4\u7ed3\u679c\u4e00\u6837\r\n<span style=\"color: #ff6600;\">$ samtools index abc.sort.bam<\/span>\r\n$ samtools index abc.sort.bam abc.sort.bam.bai<\/pre>\n<h2>5. faidx<\/h2>\n<p>\u5bf9fasta\u6587\u4ef6\u5efa\u7acb\u7d22\u5f15,\u751f\u6210\u7684\u7d22\u5f15\u6587\u4ef6\u4ee5.fai\u540e\u7f00\u7ed3\u5c3e\u3002\u8be5\u547d\u4ee4\u4e5f\u80fd\u4f9d\u636e\u7d22\u5f15\u6587\u4ef6\u5feb\u901f\u63d0\u53d6fasta\u6587\u4ef6\u4e2d\u7684\u67d0\u4e00\u6761\uff08\u5b50\uff09\u5e8f\u5217<\/p>\n<pre>Usage: samtools faidx &lt;in.bam&gt; [ [...]]\r\n\r\n\u5bf9\u57fa\u56e0\u7ec4\u6587\u4ef6\u5efa\u7acb\u7d22\u5f15\r\n$ samtools faidx genome.fasta\r\n\u751f\u6210\u4e86\u7d22\u5f15\u6587\u4ef6genome.fasta.fai,\u662f\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\uff0c\u5206\u6210\u4e865\u5217\u3002\u7b2c\u4e00\u5217\u662f\u5b50\u5e8f\u5217\u7684\u540d\u79f0\uff1b\r\n\u7b2c\u4e8c\u5217\u662f\u5b50\u5e8f\u5217\u7684\u957f\u5ea6\uff1b\u4e2a\u4eba\u8ba4\u4e3a\u201c\u7b2c\u4e09\u5217\u662f\u5e8f\u5217\u6240\u5728\u7684\u4f4d\u7f6e\u201d\uff0c\u56e0\u4e3a\u8be5\u6570\u5b57\u4ece\u4e0a\u5f80\u4e0b\u9010\u6e10\u53d8\u5927\uff0c\r\n\u6700\u540e\u7684\u6570\u5b57\u662fgenome.fasta\u6587\u4ef6\u7684\u5927\u5c0f\uff1b\u7b2c4\u548c5\u5217\u4e0d\u77e5\u662f\u5565\u610f\u601d\u3002\u4e8e\u662f\u901a\u8fc7\u6b64\u6587\u4ef6\uff0c\u53ef\u4ee5\u5b9a\r\n\u4f4d\u5b50\u5e8f\u5217\u5728fasta\u6587\u4ef6\u5728\u78c1\u76d8\u4e0a\u7684\u5b58\u653e\u4f4d\u7f6e\uff0c\u76f4\u63a5\u5feb\u901f\u8c03\u51fa\u5b50\u5e8f\u5217\u3002\r\n\r\n\u7531\u4e8e\u6709\u7d22\u5f15\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5f88\u5feb\u4ece\u57fa\u56e0\u7ec4\u4e2d\u63d0\u53d6\u5230fasta\u683c\u5f0f\u7684\u5b50\u5e8f\u5217\r\n$ samtools faidx genome.fasta scffold_10 &gt; scaffold_10.fasta<\/pre>\n<h2>6. tview<\/h2>\n<p>tview\u80fd\u76f4\u89c2\u7684\u663e\u793a\u51fareads\u6bd4\u5bf9\u57fa\u56e0\u7ec4\u7684\u60c5\u51b5\uff0c\u548c\u57fa\u56e0\u7ec4\u6d4f\u89c8\u5668\u6709\u70b9\u7c7b\u4f3c\u3002<\/p>\n<pre>Usage: samtools tview &lt;aln.bam&gt; [ref.fasta]\r\n\r\n\u5f53\u7ed9\u51fa\u53c2\u8003\u57fa\u56e0\u7ec4\u7684\u65f6\u5019\uff0c\u4f1a\u5728\u7b2c\u4e00\u6392\u663e\u793a\u53c2\u8003\u57fa\u56e0\u7ec4\u7684\u5e8f\u5217\uff0c\u5426\u5219\uff0c\u7b2c\u4e00\u6392\u5168\u7528N\u8868\u793a\u3002\r\n\u6309\u4e0b g \uff0c\u5219\u63d0\u793a\u8f93\u5165\u8981\u5230\u8fbe\u57fa\u56e0\u7ec4\u7684\u67d0\u4e00\u4e2a\u4f4d\u70b9\u3002\u4f8b\u5b50\u201cscaffold_10:1000\"\u8868\u793a\u5230\u8fbe\u7b2c\r\n10\u53f7scaffold\u7684\u7b2c1000\u4e2a\u78b1\u57fa\u4f4d\u70b9\u5904\u3002\r\n\u4f7f\u7528H(\u5de6\uff09J\uff08\u4e0a\uff09K\uff08\u4e0b\uff09L\uff08\u53f3\uff09\u79fb\u52a8\u663e\u793a\u754c\u9762\u3002\u5927\u5199\u5b57\u6bcd\u79fb\u52a8\u5feb\uff0c\u5c0f\u5199\u5b57\u6bcd\u79fb\u52a8\u6162\u3002\r\n\u4f7f\u7528\u7a7a\u683c\u5efa\u5411\u5de6\u5feb\u901f\u79fb\u52a8\uff08\u548c L \u7c7b\u4f3c\uff09\uff0c\u4f7f\u7528Backspace\u952e\u5411\u5de6\u5feb\u901f\u79fb\u52a8\uff08\u548c H \u7c7b\u4f3c\uff09\u3002\r\nCtrl+H \u5411\u5de6\u79fb\u52a81kb\u78b1\u57fa\u8ddd\u79bb\uff1b Ctrl+L \u5411\u53f3\u79fb\u52a81kb\u78b1\u57fa\u8ddd\u79bb\r\n\u53ef\u4ee5\u7528\u989c\u8272\u6807\u6ce8\u6bd4\u5bf9\u8d28\u91cf\uff0c\u78b1\u57fa\u8d28\u91cf\uff0c\u6838\u82f7\u9178\u7b49\u300230\uff5e40\u7684\u78b1\u57fa\u8d28\u91cf\u6216\u6bd4\u5bf9\u8d28\u91cf\u4f7f\u7528\u767d\u8272\u8868\u793a\uff1b\r\n20\uff5e30\u9ec4\u8272\uff1b10\uff5e20\u7eff\u8272\uff1b0\uff5e10\u84dd\u8272\u3002\r\n\u4f7f\u7528\u70b9\u53f7'.'\u5207\u6362\u663e\u793a\u78b1\u57fa\u548c\u70b9\u53f7\uff1b\u4f7f\u7528r\u5207\u6362\u663e\u793aread name\u7b49\r\n\u8fd8\u6709\u5f88\u591a\u5176\u5b83\u7684\u4f7f\u7528\u8bf4\u660e\uff0c\u5177\u4f53\u6309 \uff1f \u952e\u6765\u67e5\u770b\u3002<\/pre>\n<h2>7. flagstat<\/h2>\n<p>\u7ed9\u51faBAM\u6587\u4ef6\u7684\u6bd4\u5bf9\u7ed3\u679c<\/p>\n<pre>Usage: samtools flagstat &lt;in.bam&gt;\r\n\r\n$ samtools flagstat example.bam\r\n11945742 + 0 in total (QC-passed reads + QC-failed reads)\r\n#\u603b\u5171\u7684reads\u6570\r\n0 + 0 duplicates\r\n7536364 + 0 mapped (63.09%:-nan%)\r\n#\u603b\u4f53\u4e0areads\u7684\u5339\u914d\u7387\r\n11945742 + 0 paired in sequencing\r\n#\u6709\u591a\u5c11reads\u662f\u5c5e\u4e8epaired reads\r\n5972871 + 0 read1\r\n#reads1\u4e2d\u7684reads\u6570\r\n5972871 + 0 read2\r\n#reads2\u4e2d\u7684reads\u6570\r\n6412042 + 0 properly paired (53.68%:-nan%)\r\n#\u5b8c\u7f8e\u5339\u914d\u7684reads\u6570\uff1a\u6bd4\u5bf9\u5230\u540c\u4e00\u6761\u53c2\u8003\u5e8f\u5217\uff0c\u5e76\u4e14\u4e24\u6761reads\u4e4b\u95f4\u7684\u8ddd\u79bb\u7b26\u5408\u8bbe\u7f6e\u7684\u9608\u503c\r\n6899708 + 0 with itself and mate mapped\r\n#paired reads\u4e2d\u4e24\u6761\u90fd\u6bd4\u5bf9\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\u7684reads\u6570\r\n636656 + 0 singletons (5.33%:-nan%)\r\n#\u5355\u72ec\u4e00\u6761\u5339\u914d\u5230\u53c2\u8003\u5e8f\u5217\u4e0a\u7684reads\u6570\uff0c\u548c\u4e0a\u4e00\u4e2a\u76f8\u52a0\uff0c\u5219\u662f\u603b\u7684\u5339\u914d\u4e0a\u7684reads\u6570\u3002\r\n469868 + 0 with mate mapped to a different chr\r\n#paired reads\u4e2d\u4e24\u6761\u5206\u522b\u6bd4\u5bf9\u5230\u4e24\u6761\u4e0d\u540c\u7684\u53c2\u8003\u5e8f\u5217\u7684reads\u6570\r\n243047 + 0 with mate mapped to a different chr (mapQ&gt;=5)<\/pre>\n<p>#\u540c\u4e0a\u4e00\u4e2a\uff0c\u53ea\u662f\u5176\u4e2d\u6bd4\u5bf9\u8d28\u91cf&gt;=5\u7684reads\u7684\u6570\u91cf<\/p>\n<h2>7. depth<\/h2>\n<p>\u5f97\u5230\u6bcf\u4e2a\u78b1\u57fa\u4f4d\u70b9\u7684\u6d4b\u5e8f\u6df1\u5ea6,\u5e76\u8f93\u51fa\u5230\u6807\u51c6\u8f93\u51fa\u3002<\/p>\n<pre>Usage: bam2depth [-r reg] [-q baseQthres] [-Q mapQthres] [-b in.bed] &lt;in1.bam&gt; [...]<\/pre>\n<h2>8. \u5176\u5b83\u6709\u7528\u7684\u547d\u4ee4<\/h2>\n<p>reheader \u66ff\u6362bam\u6587\u4ef6\u7684\u5934<\/p>\n<pre>$ samtools reheader &lt;in.header.sam&gt; &lt;in.bam&gt;<\/pre>\n<p>cat \u8fde\u63a5\u591a\u4e2abam\u6587\u4ef6\uff0c\u9002\u7528\u4e8e\u975esorted\u7684bam\u6587\u4ef6<\/p>\n<pre>$ samtools cat [-h header.sam] [-o out.bam] &lt;in1.bam&gt; &lt;in2.bam&gt; [ ... ]<\/pre>\n<p>idxstats \u7edf\u8ba1\u4e00\u4e2a\u8868\u683c\uff0c4\u5217\uff0c\u5206\u522b\u4e3a&#8221;\u5e8f\u5217\u540d\uff0c\u5e8f\u5217\u957f\u5ea6\uff0c\u6bd4\u5bf9\u4e0a\u7684reads\u6570\uff0cunmapped reads number&#8221;\u3002\u7b2c4\u5217\u5e94\u8be5\u662fpaired reads\u4e2d\u6709\u4e00\u7aef\u80fd\u5339\u914d\u5230\u8be5scaffold\u4e0a\uff0c\u800c\u53e6\u5916\u4e00\u7aef\u4e0d\u5339\u914d\u5230\u4efb\u4f55scaffolds\u4e0a\u7684reads\u6570\u3002<\/p>\n<pre>$ samtools idxstats &lt;aln.bam&gt;<\/pre>\n<h2>9. \u5c06bam\u6587\u4ef6\u8f6c\u6362\u4e3afastq\u6587\u4ef6<\/h2>\n<p>\u6709\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u63d0\u53d6\u51fa\u6bd4\u5bf9\u5230\u4e00\u6bb5\u53c2\u8003\u5e8f\u5217\u7684reads\uff0c\u8fdb\u884c\u5c0f\u8303\u56f4\u7684\u5206\u6790\uff0c\u4ee5\u5229\u4e8edebug\u7b49\u3002\u8fd9\u65f6\u9700\u8981\u5c06bam\u6216sam\u6587\u4ef6\u8f6c\u6362\u4e3afastq\u683c\u5f0f\u3002<br \/>\n\u8be5\u7f51\u7ad9\u63d0\u4f9b\u4e86\u4e00\u4e2abam\u8f6c\u6362\u4e3afastq\u7684\u7a0b\u5e8f\uff1a<a href=\"http:\/\/www.hudsonalpha.org\/gsl\/information\/software\/bam2fastq\">http:\/\/www.hudsonalpha.org\/gsl\/information\/software\/bam2fastq<\/a><\/p>\n<pre>$ wget http:\/\/www.hudsonalpha.org\/gsl\/static\/software\/bam2fastq-1.1.0.tgz\r\n$ tar zxf bam2fastq-1.1.0.tgz\r\n$ cd bam2fastq-1.1.0\r\n$ make\r\n$ .\/bam2fastq &lt;in.bam&gt;<\/pre>\n<h2>10. mpileup<\/h2>\n<p>samtools\u8fd8\u6709\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u547d\u4ee4mpileup\uff0c\u4ee5\u524d\u4e3apileup\u3002\u8be5\u547d\u4ee4\u7528\u4e8e\u751f\u6210bcf\u6587\u4ef6\uff0c\u518d\u4f7f\u7528bcftools\u8fdb\u884cSNP\u548cIndel\u7684\u5206\u6790\u3002bcftools\u662fsamtool\u4e2d\u9644\u5e26\u7684\u8f6f\u4ef6\uff0c\u5728samtools\u7684\u5b89\u88c5\u6587\u4ef6\u5939\u4e2d\u53ef\u4ee5\u627e\u5230\u3002<\/p>\n<p>\u6700\u5e38\u7528\u7684\u53c2\u6570\u67092\uff1a -f \u6765\u8f93\u5165\u6709\u7d22\u5f15\u6587\u4ef6\u7684fasta\u53c2\u8003\u5e8f\u5217\uff1b -g \u8f93\u51fa\u5230bcf\u683c\u5f0f\u3002\u7528\u6cd5\u548c\u6700\u7b80\u5355\u7684\u4f8b\u5b50\u5982\u4e0b<\/p>\n<pre>Usage: samtools mpileup [-EBug] [-C <i>capQcoef<\/i>] [-r <i>reg<\/i>] [-f <i>in.fa<\/i>] [-l <i>list<\/i>] [-M <i>capMapQ<\/i>] [-Q <i>minBaseQ<\/i>] [-q <i>minMapQ<\/i>] <i>in.bam<\/i> [<i>in2.bam<\/i> [<i>...<\/i>]]\r\n\r\n$ samtools mpileup -f genome.fasta abc.bam &gt; abc.txt\r\n<span style=\"color: #ff6600;\">$ samtools mpileup -gSDf genome.fasta abc.bam &gt; abc.bcf\r\n$ samtools mpileup -guSDf genome.fasta abc.bam | \\\r\n           bcftools view -cvNg - &gt; abc.vcf<\/span><\/pre>\n<p>mpileup\u4e0d\u4f7f\u7528-u\u6216-g\u53c2\u6570\u65f6\uff0c\u5219\u4e0d\u751f\u6210\u4e8c\u8fdb\u5236\u7684bcf\u6587\u4ef6\uff0c\u800c\u751f\u6210\u4e00\u4e2a\u6587\u672c\u6587\u4ef6(\u8f93\u51fa\u5230\u6807\u51c6\u8f93\u51fa)\u3002\u8be5\u6587\u672c\u6587\u4ef6\u7edf\u8ba1\u4e86\u53c2\u8003\u5e8f\u5217\u4e2d\u6bcf\u4e2a\u78b1\u57fa\u4f4d\u70b9\u7684\u6bd4\u5bf9\u60c5\u51b5\uff1b\u8be5\u6587\u4ef6\u6bcf\u4e00\u884c\u4ee3\u8868\u4e86\u53c2\u8003\u5e8f\u5217\u4e2d\u67d0\u4e00\u4e2a\u78b1\u57fa\u4f4d\u70b9\u7684\u6bd4\u5bf9\u7ed3\u679c\u3002\u6bd4\u5982\uff1a<\/p>\n<pre>scaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2841\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 ,,,...,....\u00a0\u00a0\u00a0\u00a0 BHIGDGIJ?FF\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2842\u00a0\u00a0\u00a0 C\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 12\u00a0\u00a0\u00a0\u00a0\u00a0 ,$,,...,....^I. CFGEGEGGCFF+\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2843\u00a0\u00a0\u00a0 G\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 ,,...,.....\u00a0\u00a0\u00a0\u00a0 FDDDDCD?DD+\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2844\u00a0\u00a0\u00a0 G\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 ,,...,.....\u00a0\u00a0\u00a0\u00a0 FA?AAAA&lt;AA+\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2845\u00a0\u00a0\u00a0 G\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 ,,...,.....\u00a0\u00a0\u00a0\u00a0 F656666166*\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2846\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 ,,...,.....\u00a0\u00a0\u00a0\u00a0 (1.1111)11*\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2847\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 ,,+9acggtgaag.+9ACGGTGAAT.+9ACGGTGAAG.+9ACGGTGAAG,+9acggtgaag.+9ACGGTGAAG.+9ACGGTGAAG.+9ACGGTGAAG.+9ACGGTGAAG.+9ACGGTGAAG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 %.+....-..)\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2848\u00a0\u00a0\u00a0 N\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 agGGGgGGGGG\u00a0\u00a0\u00a0\u00a0 !!$!!!!!!!!\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2849\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 11\u00a0\u00a0\u00a0\u00a0\u00a0 c$,...,.....\u00a0\u00a0\u00a0 !0000000000\r\nscaffold_1\u00a0\u00a0\u00a0\u00a0\u00a0 2850\u00a0\u00a0\u00a0 A\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10\u00a0\u00a0\u00a0\u00a0\u00a0 ,...,.....\u00a0\u00a0\u00a0\u00a0\u00a0 353333333<\/pre>\n<p>mpileup\u751f\u6210\u7684\u7ed3\u679c\u5305\u542b6\u884c\uff1a\u53c2\u8003\u5e8f\u5217\u540d\uff1b\u4f4d\u7f6e\uff1b\u53c2\u8003\u78b1\u57fa\uff1b\u6bd4\u5bf9\u4e0a\u7684reads\u6570\uff1b\u6bd4\u5bf9\u60c5\u51b5\uff1b\u6bd4\u5bf9\u4e0a\u7684\u78b1\u57fa\u7684\u8d28\u91cf\u3002\u5176\u4e2d\u7b2c5\u5217\u6bd4\u8f83\u590d\u6742,\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n<p>1 &#8216;.&#8217;\u4ee3\u8868\u4e0e\u53c2\u8003\u5e8f\u5217\u6b63\u94fe\u5339\u914d\u3002<br \/>\n2 &#8216;,&#8217;\u4ee3\u8868\u4e0e\u53c2\u8003\u5e8f\u5217\u8d1f\u94fe\u5339\u914d\u3002<br \/>\n3 &#8216;ATCGN&#8217;\u4ee3\u8868\u5728\u6b63\u94fe\u4e0a\u7684\u4e0d\u5339\u914d\u3002<br \/>\n4 &#8216;atcgn&#8217;\u4ee3\u8868\u5728\u8d1f\u94fe\u4e0a\u7684\u4e0d\u5339\u914d\u3002<br \/>\n5 &#8216;*&#8217;\u4ee3\u8868\u6a21\u7cca\u78b1\u57fa<br \/>\n6 &#8216;^&#8217;\u4ee3\u8868\u5339\u914d\u7684\u78b1\u57fa\u662f\u4e00\u4e2aread\u7684\u5f00\u59cb\uff1b&#8217;^&#8217;\u540e\u9762\u7d27\u8ddf\u7684ascii\u7801\u51cf\u53bb33\u4ee3\u8868\u6bd4\u5bf9\u8d28\u91cf\uff1b\u8fd9\u4e24\u4e2a\u7b26\u53f7\u4fee\u9970\u7684\u662f\u540e\u9762\u7684\u78b1\u57fa\uff0c\u5176\u540e\u7d27\u8ddf\u7684\u78b1\u57fa(.,ATCGatcgNn)\u4ee3\u8868\u8be5read\u7684\u7b2c\u4e00\u4e2a\u78b1\u57fa\u3002<br \/>\n7 &#8216;$&#8217;\u4ee3\u8868\u4e00\u4e2aread\u7684\u7ed3\u675f\uff0c\u8be5\u7b26\u53f7\u4fee\u9970\u7684\u662f\u5176\u524d\u9762\u7684\u78b1\u57fa\u3002<br \/>\n8 \u6b63\u5219\u5f0f&#8217;\\+[0-9]+[ACGTNacgtn]+&#8217;\u4ee3\u8868\u5728\u8be5\u4f4d\u70b9\u540e\u63d2\u5165\u7684\u78b1\u57fa\uff1b\u6bd4\u5982\u4e0a\u4f8b\u4e2d\u5728scaffold_1\u76842847\u540e\u63d2\u5165\u4e869\u4e2a\u957f\u5ea6\u7684\u78b1\u57faacggtgaag\u3002\u8868\u660e\u6b64\u5904\u6781\u53ef\u80fd\u662findel\u3002<br \/>\n9 \u6b63\u5219\u5f0f&#8217;-[0-9]+[ACGTNacgtn]+&#8217;\u4ee3\u8868\u5728\u8be5\u4f4d\u70b9\u540e\u7f3a\u5931\u7684\u78b1\u57fa\uff1b<\/p>\n<p>pileup\u5177\u4f53\u7684\u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n<pre>\u8f93\u5165\u53c2\u6570\r\n-6       Assume the quality is in the Illumina 1.3+ encoding. -A Do not skip anomalous read pairs in variant calling. \r\n-B       Disable probabilistic realignment for the computation of base alignment quality (BAQ). BAQ is the Phred-scaled probability of a read base being misaligned. Applying this option greatly helps to reduce false SNPs caused by misalignments. \r\n-b FILE  List of input BAM files, one file per line [null]\r\n-C INT   Coefficient for downgrading mapping quality for reads containing excessive mismatches. Given a read with a phred-scaled probability q of being generated from the mapped position, the new mapping quality is about sqrt((INT-q)\/INT)*INT. A zero value disables this functionality; if enabled, the recommended value for BWA is 50. [0] \r\n-d INT   At a position, read maximally INT reads per input BAM. [250] \r\n-E       Extended BAQ computation. This option helps sensitivity especially for MNPs, but may hurt specificity a little bit. \r\n<span style=\"color: #ff00ff;\">-f FILE<\/span>  The faidx-indexed reference file in the FASTA format. The file can be optionally compressed by razip. [null] \r\n-l FILE  BED or position list file containing a list of regions or sites where pileup or BCF should be generated [null] \r\n-M INT\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cap mapping quality at INT [60]\r\n-q INT \tMinimum mapping quality for an alignment to be used [0] \r\n-Q INT \tMinimum base quality for a base to be considered [13]\r\n-r STR \tOnly generate pileup in region STR [all sites] \r\n\r\n\u8f93\u51fa\u53c2\u6570\r\n-D \tOutput per-sample read depth (require -g\/-u)\r\n<span style=\"color: #ff00ff;\">-g<\/span> \tCompute genotype likelihoods and output them in the binary call format (BCF). \r\n-S \tOutput per-sample Phred-scaled strand bias P-value\u00a0(require -g\/-u) \r\n-u \tSimilar to -g except that the output is uncompressed BCF, which is preferred for piping. \r\n\r\nOptions for Genotype Likelihood Computation (for -g or -u):\r\n-e INT \tPhred-scaled gap extension sequencing error probability. Reducing INT leads to longer indels. [20] \r\n-h INT \tCoefficient for modeling homopolymer errors. Given an l-long homopolymer run, the sequencing error of an indel of size s is modeled as INT*s\/l. [100] \r\n<span style=\"color: #ff00ff;\">-I<\/span> \tDo not perform INDEL calling \r\n-L INT \tSkip INDEL calling if the average per-sample depth is above INT. [250] \r\n-o INT \tPhred-scaled gap open sequencing error probability. Reducing INT leads to more indel calls. [40] \r\n-P STR \tComma dilimited list of platforms (determined by @RG-PL) from which indel candidates are obtained. It is recommended to collect indel candidates from sequencing technologies that have low indel error rate such as ILLUMINA. [all]<\/pre>\n<h2>11. \u4f7f\u7528bcftools<\/h2>\n<p>bcftools\u548csamtools\u7c7b\u4f3c\uff0c\u7528\u4e8e\u5904\u7406vcf(variant call format)\u6587\u4ef6\u548cbcf(binary call format)\u6587\u4ef6\u3002\u524d\u8005\u4e3a\u6587\u672c\u6587\u4ef6\uff0c\u540e\u8005\u4e3a\u5176\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<p>bcftools\u4f7f\u7528\u7b80\u5355\uff0c\u6700\u4e3b\u8981\u7684\u547d\u4ee4\u662fview\u547d\u4ee4\uff0c\u5176\u6b21\u8fd8\u6709index\u548ccat\u7b49\u547d\u4ee4\u3002index\u548ccat\u547d\u4ee4\u548csamtools\u4e2d\u7c7b\u4f3c\u3002\u6b64\u5904\u4e3b\u8bb2\u4f7f\u7528view\u547d\u4ee4\u6765\u8fdb\u884cSNP\u548cIndel calling\u3002\u8be5\u547d\u4ee4\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u4f8b\u5b50\u4e3a\uff1a<\/p>\n<pre>$ bcftools view [-AbFGNQSucgv] [-D <i>seqDict<\/i>] [-l <i>listLoci<\/i>] [-s <i>listSample<\/i>] \r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 [-i <i>gapSNPratio<\/i>] [-t <i>mutRate<\/i>] [-p <i>varThres<\/i>] [-P <i>prior<\/i>] \r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 [-1 <i>nGroup1<\/i>] [-d <i>minFrac<\/i>] [-U <i>nPerm<\/i>] [-X <i>permThres<\/i>] \r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 [-T <i>trioType<\/i>] <i>in.bcf<\/i> [<i>region<\/i>]\r\n\r\n<span style=\"color: #ff6600;\">$ bcftools view -cvNg abc.bcf &gt; snp_indel.vcf<\/span><\/pre>\n<p>\u751f\u6210\u7684\u7ed3\u679c\u6587\u4ef6\u4e3avcf\u683c\u5f0f\uff0c\u670910\u5217\uff0c\u5206\u522b\u662f\uff1a1 \u53c2\u8003\u5e8f\u5217\u540d\uff1b2 varianti\u6240\u5728\u7684left-most\u4f4d\u7f6e\uff1b3 variant\u7684ID\uff08\u9ed8\u8ba4\u672a\u8bbe\u7f6e\uff0c\u7528&#8217;.&#8217;\u8868\u793a)\uff1b4 \u53c2\u8003\u5e8f\u5217\u7684allele\uff1b5 variant\u7684allele(\u6709\u591a\u4e2aalleles\uff0c\u5219\u7528&#8217;,&#8217;\u5206\u9694);6 variant\/reference QUALity;7 FILTers applied;8 variant\u7684\u4fe1\u606f\uff0c\u4f7f\u7528\u5206\u53f7\u9694\u5f00\uff1b9 FORMAT of the genotype fields, separated by colon (optional)\uff1b 10 SAMPLE genotypes and per-sample information (optional)\u3002<br \/>\n\u4f8b\u5982\uff1a<\/p>\n<pre>scaffold_1      2847    .       A       AACGGTGAAG      194     .       INDEL;DP=11;VDB=0.0401;AF1=1;AC1=2;DP4=0,0,8,3;MQ=35;FQ=-67.5   GT:PL:GQ        1\/1:235,33,0:63\r\nscaffold_1      3908    .       G       A       111     .       DP=13;VDB=0.0085;AF1=1;AC1=2;DP4=0,0,5,7;MQ=42;FQ=-63   GT:PL:GQ        1\/1:144,36,0:69\r\nscaffold_1      4500    .       A       G       31.5    .       DP=8;VDB=0.0034;AF1=1;AC1=2;DP4=0,0,1,3;MQ=42;FQ=-39    GT:PL:GQ        1\/1:64,12,0:21\r\nscaffold_1      4581    .       TGGNGG  TGG     145     .       INDEL;DP=8;VDB=0.0308;AF1=1;AC1=2;DP4=0,0,0,8;MQ=42;FQ=-58.5    GT:PL:GQ        1\/1:186,24,0:45\r\nscaffold_1      4644    .       G       A       195     .       DP=21;VDB=0.0198;AF1=1;AC1=2;DP4=0,0,10,10;MQ=42;FQ=-87 GT:PL:GQ        1\/1:228,60,0:99\r\nscaffold_1      4827    .       NACAAAGA        NA      4.42    .       INDEL;DP=1;AF1=1;AC1=2;DP4=0,0,1,0;MQ=40;FQ=-37.5       GT:PL:GQ        0\/1:40,3,0:3\r\nscaffold_1      4854    .       A       G       48      .       DP=6;VDB=0.0085;AF1=1;AC1=2;DP4=0,0,2,1;MQ=41;FQ=-36    GT:PL:GQ        1\/1:80,9,0:16\r\nscaffold_1      5120    .       A       G       85      .       DP=8;VDB=0.0355;AF1=1;AC1=2;DP4=0,0,5,3;MQ=42;FQ=-51    GT:PL:GQ        1\/1:118,24,0:45<\/pre>\n<p>\u7b2c8\u5217\u4e2d\u663e\u793a\u4e86\u5bf9variants\u7684\u4fe1\u606f\u63cf\u8ff0\uff0c\u6bd4\u8f83\u91cd\u8981\uff0c\u5176\u4e2d\u7684 Tag \u7684\u63cf\u8ff0\u5982\u4e0b\uff1a<\/p>\n<pre>Tag\tFormat\tDescription\r\nAF1\tdouble\tMax-likelihood estimate of the site allele frequency (AF) of the first ALT allele\r\nDP\tint\tRaw read depth (without quality filtering)\r\nDP4\tint[4]\t# high-quality reference forward bases, ref reverse, alternate for and alt rev bases\r\nFQ\tint\tConsensus quality. Positive: sample genotypes different; negative: otherwise\r\nMQ\tint\tRoot-Mean-Square mapping quality of covering reads\r\nPC2\tint[2]\tPhred probability of AF in group1 samples being larger (,smaller) than in group2\r\nPCHI2\tdouble\tPosterior weighted chi^2 P-value between group1 and group2 samples\r\nPV4\tdouble[4]\tP-value for strand bias, baseQ bias, mapQ bias and tail distance bias\r\nQCHI2\tint\tPhred-scaled PCHI2\r\nRP\tint\t# permutations yielding a smaller PCHI2\r\nCLR\tint\tPhred log ratio of genotype likelihoods with and without the trio\/pair constraint\r\nUGT\tstring\tMost probable genotype configuration without the trio constraint\r\nCGT\tstring\tMost probable configuration with the trio constraint<\/pre>\n<p>bcftools view \u7684\u5177\u4f53\u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n<pre>Input\/Output Options:\r\n-A \tRetain all possible alternate alleles at variant sites. By default, the view command discards unlikely alleles.\r\n-b \tOutput in the BCF format. The default is VCF.\r\n-D FILE Sequence dictionary (list of chromosome names) for VCF-&gt;BCF conversion [null]\r\n-F \tIndicate PL is generated by r921 or before (ordering is different).\r\n-G \tSuppress all individual genotype information.\r\n-l FILE List of sites at which information are outputted [all sites]\r\n<span style=\"color: #ff00ff;\">-N<\/span> \tSkip sites where the REF field is not A\/C\/G\/T\r\n-Q \tOutput the QCALL likelihood format\r\n-s FILE List of samples to use. The first column in the input gives the sample names and the second gives the ploidy, which can only be 1 or 2. When the 2nd column is absent, the sample ploidy is assumed to be 2. In the output, the ordering of samples will be identical to the one in FILE. [null]\r\n-S \tThe input is VCF instead of BCF.\r\n-u \tUncompressed BCF output (force -b). \r\n\r\nConsensus\/Variant Calling Options:\r\n<span style=\"color: #ff00ff;\">-c<\/span> \tCall variants using Bayesian inference. This option automatically invokes option -e.\r\n<span style=\"color: #ff00ff;\">-d FLOAT<\/span> When -v is in use, skip loci where the fraction of samples covered by reads is below FLOAT. [0]\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u5f53\u6709\u591a\u4e2asample\u7528\u4e8evariants calling\u65f6\uff0c\u6bd4\u5982\u591a\u4e2a\u8f6c\u5f55\u7ec4\u6570\u636e\u6216\u591a\u4e2a\u91cd\u6d4b\u5e8f\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u6570\u636e\u9700\u8981\u6bd4\u5bf9\u5230\u53c2\u8003\u57fa\u56e0\u7ec4\u4e0a\uff0c\u8bbe\u7f6e\u8be5\u503c\uff0c\u8868\u660e\u81f3\u5c11\u6709\u8be5&lt;float 0~1&gt;\u6bd4\u4f8b\u7684\r\n\u00a0 \u00a0 \u00a0 \u00a0 samples\u5728\u8be5\u4f4d\u70b9\u90fd\u6709\u8986\u76d6\u624d\u8ba1\u7b97\u5165variant.\u6240\u4ee5\u5bf9\u4e8e\u53ea\u6709\u4e00\u4e2asample\u7684\u60c5\u51b5\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u4e0b\uff0c\u8be5\u503c\u8bbe\u7f6e\u57280\uff5e1\u4e4b\u95f4\u6ca1\u6709\u610f\u4e49\uff0c\u5927\u4e8e1\u5219\u5f97\u4e0d\u5230\u4efb\u4f55\u7ed3\u679c\u3002\r\n<span style=\"color: #ff00ff;\">-e<\/span> \tPerform max-likelihood inference only, including estimating the site allele frequency, testing Hardy-Weinberg equlibrium and testing associations with LRT.\r\n-g \tCall per-sample genotypes at variant sites (force -c)\r\n-i FLOAT Ratio of INDEL-to-SNP mutation rate [0.15]\r\n-p FLOAT A site is considered to be a variant if P(ref|D)\r\n-t FLOAT Scaled muttion rate for variant calling [0.001]\r\n-T STR \tEnable pair\/trio calling. For trio calling, option -s is usually needed to be applied to configure the trio members and their ordering. In the file supplied to the option -s, the first sample must be the child, the second the father and the third the mother. The valid values of STR are \u2018pair\u2019, \u2018trioauto\u2019, \u2018trioxd\u2019 and \u2018trioxs\u2019, where \u2018pair\u2019 calls differences between two input samples, and \u2018trioxd\u2019 (\u2018trioxs\u2019) specifies that the input is from the X chromosome non-PAR regions and the child is a female (male). [null]\r\n<span style=\"color: #ff00ff;\">-v<\/span> \tOutput variant sites only (force -c) \r\n\r\nContrast Calling and Association Test Options:\r\n-1 INT \tNumber of group-1 samples. This option is used for dividing the samples into two groups for contrast SNP calling or association test. When this option is in use, the following VCF INFO will be outputted: PC2, PCHI2 and QCHI2. [0]\r\n-U INT \tNumber of permutations for association test (effective only with -1) [0]\r\n-X FLOAT Only perform permutations for P(chi^2)<\/pre>\n<p>\u4f7f\u7528bcftools\u5f97\u5230variant calling\u7ed3\u679c\u540e\u3002\u9700\u8981\u5bf9\u7ed3\u679c\u518d\u6b21\u8fdb\u884c\u8fc7\u6ee4\u3002\u4e3b\u8981\u4f9d\u636e\u6bd4\u5bf9\u7ed3\u679c\u4e2d\u7b2c8\u5217\u4fe1\u606f\u3002\u5176\u4e2d\u7684 DP4 \u4e00\u884c\u5c24\u4e3a\u91cd\u8981\uff0c\u63d0\u4f9b\u4e864\u4e2a\u6570\u636e\uff1a1 \u6bd4\u5bf9\u7ed3\u679c\u548c\u6b63\u94fe\u4e00\u81f4\u7684reads\u6570\u30012 \u6bd4\u5bf9\u7ed3\u679c\u548c\u8d1f\u94fe\u4e00\u81f4\u7684reads\u6570\u30013 \u6bd4\u5bf9\u7ed3\u679c\u5728\u6b63\u94fe\u7684variant\u4e0a\u7684reads\u6570\u30014 \u6bd4\u5bf9\u7ed3\u679c\u5728\u8d1f\u94fe\u7684variant\u4e0a\u7684reads\u6570\u3002\u53ef\u4ee5\u8bbe\u5b9a \uff08value3 + value4\uff09\u5927\u4e8e\u67d0\u4e00\u9608\u503c\uff0c\u624d\u7b97\u662fvariant\u3002\u6bd4\u5982\uff1a<\/p>\n<pre>$ perl -ne 'print $_ if \/DP4=(\\d+),(\\d+),(\\d+),(\\d+)\/ &amp;&amp; ($3+$4)&gt;=10 &amp;&amp; ($3+$4)\/($1+$2+$3+$4)&gt;=0.8' snp_indel.vcf &gt; snp_indel.final.vcf<\/pre>\n<h2>12. samtools rmdup<\/h2>\n<p>NGS\u4e0a\u673a\u6d4b\u5e8f\u524d\u9700\u8981\u8fdb\u884cPCR\u4e00\u6b65\uff0c\u4f7f\u4e00\u4e2a\u6a21\u677f\u6269\u589e\u51fa\u4e00\u7c07\uff0c\u4ece\u800c\u5728\u4e0a\u673a\u6d4b\u5e8f\u7684\u65f6\u5019\u8868\u73b0\u51fa\u4e3a1\u4e2a\u70b9\uff0c\u5373\u4e00\u4e2areads\u3002\u82e5\u4e00\u4e2a\u6a21\u677f\u6269\u589e\u51fa\u4e86\u591a\u7c07\uff0c\u7ed3\u679c\u5f97\u5230\u4e86\u591a\u4e2areads\uff0c\u8fd9\u4e9breads\u7684\u5750\u6807(coordinates)\u662f\u76f8\u8fd1\u7684\u3002\u5728\u8fdb\u884c\u4e86reads\u6bd4\u5bf9\u540e\u9700\u8981\u5c06\u8fd9\u4e9b\u7531PCR duplicates\u83b7\u5f97\u7684reads\u53bb\u6389\uff0c\u5e76\u53ea\u4fdd\u7559\u6700\u9ad8\u6bd4\u5bf9\u8d28\u91cf\u7684read\u3002\u4f7f\u7528rmdup\u547d\u4ee4\u5373\u53ef\u5b8c\u6210.<\/p>\n<pre>Usage:  samtools rmdup [-sS]  \r\n-s \u5bf9single-end reads\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u5bf9paired-end reads\r\n-S \u5c06Paired-end reads\u4f5c\u4e3asingle-end reads\u5904\u7406\u3002\r\n\r\n$ samtools input.sorted.bam output.bam<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>samtools\u7684\u8bf4\u660e\u6587\u6863\uff1ahttp:\/\/samtools.sourceforg &hellip; <a href=\"http:\/\/www.chenlianfu.com\/?p=1399\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/1399"}],"collection":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1399"}],"version-history":[{"count":54,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/1399\/revisions"}],"predecessor-version":[{"id":2087,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=\/wp\/v2\/posts\/1399\/revisions\/2087"}],"wp:attachment":[{"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1399"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.chenlianfu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}