<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[bedtools intersect 用于计算多个bam的交集序列]]></title><description><![CDATA[<p dir="auto">1.工具<br />
<a href="https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html" rel="nofollow ugc">https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html</a></p>
<pre><code>git clone https://github.91chi.fun//https://github.com/arq5x/bedtools2.git
cd bedtools2/
make
</code></pre>
<p dir="auto">2.比对<br />
使用bwa mem 比对每个样本（例如烟草的组装后的结果）</p>
<pre><code>bwa mem ref.fa s1.fq | samtools sorted -o s1.sorted.bam -
</code></pre>
<p dir="auto">3.过滤<br />
过滤掉部分比对上的序列（soft clip和hard clip）和没有比对上的序列</p>
<pre><code>samtools view s1.sorted.bam | awk '$6 !~ /H|S/{print}' | samtools view -bS - &gt; s1.noclips.bam
samtools view -b -F 4  s1.noclips.bam -o s1.noclips.mapped.bam
</code></pre>
<p dir="auto">4.取各个样本的交集<br />
每次取2个 一直循环到最后1个</p>
<pre><code>../bin/bedtools intersect -a s1.noclips.mapped.bam -b s2.noclips.mapped.bam -bed &gt;intersect.s1.s2.bed
../bin/bedtools intersect -a intersect.s1.s2.bed -b s3.sorted.bam -bed &gt;intersect.s1.s2.s3.bed
</code></pre>
<p dir="auto">5.从每个样本提取序列<br />
使用最终的交集 bed 文件 提取包含这些交集的reads 每个样本都取一次</p>
<pre><code>samtools view s1.noclips.mapped.bam  -L intersect.s1.s2.s3.bed -o s1.regions.bam
samtools fasta s1.regions.bam -o s1.fasta
</code></pre>
]]></description><link>http://an.forum.genostack.com/topic/739/bedtools-intersect-用于计算多个bam的交集序列</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 14:12:01 GMT</lastBuildDate><atom:link href="http://an.forum.genostack.com/topic/739.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 02 Aug 2022 05:44:15 GMT</pubDate><ttl>60</ttl></channel></rss>