{"id":201,"date":"2024-07-25T20:17:35","date_gmt":"2024-07-25T12:17:35","guid":{"rendered":"https:\/\/www.kz-hub.tech\/?p=201"},"modified":"2025-02-21T15:22:13","modified_gmt":"2025-02-21T07:22:13","slug":"atac-seq-%e5%88%86%e6%9e%90%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.kz-hub.tech\/index.php\/2024\/07\/25\/atac-seq-%e5%88%86%e6%9e%90%e6%b5%81%e7%a8%8b\/","title":{"rendered":"ATAC-seq \u5206\u6790\u6d41\u7a0b"},"content":{"rendered":"<h2>0. \u65b0\u5efa\u6587\u4ef6\u5939<\/h2>\n<pre><code>mkdir {rawdata, align, macs3}<\/code><\/pre>\n<h2>1. \u6570\u636e\u8d28\u63a7+\u8fc7\u6ee4\u540cWES &amp; RNA-seq<\/h2>\n<pre><code>fastqc .\/*.gz \nmultiqc .\/*.zip\n\n# \u5fc5\u8981\u65f6\u4f7f\u7528Trimmomatic\/trim_galore\u53bb\u63a5\u5934\uff0c\u8d28\u63a7\n<\/code><\/pre>\n<h2>2. BWA\u5e8f\u5217\u6bd4\u5bf9 + MarkDuplicates + \u53bb\u9664\u4f4e\u8d28\u91cf\u5e8f\u5217 + \u53bb\u9664\u7ebf\u7c92\u4f53\u57fa\u56e0<\/h2>\n<pre><code># bwa mem\u6bd4\u5bf9+samtools\u6392\u5e8f+MarkDuplicates\u53bb\u9664pcr\u91cd\u590d\n# ATAC\u9700\u989d\u5916\u4f7f\u7528samtools view -h -f 2 -q 30\u6765\u53ea\u4fdd\u7559\u4e24\u6761reads\u8981\u6bd4\u5bf9\u5230\u540c\u4e00\u6761\u67d3\u8272\u4f53(Proper paired) \uff0c\u8fd8\u6709\u9ad8\u8d28\u91cf\u7684\u6bd4\u5bf9\u7ed3\u679c(Mapping quality&gt;=30)\n# \u7ebf\u7c92\u4f53\u57fa\u56e0\u7ec4\u7531\u4e8e\u6ca1\u6709\u67d3\u8272\u8d28\u7ec4\u88c5\uff0c\u5904\u4e8e\u5f00\u653e\u72b6\u6001\uff0c\u66f4\u5bb9\u6613\u88abTn5\u9176\u5207\u5272\uff0c\u6240\u4ee5\u7ebf\u7c92\u4f53\u5e8f\u5217\u9700\u8981\u53bb\u9664\n\ncd align\nls ..\/rawdata\/*.Cleandata.R1.fq.gz|perl -ne &#039;chomp;my $name=$1 if($_=~\/\\\/([^\\\/]+)\\.Cleandata\/);print &quot;bwa mem -t 10 -R \\&quot;\\@RG\\\\tID:$name\\\\tSM:$name\\\\tLB:ATAC\\\\tPL:Illumina\\&quot; \/data02\/zhangmengmeng\/database\/hg38\/hg38.fa ..\/rawdata\/$name\\.Cleandata.R1.fq.gz ..\/rawdata\/$name\\.Cleandata.R2.fq.gz | samtools view -bS - &gt;$name.bam &amp;&amp; samtools sort -@ 5 -o $name.sort.bam $name.bam &amp;&amp; gatk --java-options \\&quot;-Xmx20G -Djava.io.tmpdir=.\/\\&quot; MarkDuplicates --INPUT $name.sort.bam --OUTPUT $name.sort.markdup.bam -M $name.metrics  --VALIDATION_STRINGENCY LENIENT &amp;&amp; samtools index $name.sort.markdup.bam &amp;&amp; samtools view -h -f 2 -q 30 $name.sort.markdup.bam | grep -v chrM | samtools view -bS -o $name.sort.markdup.final.bam &amp;&amp; samtools index $name.sort.markdup.final.bam &amp;&amp; echo $name ok\\n&quot;&#039; &gt;aln.sh<\/code><\/pre>\n<p>peak \u53ef\u89c6\u5316<\/p>\n<pre><code># \u5148\u5bf9fasta.fai\u6587\u4ef6\u8fdb\u884c\u5904\u7406\ncut -f1,2 gencode_GRCh38.p14.genome.fa.fai &gt; gencode_GRCh38.p14.genome.chrom.sizes\n\n# \u901a\u8fc7igvtools\u5c06bam\u5904\u7406\u6210tdf\u6587\u4ef6\uff0c\u5bfc\u5165\u672c\u5730IGV\u53ef\u89c6\u5316\nigvtools count BC_1225T.sort.markdup.final.bam BC_1225T.sort.markdup.final.tdf \/data02\/zhangmengmeng\/database\/hg38\/hg38.chrom.sizes\n<\/code><\/pre>\n<h2>3. macs3 callpeak<\/h2>\n<pre><code># \u8f6f\u4ef6\u4f7f\u7528\u8bf4\u660e\uff1a\n\n## \u5bfb\u627eChIP-seq\u7684\u8f6c\u5f55\u56e0\u5b50\uff08TF\uff09\u7684\u547d\u4ee4\uff08\u751f\u6210\u7684\u6587\u4ef6\u662fnarrowPeak\uff09\uff1a\nmacs3 callpeak -t ChIP.bam -c Control.bam -f BAM -g hs -n test -B -q 0.01\n\n## \u5bfb\u627eChIP-seq\u7684\u7ec4\u86cb\u767d\uff08Histone \uff09Mark\u7684\u547d\u4ee4\uff08\u751f\u6210\u7684\u6587\u4ef6\u662fbroadPeak\uff09\uff1a\nmacs3 callpeak -t ChIP.bam -c Control.bam --broad -g hs --broad-cutoff 0.1\n\n## \u5bf9\u4e8eATAC-seq\u53cc\u7aef\u6570\u636e\u7684\u64cd\u4f5c\uff1a\nmacs3 callpeak -f BAMPE -t ATAC.bam -g hs -n test -B -q 0.01\n\n-f\u662f\u8f93\u5165\u6587\u4ef6\u7684\u683c\u5f0f\uff0c\u53ef\u4ee5\u662fBAM\u3001BED\uff0c\u8f6f\u4ef6\u53ef\u4ee5\u81ea\u52a8\u8bc6\u522b\uff0c\u4f46\u662f\u9700\u8981\u6ce8\u610f\u81ea\u52a8\u8bc6\u522b\u662f\u65e0\u6cd5\u533a\u5206\u662fPE\u8fd8\u662fSE\uff0c\u6240\u4ee5\u5efa\u8bae\u624b\u52a8\u6307\u5b9a\uff1b\n-g\u662f\u6709\u6548\u57fa\u56e0\u7ec4\u5927\u5c0f\uff0c\u8f6f\u4ef6\u9884\u8bbe\u4e86\u6a21\u5f0f\u7269\u79cd\u7684\u6709\u6548\u56e0\u7ec4\u5927\u5c0f\uff0c\u5982\u679chs\u4eba\uff0cmm\u5c0f\u9f20\uff1b\n-n\u662f\u6837\u672c\u540d\u5b57\uff1b\n-B\u662f\u4ee5bedGraph\u683c\u5f0f\u5b58\u653efragment pileup, control lambda, -log10pvalue \u548clog10qvale,\u4f7f\u7528\u4f1a\u589e\u957f\u8017\u65f6\uff1b\n-q\u5c31\u662f\u7528q\u503c\uff08FDR\uff09\u8fdb\u884c\u7b5b\u9009\uff0c\u8f93\u5165\u5f97\u5230\u503c\u4e3a\u9608\u503c\uff1b\nbroad-cutoff\u7528\u4e8e\u8fc7\u6ee4 broad\u5f97\u5230\u7684peak\u3002\n--nolambda\uff1a \u8bbe\u7f6e\u8fd9\u4e2a\u53c2\u6570\u5c31\u610f\u5473\u7740\u4e0d\u7528MACS\u63a8\u8350\u7684\u52a8\u6001lambda\uff0c\u800c\u662f\u4f7f\u7528\u80cc\u666flambda\u4f5c\u4e3alocal lambda\uff0c\u4e5f\u5c31\u662f\u4e0d\u8003\u8651\u67d3\u8272\u8d28\u7ed3\u6784\u7b49\u9020\u6210\u7684\u5c40\u90e8\u504f\u8bef\u3002\u56e0\u4e3aATAC\u6ca1\u6709control\uff0c\u56e0\u6b64\u9700\u8981\u7528\u80cc\u666flambda\u4f5c\u4e3alocal lambda\uff0c\u5426\u5219\u4f1a\u4e22\u5931\u8bb8\u591a\u5f00\u653e\u7684\u67d3\u8272\u4f53\u533a\u57df\n--keep-dup: \u4fdd\u7559\u91cd\u590d\u3002\u9ed8\u8ba4MACS(auto)\u4f1a\u4f7f\u7528\u4e8c\u9879\u5206\u5e03\u4f30\u8ba1\u6bcf\u4e2a\u4f4d\u7f6e\u4e0a\u662f\u5426\u5b58\u5728\u91cd\u590d\uff08\u9ed8\u8ba4\u662f1\uff0c\u4e5f\u5c31\u662f\u6bcf\u4e2a\u4f4d\u7f6e\u4e0a\u51fa\u73b0\u4e00\u4e2aread\u7684\u6982\u7387\u6700\u5927\uff09\u3002\u5982\u679c\u4f60\u524d\u671f\u5df2\u7ecf\u53bb\u91cd\uff0c\u90a3\u5c31\u4f7f\u7528all\u7701\u4e86\u8fd9\u4e00\u6b65.\n\n# Peak calling \u6700\u540e\u8f93\u51fa\u6587\u4ef6\u9700\u8981\u53bb\u9664 ENCODE  \u7684 blacklist(\u7531\u4e8eNGS\u6d4b\u5e8f\u8bfb\u957f\u7684\u9650\u5236\uff0c\u76ee\u524d\u7684\u53c2\u8003\u57fa\u56e0\u7ec4\u6709\u4e00\u4e9b\u6d4b\u4e0d\u51c6\u7684\u533a\u57df\uff0c\u5373\u9ed1\u540d\u5355\u533a\u57df\uff08Blacklist regions\uff09\u3002\u8fd9\u4e9b\u533a\u57df\u7684\u6709\u65f6\u5019\u4f1a\u5177\u6709\u9ad8\u4fe1\u53f7\u7684\u5bcc\u96c6\uff0c\u5f71\u54cd\u6211\u4eecpeak calling\u7684\u7ed3\u679c\u3002 )\nbedtools intersect -v -a NAME_peaks.narrowPeak -b \/data02\/zhangmengmeng\/database\/ENCODE_BlackList\/ENCFF356LFX.bed &gt; FILTERED.narrowPeak<\/code><\/pre>\n<p>\u6d41\u7a0b\u5316\u4ee3\u7801\uff1a<\/p>\n<pre><code>cd align\nconda activate macs3\n\nls *.sort.markdup.final.bam|perl -ne &#039;chomp;if($_=~\/(\\S+)\\.sort\/){print &quot;macs3 callpeak -f BAMPE -t $1.sort.markdup.final.bam -g hs -n $1 -q 0.05 -B --keep-dup all --nolambda --nomodel --shift -100 --extsize 200 &amp;&amp; bedtools intersect -v -a $1_peaks.narrowPeak -b \/data02\/zhangmengmeng\/database\/ENCODE_BlackList\/ENCFF356LFX.bed &gt; $1_filtered.narrowPeak &amp;&amp; echo $1 ok\\n&quot;}&#039; &gt; macs3.sh\n<\/code><\/pre>\n<h2>\uff1fVarCA \u68c0\u6d4b\u53d8\u5f02\uff1f<\/h2>\n<h2>4. \u57fa\u4e8ehomer\u7684motif\u5206\u6790+\u6ce8\u91ca\uff08\u6216\u8005\u7528MEME \uff09<\/h2>\n<p>\u57fa\u7840\u547d\u4ee4\uff1a<\/p>\n<pre><code># findMotifsGenome.pl &lt;peak\/BED file&gt; &lt;genome&gt; &lt;output directory&gt; -size # [options]\nfindMotifsGenome.pl \/data02\/zhangmengmeng\/HR_pos\/ATAC\/align\/peaks.bed hg38 \/data02\/zhangmengmeng\/HR_pos\/ATAC\/homer -p 8 -size 200\n\nannotatePeaks.pl \/data02\/zhangmengmeng\/HR_pos\/ATAC\/align\/peaks.bed hg38 &gt; peak.annotation.xls<\/code><\/pre>\n<p>\u6d41\u7a0b\u5316\u5904\u7406\uff1a<\/p>\n<pre><code>ls ..\/align\/*_summits.bed | perl -ne &#039;chomp; if ($_ =~ m|..\/align\/(\\S+)_summits.bed|) { print &quot;annotatePeaks.pl \/data02\/zhangmengmeng\/HR_pos\/ATAC\/align\/$1_summits.bed hg38 &gt; \/data02\/zhangmengmeng\/HR_pos\/ATAC\/homer\/$1_peak.annotation.xls &amp;&amp; echo $1 ok\\n&quot;; }&#039; &gt; homer_annotatePeaks.sh\n\nls ..\/align\/*_summits.bed | perl -ne &#039;chomp; if ($_ =~ m|..\/align\/(\\S+)_summits.bed|) { print &quot;findMotifsGenome.pl \/data02\/zhangmengmeng\/HR_pos\/ATAC\/align\/$1_summits.bed hg38 \/data02\/zhangmengmeng\/HR_pos\/ATAC\/homer\/$1 -p 8 -size 200 &amp;&amp; echo $1 ok\\n&quot;; }&#039; &gt; homer_findMotifsGenome.sh<\/code><\/pre>\n<h2>5.1 \u4e0b\u6e38\u5206\u67901-\u5dee\u5f02\u5206\u6790\uff08edgeR\/DESeq2\uff09<\/h2>\n<pre><code><\/code><\/pre>\n<h2>5.2 \u4e0b\u6e38\u5206\u67901-\u5dee\u5f02\u5206\u6790\uff08DiffBind\uff09<\/h2>\n<h2>5.3 \u4e0b\u6e38\u5206\u67901-\u5dee\u5f02\u5206\u6790\uff08macs3\uff09<\/h2>\n<pre><code># \u5148\u6839\u636e\u5206\u7ec4\u5408\u5e76bam\u6587\u4ef6\u8dd1macs3 callpeak\n# ATAC\u9700\u8981\u8bbe\u7f6e--nolambda\uff0c\u5426\u5219\u4f1a\u56e0\u4e3a\u81ea\u5df1\u7684&quot;local background&quot; \u6e05\u9664\u5927\u591a\u6570\u67d3\u8272\u4f53\u53ef\u53ca\u533a\u57df: https:\/\/github.com\/macs3-project\/MACS\/issues\/412\n# \u53c2\u6570\u63a8\u8350: https:\/\/github.com\/macs3-project\/MACS\/discussions\/435\nmacs3 callpeak -f BAMPE -t ..\/..\/align\/BC_1265T.sort.markdup.final.bam ..\/..\/align\/BC_1652T.sort.markdup.final.bam ..\/..\/align\/BC_874T.sort.markdup.final.bam -g hs -n Responsed -B -q 0.05 --keep-dup all --nolambda --nomodel --shift -100 --extsize 200 --outdir .\/\nmacs3 callpeak -f BAMPE -t ..\/..\/align\/BC_1225T.sort.markdup.final.bam ..\/..\/align\/BC_850T.sort.markdup.final.bam ..\/..\/align\/BC_1321T.sort.markdup.final.bam ..\/..\/align\/BC_1604T.sort.markdup.final.bam -g hs -n UnResponsed -B -q 0.05 --keep-dup all --nolambda --nomodel --shift -100 --extsize 200 --outdir .\/\n\n# \u8f93\u51fa\u7ed3\u679c\u6587\u4ef6\uff1a\n# The NAME_treat_pileup.bdg and NAME_control_lambda.bdg files are in bedGraph format which can be imported to the UCSC genome browser or be converted into even smaller bigWig files.\n# The NAME_treat_pielup.bdg contains the pileup signals (normalized according to --scale-to option) from ChIP\/treatment sample. \n# The NAME_control_lambda.bdg contains local biases estimated for each genomic location from the control sample, or from treatment sample when the control sample is absent. \n# The subcommand bdgcmp can be used to compare these two files and make a bedGraph file of scores such as p-value, q-value, log-likelihood, and log fold changes.\n$ macs3callpeakMerged.log  Responsed_control_lambda.bdg  Responsed_peaks.xls    Responsed_treat_pileup.bdg      UnResponsed_peaks.narrowPeak  UnResponsed_summits.bed\n$ macs3callpeakMerged.sh   Responsed_peaks.narrowPeak    Responsed_summits.bed  UnResponsed_control_lambda.bdg  UnResponsed_peaks.xls         UnResponsed_treat_pileup.bdg\n\n# \u4ece\u8f93\u51fa\u7ed3\u679c\u6587\u4ef6\u4e2d\u5bfc\u51fa\u6709\u6548\u6d4b\u5e8f\u6df1\u5ea6\uff08effective sequencing depths\uff09\negrep &quot;fragments after filtering in treatment&quot; Responsed_peaks.xls # 131052489\negrep &quot;fragments after filtering in treatment&quot; UnResponsed_peaks.xls # 159367706\negrep &quot;total fragments in treatment&quot; Responsed_peaks.xls # 158401364\negrep &quot;total fragments in treatment&quot; UnResponsed_peaks.xls # 186738400\n\n# \u8fd0\u884cmacs3 bdgdiff\nmacs3 bdgdiff --t1 ..\/macs3bdg_callpeak_merged\/Responsed_treat_pileup.bdg --c1 ..\/macs3bdg_callpeak_merged\/Responsed_control_lambda.bdg --t2 ..\/macs3bdg_callpeak_merged\/UnResponsed_treat_pileup.bdg --c2 ..\/macs3bdg_callpeak_merged\/UnResponsed_control_lambda.bdg --d1 131052489 --d2 159367706 --outdir .\/ --o-prefix diff_R_vs_UR\n\n#  \u8f93\u51fa\u7ed3\u679c\n# con1.bed\u4fdd\u5b58\u4e86\u5728condition1\u4e2d\uff08\u5373bdgdiff\u4e2d\u7684t1\u548cc1\uff09\u4e0a\u8c03\u7684peak\n# con2.bed\u4fdd\u5b58\u4e86\u5728condition2\u4e2d\uff08\u5373bdgdiff\u4e2d\u7684t2\u548cc2\uff09\u4e0a\u8c03\u7684peak\n# common.bed\u6587\u4ef6\u4e2d\u4fdd\u5b58\u7684\u662f\u6ca1\u6709\u8fbe\u5230\u9608\u503c\u7684\uff0c\u975e\u663e\u8457\u5dee\u5f02peak\n# \u6700\u540e\u4e00\u5217\u7684\u5185\u5bb9\u4e3alog10 likehood ratio\u503c\uff0c\u7528\u6765\u8861\u91cf\u4e24\u4e2a\u6761\u4ef6\u4e4b\u95f4\u7684\u5dee\u5f02\uff0c\u9ed8\u8ba4\u9608\u503c\u4e3a3\uff0c\u5927\u4e8e\u9608\u503c\u7684peak\u4e3a\u7ec4\u95f4\u5dee\u5f02\u663e\u8457\u7684peak, \u8fd9\u4e2a\u9608\u503c\u53ef\u4ee5\u901a\u8fc7-c\u53c2\u6570\u8fdb\u884c\u8c03\u6574\n$ diff_R_vs_UR_c3.0_common.bed  diff_R_vs_UR_c3.0_cond1.bed  diff_R_vs_UR_c3.0_cond2.bed\n\n# homer\u6ce8\u91ca\u7ed3\u679c\uff1a\nls *.bed | perl -ne &#039;chomp; if ($_ =~ m|(\\S+).bed|) { print &quot;annotatePeaks.pl $1_summits.bed hg38 &gt; $1_peak.annotation.xls &amp;&amp; echo $1 ok\\n&quot;; }&#039; &gt; homer_annotatePeaks.sh\n<\/code><\/pre>\n<h2>6. \u4e0b\u6e38\u5206\u67902-\u5cf0\u6ce8\u91ca<\/h2>\n<pre><code class=\"language-R\">library(ChIPseeker)\nlibrary(GenomicFeatures)\n\n#\u751f\u6210txdb\u5bf9\u8c61\uff0c\u5982\u679c\u7814\u7a76\u7269\u79cd\u6ca1\u6709\u5df2\u77e5\u7684TxDb,\u53ef\u4ee5\u7528GenomicFeatures\u4e2d\u7684\u51fd\u6570\u751f\u6210\ntxdb&lt;- makeTxDbFromGFF(\u2018gene.gtf\u2019)\n\n#\u5bfc\u5165\u9700\u8981\u6ce8\u91ca\u7684peak\u6587\u4ef6\npeakfile &lt;-readPeakFile(\u2018A1_peaks.narrowPeak\u2019)\n\npeakAnno &lt;- annotatePeak(peakfile,tssRegion=c(-2000, 2000), TxDb=txdb)\n\n# \u7528peak\u6587\u4ef6\u548ctxdb\u8fdb\u884cpeak\u6ce8\u91ca\uff0c\u8fd9\u91cc\u53ef\u4ee5\u901a\u8fc7tssRegion\u5b9a\u4e49TSS\u533a\u57df\u7684\u533a\u95f4\n#\u5bf9\u4e8epeak\u6ce8\u91ca\u7684\u7ed3\u679c\uff0c\u4e5f\u53ef\u4ee5\u8fdb\u884c\u53ef\u89c6\u5316\u5c55\u793a\uff0c\u5982\uff1a\n\np &lt;- plotAnnoPie(peakAnno)\n<\/code><\/pre>\n<h2>7. \u5bcc\u96c6\u5206\u6790(goseq\u3001topGO\u7b49R\u5305)<\/h2>\n<pre><code><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>0. \u65b0\u5efa\u6587\u4ef6\u5939 mkdir {rawdata, align, macs3} 1. \u6570\u636e\u8d28\u63a7+\u8fc7\u6ee4\u540cWES &#038;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-201","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/comments?post=201"}],"version-history":[{"count":36,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/201\/revisions"}],"predecessor-version":[{"id":443,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/posts\/201\/revisions\/443"}],"wp:attachment":[{"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/media?parent=201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/categories?post=201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kz-hub.tech\/index.php\/wp-json\/wp\/v2\/tags?post=201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}