{"id":24302,"date":"2024-01-11T17:05:40","date_gmt":"2024-01-11T09:05:40","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=24302"},"modified":"2024-01-11T17:05:41","modified_gmt":"2024-01-11T09:05:41","slug":"%e5%8f%aa%e7%9c%8b%e6%9c%ac%e6%96%87%e5%b0%b1%e5%a4%9f%e4%ba%86-%e4%bd%bf%e7%94%a8bedtools%e8%bf%9b%e8%a1%8cgwas%e5%9f%ba%e5%9b%a0%e6%b3%a8%e9%87%8a","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=24302","title":{"rendered":"\u53ea\u770b\u672c\u6587\u5c31\u591f\u4e86&#8211;\u4f7f\u7528bedtools\u8fdb\u884cGWAS\u57fa\u56e0\u6ce8\u91ca"},"content":{"rendered":"<p>bedtools\u662f\u4e00\u6b3e\u975e\u5e38\u5f3a\u5927\u7684\u7528\u4e8e\u5904\u7406bed\uff0cvcf\uff0cgff\u7b49\u683c\u5f0f\u6570\u636e\u7684\u5de5\u5177\uff0c\u8be5\u8f6f\u4ef6\u7531\u72b9\u4ed6\u5927\u5b66\u7684Quinlan\u5b9e\u9a8c\u5ba4\u5f00\u53d1\u3002\u4f46\u662f\u76ee\u524dbedtools\u4e3b\u8981\u63d0\u4f9b\u7684\u662f\u5728linux\uff0cunxi\u7b49\u64cd\u4f5c\u7cfb\u7edf\u73af\u5883\u4e0b\u7684\u201c\u547d\u4ee4\u884c\u201d\u8fd0\u884c\u65b9\u5f0f\uff0c\u4eca\u5929\uff0c\u5c0f\u679c\u5c31\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u8fd9\u6b3e\u7531\u72b9\u4ed6\u5927\u5b66\u6606\u5170\u5b9e\u9a8c\u5ba4\u5f00\u53d1\u7684\u57fa\u56e0\u7ec4\u7b97\u6cd5\u5de5\u5177\u96c6bedtools\u3002<\/p>\n<p><strong>bedtools\u7684\u4e3b\u8981\u529f\u80fd<\/strong><\/p>\n<p>bedtools: flexible tools for genome arithmetic and DNA sequence analysis.<\/p>\n<p>usage: bedtools &lt;subcommand&gt; [options]<\/p>\n<p>The bedtools sub-commands include:<\/p>\n<p>[ Genome arithmetic ]<\/p>\n<p>intersect Find overlapping intervals in various ways.<\/p>\n<p>\u6c42\u533a\u57df\u4e4b\u95f4\u7684\u4ea4\u96c6\uff0c\u53ef\u4ee5\u7528\u6765\u6ce8\u91capeak\uff0c\u8ba1\u7b97reads\u6bd4\u5bf9\u5230\u7684\u57fa\u56e0\u7ec4\u533a\u57df<\/p>\n<p>\u4e0d\u540c\u6837\u54c1\u7684peak\u4e4b\u95f4\u7684peak\u91cd\u53e0\u60c5\u51b5\u3002<\/p>\n<p>window Find overlapping intervals within a window around an interval.<\/p>\n<p>closest Find the closest, potentially non-overlapping interval.<\/p>\n<p>\u5bfb\u627e\u6700\u8fd1\u4f46\u53ef\u80fd\u4e0d\u91cd\u53e0\u7684\u533a\u57df<\/p>\n<p>coverage Compute the coverage over defined intervals.<\/p>\n<p>\u8ba1\u7b97\u533a\u57df\u8986\u76d6\u5ea6<\/p>\n<p>map Apply a function to a column for each overlapping interval.<\/p>\n<p>genomecov Compute the coverage over an entire genome.<\/p>\n<p>merge Combine overlapping\/nearby intervals into a single interval.<\/p>\n<p>\u5408\u5e76\u91cd\u53e0\u6216\u76f8\u63a5\u7684\u533a\u57df<\/p>\n<p>cluster Cluster (but don&#8217;t merge) overlapping\/nearby intervals.<\/p>\n<p>complement Extract intervals _not_ represented by an interval file.<\/p>\n<p>\u83b7\u5f97\u4e92\u8865\u533a\u57df<\/p>\n<p>subtract Remove intervals based on overlaps b\/w two files.<\/p>\n<p>\u8ba1\u7b97\u533a\u57df\u5dee\u96c6<\/p>\n<p>slop Adjust the size of intervals.<\/p>\n<p>\u8c03\u6574\u533a\u57df\u5927\u5c0f\uff0c\u5982\u83b7\u5f97\u8f6c\u5f55\u8d77\u59cb\u4f4d\u70b9\u4e0a\u4e0b\u6e383 K\u7684\u533a\u57df<\/p>\n<p>flank Create new intervals from the flanks of existing intervals.<\/p>\n<p>sort Order the intervals in a file.<\/p>\n<p>\u6392\u5e8f\uff0c\u90e8\u5206\u547d\u4ee4\u9700\u8981\u6392\u5e8f\u8fc7\u7684bed\u6587\u4ef6<\/p>\n<p>random Generate random intervals in a genome.<\/p>\n<p>\u83b7\u5f97\u968f\u673a\u533a\u57df\uff0c\u4f5c\u4e3a\u80cc\u666f\u96c6<\/p>\n<p>shuffle Randomly redistrubute intervals in a genome.<\/p>\n<p>\u6839\u636e\u7ed9\u5b9a\u7684bed\u6587\u4ef6\u83b7\u5f97\u968f\u673a\u533a\u57df\uff0c\u4f5c\u4e3a\u80cc\u666f\u96c6<\/p>\n<p>sample Sample random records from file using reservoir sampling.<\/p>\n<p>spacing Report the gap lengths between intervals in a file.<\/p>\n<p>annotate Annotate coverage of features from multiple files.<\/p>\n<p>[ Multi-way file comparisons ]<\/p>\n<p>multiinter Identifies common intervals among multiple interval files.<\/p>\n<p>unionbedg Combines coverage intervals from multiple BEDGRAPH files.<\/p>\n<p>[ Paired-end manipulation ]<\/p>\n<p>pairtobed Find pairs that overlap intervals in various ways.<\/p>\n<p>pairtopair Find pairs that overlap other pairs in various ways.<\/p>\n<p>[ Format conversion ]<\/p>\n<p>bamtobed Convert BAM alignments to BED (&amp; other) formats.<\/p>\n<p>bedtobam Convert intervals to BAM records.<\/p>\n<p>bamtofastq Convert BAM records to FASTQ records.<\/p>\n<p>bedpetobam Convert BEDPE intervals to BAM records.<\/p>\n<p>bed12tobed6 Breaks BED12 intervals into discrete BED6 intervals.<\/p>\n<p>[ Fasta manipulation ]<\/p>\n<p>getfasta Use intervals to extract sequences from a FASTA file.<\/p>\n<p>\u63d0\u53d6\u7ed9\u5b9a\u4f4d\u7f6e\u7684FASTA\u5e8f\u5217<\/p>\n<p>maskfasta Use intervals to mask sequences from a FASTA file.<\/p>\n<p>nuc Profile the nucleotide content of intervals in a FASTA file.<\/p>\n<p>[ BAM focused tools ]<\/p>\n<p>multicov Counts coverage from multiple BAMs at specific intervals.<\/p>\n<p>tag Tag BAM alignments based on overlaps with interval files.<\/p>\n<p>[ Statistical relationships ]<\/p>\n<p>jaccard Calculate the Jaccard statistic b\/w two sets of intervals.<\/p>\n<p>\u8ba1\u7b97\u6570\u636e\u96c6\u76f8\u4f3c\u6027<\/p>\n<p>reldist Calculate the distribution of relative distances b\/w two files.<\/p>\n<p>fisher Calculate Fisher statistic b\/w two feature files.<\/p>\n<p>[ Miscellaneous tools ]<\/p>\n<p>overlap Computes the amount of overlap from two intervals.<\/p>\n<p>igv Create an IGV snapshot batch script.<\/p>\n<p>\u7528\u4e8e\u751f\u6210\u4e00\u4e2a\u811a\u672c\uff0c\u6279\u91cf\u6355\u83b7IGV\u622a\u56fe<\/p>\n<p>links Create a HTML page of links to UCSC locations.<\/p>\n<p>makewindows Make interval &#8220;windows&#8221; across a genome.<\/p>\n<p>\u628a\u7ed9\u5b9a\u533a\u57df\u5212\u5206\u6210\u6307\u5b9a\u5927\u5c0f\u548c\u95f4\u9694\u7684\u5c0f\u533a\u95f4 (bin)<\/p>\n<p>groupby Group by common cols. &amp; summarize oth. cols. (~ SQL &#8220;groupBy&#8221;)<\/p>\n<p>\u5206\u7ec4\u7ed3\u7b97\uff0c\u4e0d\u53ea\u53ef\u4ee5\u7528\u4e8ebed\u6587\u4ef6\u3002<\/p>\n<p>expand Replicate lines based on lists of values in columns.<\/p>\n<p>split Split a file into multiple files with equal records or base pairs.<\/p>\n<p>\u4eca\u5929\u4ecb\u7ecd\u4e00\u4e0bGWAS\u5206\u6790\u4e2d\u6ce8\u91ca\u7684\u65b9\u6cd5\uff0c\u6211\u4eec\u77e5\u9053\uff0cGWAS\u5206\u6790\u627e\u5230\u663e\u8457\u6027SNP\u540e\uff0c\u9700\u8981\u6ce8\u91ca\uff0c\u624d\u80fd\u627e\u5230\u5019\u9009\u7684\u57fa\u56e0\u3002GWAS\u7684\u4f9d\u636e\u662fSNP\u4e0e\u63a7\u5236\u6027\u72b6\u7684\u57fa\u56e0\u5904\u4e8eLD\u72b6\u6001\uff0c\u6240\u4ee5\uff0c\u6211\u4eec\u624d\u80fd\u63a8\u65ad\u663e\u8457\u6027\u7684SNP\u9644\u8fd1\u7684\u57fa\u56e0\u662f\u5f71\u54cd\u6027\u72b6\u7684\u5019\u9009\u57fa\u56e0\u3002<\/p>\n<p>\u8bdd\u4e0d\u591a\u8bf4\uff0c\u76f4\u63a5\u4e0a\u5e72\u8d27\u3002<\/p>\n<p>\u8f6f\u4ef6\u7684\u5b89\u88c5\u4e24\u79cd\u65b9\u5f0f<\/p>\n<p>\u7b2c\u4e00\u79cd\u4e0b\u8f7d\u8f6f\u4ef6\u5b89\u88c5\uff0c\u8fdb\u5165\u5230\u81ea\u5df1\u5b58\u653e\u8f6f\u4ef6\u7684\u6587\u4ef6\u5939<\/p>\n<p>wget https:\/\/github.com\/arq5x\/bedtools2\/releases\/download\/v2.30.0\/bedtools-2.30.0.tar.gz<\/p>\n<p>\u4e0b\u8f7d\u5b8c\u540e\u89e3\u538b<\/p>\n<p>tar -zxvf bedtools-2.30.0.tar.gz<\/p>\n<p>cd bdtools2<\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff0c\u76f4\u63a5\u7528conda \u5b89\u88c5<\/p>\n<p>conda activate xxx \u6fc0\u6d3b\u4e00\u4e2a\u73af\u5883conda\u73af\u5883<\/p>\n<p>conda install bedtools<\/p>\n<p>bedtools intersect -a xx.bed -b xx.bed -wa -wb | bedtools groupby -i &#8211; -g 1-4 -c 8 -o collapse &gt;xx.txt<\/p>\n<p>##\u53c2\u8003\uff1ahttps:\/\/www.cnblogs.com\/xudongliang\/p\/5051503.html<\/p>\n<p>##-a bed\u6587\u4ef6<\/p>\n<p>chr start end gene<\/p>\n<p>##-b bed\u6587\u4ef6<\/p>\n<p>chr start end SNP_ID<\/p>\n<p>## bedtools intersect -a xx.bed -b xx.bed<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ea\u8f93\u51faA\u4e2doverlap\u7684\u533a\u57df<\/p>\n<p>## bedtools intersect -a cpg.bed -b exon.bed -wa<\/p>\n<p>-wa \u53c2\u6570\u540e\uff0c\u53ea\u8981A\u4e2d\u7684\u8fd9\u6bb5\u533a\u57df\u4e0eB\u4e2d\u533a\u57df\u6709\u4ea4\u96c6\uff0c\u5c31\u8f93\u51fa\uff0c\u800c\u4e14overlap\u51e0\u6b21\uff0c\u5c31\u8f93\u51fa\u51e0\u6b21<\/p>\n<p>##bedtools intersect -a cpg.bed -b exon.bed -wb<\/p>\n<p>\u52a0\u4e0a-wb\u53c2\u6570\u540e\uff0c\u9664\u4e86\u8f93\u51faA\u4e2d\u7684overlap\u533a\u57df\u5916\uff0c\u8fd8\u4f1a\u8f93\u51faB\u4e2d\u7684\u6574\u4e2a\u533a\u95f4<\/p>\n<p>##bedtools intersect -a cpg.bed -b exon.bed -wa -wb<\/p>\n<p>\u6dfb\u52a0-wa\u548c-wb\u53c2\u6570\u4f1a\u5c06overlap \u533a\u57df\u6210\u5bf9\u8f93\u51fa<\/p>\n<p>##-c\u53c2\u6570\uff0c\u7edf\u8ba1A\u4e2d\u6bcf\u4e2a\u533a\u57df\u4e0eBoverlap\u7684\u6b21\u6570<\/p>\n<p>##-v\u53c2\u6570\uff1a\u53ea\u8f93\u51faA\u4e2d\u6ca1\u6709\u4e0eBoverlap\u7684\u533a\u57df<\/p>\n<p>##\u53c2\u8003\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/93660864<\/p>\n<p>##bedtools groupby -i out -g 1-4 -c 8 -o collapse<\/p>\n<p>##-i\uff0c\u8f93\u5165\u6587\u4ef6\uff0c\u7531\u4e8e\u4f7f\u7528|\uff0c\u6ca1\u6709\u663e\u793a\u8f93\u5165\u6587\u4ef6<\/p>\n<p>##-g\uff1a\u9009\u62e9\u54ea\u51e0\u5217\u7684\u503c\u8fdb\u884c\u5408\u5e76\u3002\u201c-g 1-4\u201d\u8868\u793a\u5408\u5e76\u524d\u56db\u5217\u76f8\u540c\u7684\u884c\u3002<\/p>\n<p>##-c\uff1a\u9009\u62e9\u7b2c\u51e0\u5217\u7684\u503c\u6c47\u603b\u7ed3\u679c\u3002\u201c-c 8\u201d\u8868\u793a\u9009\u62e9\u7b2c\u516b\u5217\u7684\u503c\u8fdb\u884c\u6c47\u603b\u3002<\/p>\n<p>\/home\/bedtools\/bedtools2-2.25.0\/bin\/bedtools intersect -a gene.bed -b SNP.bed -wa -wb| \/home\/bedtools\/bedtools2-2.25.0\/bin\/bedtools groupby -i &#8211; -g 1-4 -c 8 -o collapse &gt;xx.txt<\/p>\n<p>##\u57fa\u4e8ebedtools\u8f6f\u4ef6\u63d0\u53d6fa\u5e8f\u5217\u3002<\/p>\n<p>bedtools getfasta -fi \/home\/Reference\/Sus_101\/Sus_scrofa.Sscrofa11.1.dna.toplevel.fa -bed lncRNA.bed &gt; lncRNABSSeq.fa<\/p>\n<p>bedtools getfasta -fi Gallus_gallus.GRCg6a.dna.toplevel.fa -bed \/root\/bedtools2\/4T-5T-BU -name -fo \/root\/bedtools2\/4T-5T-BU.fa<\/p>\n<p>#bed\u6587\u4ef6\u5185\u5bb9\uff1a\u67d3\u8272\u4f53 \u8d77\u59cb\u4f4d\u7f6e \u7ec8\u6b62\u4f4d\u7f6e \u57fa\u56e0ID<\/p>\n<p>\u603b\u7684\u6765\u8bf4\uff0cbedtools\u5b9e\u7528\u5de5\u5177\u7528\u4e8e\u5e7f\u6cdb\u7684\u57fa\u56e0\u7ec4\u5b66\u5206\u6790\u4efb\u52a1\u3002\u867d\u7136\u6bcf\u4e2a\u5355\u72ec\u7684\u5de5\u5177\u90fd\u8bbe\u8ba1\u7528\u4e8e\u6267\u884c\u76f8\u5bf9\u7b80\u5355\u7684\u4efb\u52a1\uff0c\u4f46\u901a\u8fc7\u5728UNIX\u547d\u4ee4\u884c\u4e0a\u7ec4\u5408\u591a\u4e2abedtools\u64cd\u4f5c\uff0c\u53ef\u4ee5\u8fdb\u884c\u76f8\u5f53\u590d\u6742\u7684\u5206\u6790\u3002\u5177\u4f53\u53ef\u53c2\u8003\u6587\u6863\uff1a<a href=\"https:\/\/www.jieandze1314.com\/post\/c\">https:\/\/www.jieandze1314.com\/post\/c<\/a><\/p>\n<p>\u60f3\u8981\u66f4\u597d\u7684\u5b66\u4e60\u548c\u4ea4\u6d41\uff0c\u5feb\u6765\u52a0\u5165\u5c0f\u679c\u7684\u5fae\u4fe1\u516c\u4f17\u53f7\uff08\u751f\u4fe1\u679c\uff09\u548c\u4e91\u751f\u4fe1\u751f\u7269\u4fe1\u606f\u5b66\u5e73\u53f0\uff08\u00a0\u00a0http:\/\/www.biocloudservice.com\/home.html\uff09\uff0c\u5728\u8fd9\u91cc\u4f60\u53ef\u4ee5\u5411\u5c0f\u679c\u63d0\u95ee\u3001\u5e2e\u4f60\u5236\u5b9a\u76f8\u5e94\u5206\u6790\u64cd\u4f5c\u3002<strong>\u70b9\u51fb\u8fd9\u91cc\u52a0\u5165\u5427\uff01<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>bedtools\u662f\u4e00\u6b3e\u975e\u5e38\u5f3a\u5927\u7684\u7528\u4e8e\u5904\u7406bed\uff0cvcf\uff0cgff\u7b49\u683c\u5f0f\u6570\u636e\u7684\u5de5\u5177\uff0c\u8be5\u8f6f\u4ef6\u7531\u72b9\u4ed6\u5927\u5b66\u7684Quinla [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":""},"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/24302"}],"collection":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24302"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/24302\/revisions"}],"predecessor-version":[{"id":24303,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/24302\/revisions\/24303"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24302"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}