匿名
未登录
登录
医学百科
搜索
查看“Samtools”的源代码
来自医学百科
名字空间
页面
更多
更多
语言
页面选项
Read
查看源代码
历史
←
Samtools
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看和复制此页面的源代码。
<div style="padding: 0 4%; line-height: 1.8; color: #1e293b; font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', Arial, sans-serif; background-color: #ffffff; max-width: 1200px; margin: auto;"> <div style="margin-bottom: 30px; border-bottom: 1.2px solid #e2e8f0; padding-bottom: 25px;"> <p style="font-size: 1.1em; margin: 10px 0; color: #334155; text-align: justify;"> <strong>Samtools</strong> 是一套用于解析和处理高通量测序(HTS)数据的开源软件工具集,由著名生物信息学家 <strong>[[Li Heng]]</strong>(李恒)等人开发。它是生物信息学领域最基础、引用率最高的工具之一,被誉为处理 <strong>[[SAM]]</strong> / <strong>[[BAM]]</strong> / [[CRAM]] 格式文件的“瑞士军刀”。 <br>与基于 [[Java]] 的 <strong>[[Picard]]</strong> 不同,Samtools 采用 <strong>C语言</strong> 编写,以<strong>速度快</strong>、<strong>内存占用低</strong>著称,非常适合在服务器端处理海量数据。 <br>它不仅支持格式转换(如 SAM 转 BAM)、排序、索引和去重,还包含了一个轻量级的变异检测模块(mpileup/bcftools),是构建各类基因组分析流程(Pipeline)的基石。 </p> </div> <div class="medical-infobox mw-collapsible mw-collapsed" style="width: 100%; max-width: 320px; margin: 0 auto 35px auto; border: 1.2px solid #bae6fd; border-radius: 12px; background-color: #ffffff; box-shadow: 0 8px 20px rgba(0,0,0,0.05); overflow: hidden;"> <div style="padding: 15px; color: #1e40af; background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); text-align: center; cursor: pointer;"> <div style="font-size: 1.2em; font-weight: bold; letter-spacing: 1.2px;">Samtools</div> <div style="font-size: 0.7em; opacity: 0.85; margin-top: 4px; white-space: nowrap;">Sequence Alignment/Map Tools (点击展开)</div> </div> <div class="mw-collapsible-content"> <div style="padding: 25px; text-align: center; background-color: #f8fafc;"> <div style="font-size: 0.8em; color: #64748b; margin-top: 12px; font-weight: 600;">极速处理基因组数据的利器</div> </div> <table style="width: 100%; border-spacing: 0; border-collapse: collapse; font-size: 0.85em;"> <tr> <th colspan="2" style="padding: 8px 12px; background-color: #e0f2fe; color: #1e40af; text-align: left; font-size: 0.9em; border-top: 1px solid #bae6fd;">软件档案</th> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0; width: 40%;">核心开发者</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;">[[Li Heng]] (Sanger/Broad)</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">编写语言</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #1e40af;">C (基于 HTSlib)</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">操作对象</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;">[[SAM]], [[BAM]], [[CRAM]]</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">最新版本</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;">v1.x (长期维护)</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">开源协议</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #16a34a;">MIT / BSD</td> </tr> <tr> <th colspan="2" style="padding: 8px 12px; background-color: #e0f2fe; color: #1e40af; text-align: left; font-size: 0.9em; border-top: 1px solid #bae6fd;">常用指令</th> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">查看/转换</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #1e40af;"><code>view</code></td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">排序</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;"><code>sort</code></td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">建立索引</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;"><code>index</code></td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569;">简单统计</th> <td style="padding: 6px 12px; color: #1e40af;"><code>flagstat</code></td> </tr> </table> </div> </div> <h2 style="background: #f1f5f9; color: #0f172a; padding: 10px 18px; border-radius: 0 6px 6px 0; font-size: 1.25em; margin-top: 40px; border-left: 6px solid #0f172a; font-weight: bold;">核心指令:不仅是格式转换</h2> <p style="margin: 15px 0; text-align: justify;"> Samtools 的功能覆盖了测序数据处理的各个环节。对于生物信息分析师而言,熟练掌握以下命令是基本功。 </p> <div style="overflow-x: auto; margin: 20px auto;"> <table style="width: 100%; border-collapse: collapse; border: 1.2px solid #cbd5e1; font-size: 0.9em; text-align: left;"> <tr style="background-color: #f1f5f9; border-bottom: 2px solid #0f172a;"> <th style="padding: 12px; border: 1px solid #cbd5e1; color: #0f172a; width: 25%;">指令 (Command)</th> <th style="padding: 12px; border: 1px solid #cbd5e1; color: #1e40af; width: 35%;">典型用途</th> <th style="padding: 12px; border: 1px solid #cbd5e1; color: #475569; width: 40%;">应用场景</th> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;"><code>samtools view</code></td> <td style="padding: 10px; border: 1px solid #cbd5e1;">SAM ↔ BAM 互转;<br>提取特定区域的 Reads。</td> <td style="padding: 10px; border: 1px solid #cbd5e1;"><code>view -bS input.sam > output.bam</code><br>这是最常用的命令,将比对器输出的大体积文本转为二进制。</td> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;"><code>samtools sort</code></td> <td style="padding: 10px; border: 1px solid #cbd5e1;">按染色体坐标排序。</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">后续的索引(Index)、去重(MarkDup)和变异检测(Variant Calling)都要求 BAM 必须是排序过的。</td> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;"><code>samtools index</code></td> <td style="padding: 10px; border: 1px solid #cbd5e1;">生成 <strong>.bai</strong> 索引文件。</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">使得 IGV 或 GATK 可以<strong>随机访问</strong>文件中的任意位置,而无需从头读取。</td> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;"><code>samtools tview</code></td> <td style="padding: 10px; border: 1px solid #cbd5e1;">文本模式的基因组浏览器。</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">在没有图形界面的 Linux 服务器上,快速查看某个位点的比对情况(类似简易版 IGV)。</td> </tr> </table> </div> <h2 style="background: #f1f5f9; color: #0f172a; padding: 10px 18px; border-radius: 0 6px 6px 0; font-size: 1.25em; margin-top: 40px; border-left: 6px solid #0f172a; font-weight: bold;">HTSlib 与 BCFtools:三驾马车</h2> <p style="margin: 15px 0; text-align: justify;"> Samtools 并不是孤立存在的,它与底层的 <strong>HTSlib</strong> 以及兄弟软件 <strong>[[BCFtools]]</strong> 共同构成了处理测序数据的完整生态。 </p> <div style="background-color: #f0f9ff; border-left: 5px solid #1e40af; padding: 15px 20px; margin: 20px 0; border-radius: 4px;"> <ul style="margin: 0; padding-left: 20px; color: #334155;"> <li style="margin-bottom: 12px;"><strong>HTSlib:</strong> 一个独立的 C 语言库,提供了读取和写入 SAM/BAM/CRAM/VCF 文件的底层 API。Samtools 和 BCFtools 都是基于 HTSlib 构建的。</li> <li style="margin-bottom: 12px;"><strong>BCFtools:</strong> 专注于<strong>变异检测</strong>(Variant Calling)和 VCF 文件操作。早期的 samtools 包含一个 <code>mpileup</code> 命令用于生殖系变异检测,现在该功能通常配合 <code>bcftools call</code> 使用。</li> <li style="margin-bottom: 0;"><strong>生态位:</strong> Samtools 负责比对数据(BAM),BCFtools 负责变异数据(VCF),HTSlib 负责底层 I/O。</li> </ul> </div> <div style="font-size: 0.92em; line-height: 1.6; color: #1e293b; margin-top: 50px; border-top: 2px solid #0f172a; padding: 15px 25px; background-color: #f8fafc; border-radius: 0 0 10px 10px;"> <span style="color: #0f172a; font-weight: bold; font-size: 1.05em; display: inline-block; margin-bottom: 15px;">关键相关概念 [Key Concepts]</span> <p style="margin: 12px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;"> <strong>1. Flagstat:</strong> Samtools 提供的一个快速质控命令。它能瞬间统计出 BAM 文件中有多少条 Reads,其中多少条比对上了(Mapped),多少条是成对的(Paired),多少条是 PCR 重复。是拿到 BAM 文件后的必做步骤。 </p> <p style="margin: 12px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;"> <strong>2. Random Access (随机访问):</strong> Samtools 的核心优势。配合 <code>.bai</code> 索引,<code>samtools view</code> 可以直接提取染色体特定区域(如 <code>chr1:1000-2000</code>)的数据,耗时仅需毫秒级,而无需遍历几十 GB 的文件。 </p> <p style="margin: 12px 0;"> <strong>3. Pipe (管道操作):</strong> Samtools 支持 Linux 管道流(stdin/stdout)。这意味着你可以将 <code>bwa mem</code> 的输出直接通过 <code>|</code> 传递给 <code>samtools view</code> 再传递给 <code>samtools sort</code>,全程不生成中间文件,极大地节省了磁盘 I/O。 </p> </div> <div style="font-size: 0.92em; line-height: 1.6; color: #1e293b; margin-top: 20px; border-top: 2px solid #0f172a; padding: 15px 25px; background-color: #ffffff;"> <span style="color: #0f172a; font-weight: bold; font-size: 1.05em; display: inline-block; margin-bottom: 15px;">学术参考文献 [Academic Review]</span> <p style="margin: 12px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;"> [1] <strong>Li H, Handsaker B, Wysoker A, et al. (2009).</strong> <em>The Sequence Alignment/Map format and SAMtools.</em> <strong>[[Bioinformatics]]</strong>. <br> <span style="color: #475569;">[点评]:Samtools 的创世论文。不仅定义了软件,更定义了 BAM 文件格式标准,是生物信息学领域引用率最高的文献之一(引用数 > 30,000)。</span> </p> <p style="margin: 12px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;"> [2] <strong>Danecek P, Bonfield JK, Liddle J, et al. (2021).</strong> <em>Twelve years of SAMtools and BCFtools.</em> <strong>[[GigaScience]]</strong>. <br> <span style="color: #475569;">[点评]:综述性文章。回顾了 Samtools 十多年的发展历程,介绍了 CRAM 格式的支持以及算法性能的显著提升。</span> </p> </div> <div style="margin: 40px 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; font-family: 'Helvetica Neue', Arial, sans-serif; font-size: 0.9em;"> <div style="background-color: #eff6ff; color: #1e40af; padding: 8px 15px; font-weight: bold; text-align: center; border-bottom: 1px solid #dbeafe;"> 生物信息学 · 知识图谱 </div> <table style="width: 100%; border-collapse: collapse; background-color: #ffffff;"> <tr style="border-bottom: 1px solid #f1f5f9;"> <td style="width: 85px; background-color: #f8fafc; color: #334155; font-weight: 600; padding: 10px 12px; text-align: right; vertical-align: middle;">上级分类</td> <td style="padding: 10px 15px; color: #334155;">[[生物信息学]] • 序列分析软件</td> </tr> <tr style="border-bottom: 1px solid #f1f5f9;"> <td style="width: 85px; background-color: #f8fafc; color: #334155; font-weight: 600; padding: 10px 12px; text-align: right; vertical-align: middle;">核心开发者</td> <td style="padding: 10px 15px; color: #334155;">[[Li Heng]] • [[Sanger Institute]]</td> </tr> <tr> <td style="width: 85px; background-color: #f8fafc; color: #334155; font-weight: 600; padding: 10px 12px; text-align: right; vertical-align: middle;">关联工具</td> <td style="padding: 10px 15px; color: #334155;">[[BCFtools]] • [[Picard]] • [[GATK]] • [[IGV]]</td> </tr> </table> </div> </div>
返回至
Samtools
。
导航
导航
症状百科
疾病百科
药品百科
中医百科
中药百科
人体穴位图
全国医院列表
功能菜单
最近更改
随机页面
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志