匿名
未登录
登录
医学百科
搜索
查看“BAM”的源代码
来自医学百科
名字空间
页面
更多
更多
语言
页面选项
Read
查看源代码
历史
←
BAM
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看和复制此页面的源代码。
<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>BAM</strong>(Binary Alignment Map,<strong>二进制比对图</strong>)是生物信息学中用于存储序列比对数据的标准文件格式。它是 <strong>[[SAM]]</strong>(Sequence Alignment/Map)格式的<strong>二进制压缩版本</strong>。 <br>BAM 文件由 <strong>[[Li Heng]]</strong> 等人(Samtools 团队)开发,旨在解决文本格式(SAM)体积庞大、读取速度慢的问题。它采用了专门的 <strong>BGZF</strong> 压缩算法,既大大减小了文件体积(通常为 SAM 的 1/4),又支持<strong>随机访问</strong>(Random Access)。 <br>在几乎所有的现代基因组分析流程(如 <strong>[[GATK]]</strong> 变异检测)中,BAM 都是核心的中间数据格式,用于连接上游的比对(Mapping)和下游的变异检出(Variant Calling)。 </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;">BAM</div> <div style="font-size: 0.7em; opacity: 0.85; margin-top: 4px; white-space: nowrap;">Binary Alignment Map (点击展开)</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;">Binary Alignment Map</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;"><code>.bam</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: #e11d48;"><code>.bai</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;">BGZF (分块Gzip)</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;">[[Li Heng]] (Samtools)</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;">Header</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #1e40af;">@HD, @SQ, @RG, @PG</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">Alignment</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;">比对位置, [[CIGAR]]</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569; border-bottom: 1px solid #e2e8f0;">Quality</th> <td style="padding: 6px 12px; border-bottom: 1px solid #e2e8f0; color: #0f172a;">Phred 分数 (ASCII)</td> </tr> <tr> <th style="text-align: left; padding: 6px 12px; background-color: #f8fafc; color: #475569;">操作工具</th> <td style="padding: 6px 12px; color: #1e40af;">[[Samtools]], [[Picard]]</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;">从文本到二进制:为什么需要 BAM?</h2> <p style="margin: 15px 0; text-align: justify;"> 虽然 [[SAM]] (Sequence Alignment/Map) 格式人类可读(Human-readable),但它对于计算机来说处理效率极低。BAM 的设计初衷就是为了解决这个问题。 </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: 20%;">特性</th> <th style="padding: 12px; border: 1px solid #cbd5e1; color: #1e40af; width: 40%;">SAM (文本)</th> <th style="padding: 12px; border: 1px solid #cbd5e1; color: #475569; width: 40%;">BAM (二进制)</th> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;">体积</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">巨大 (100GB+)</td> <td style="padding: 10px; border: 1px solid #cbd5e1;"><strong>压缩</strong> (约 25-30GB)</td> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;">可读性</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">可以直接用文本编辑器打开</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">乱码,需用 <code>samtools view</code> 查看</td> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;">随机访问</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">不支持 (必须从头读到尾)</td> <td style="padding: 10px; border: 1px solid #cbd5e1;"><strong>支持</strong> (需配合 .bai 索引)</td> </tr> <tr> <td style="padding: 10px; border: 1px solid #cbd5e1; font-weight: 600;">应用场景</td> <td style="padding: 10px; border: 1px solid #cbd5e1;">中间查看、调试</td> <td style="padding: 10px; border: 1px solid #cbd5e1;"><strong>存储</strong>、分析、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;">核心机制:索引与随机访问</h2> <p style="margin: 15px 0; text-align: justify;"> BAM 文件之所以能被 <strong>[[IGV]]</strong> 快速加载,或被 <strong>[[GATK]]</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>BGZF 压缩:</strong> BAM 并非一个大的压缩包,而是由许多独立的 64KB 小压缩块(Blocks)串联而成。这使得软件可以解压文件的任意一部分,而无需解压整个文件。</li> <li style="margin-bottom: 12px;"><strong>BAI 索引 (.bai):</strong> 类似于书籍的目录。它记录了每条染色体的特定位置(坐标)在 BAM 文件中的字节偏移量(Offset)。</li> <li style="margin-bottom: 0;"><strong>使用规则:</strong> 在进行任何下游分析前,<strong>必须</strong>对 BAM 文件进行排序(Coordinate Sort),并生成索引文件。BAM 和 BAI 必须同名且在同一目录下。</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. CIGAR String (雪茄串):</strong> 描述 Read 如何比对到参考序列上的字符串。例如 <code>100M</code> 表示 100 个碱基完全匹配;<code>50M2I48M</code> 表示中间有 2 个碱基的插入(Insertion)。它是 BAM 记录对齐信息的核心。 </p> <p style="margin: 12px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;"> <strong>2. Bitwise Flag (位标识):</strong> 一个整数(如 99, 147, 4),其二进制形式的每一位代表不同的含义(如:是否配对、是否反向互补、是否 PCR 重复)。使用 <code>samtools flags</code> 可以解读其含义。 </p> <p style="margin: 12px 0;"> <strong>3. CRAM:</strong> 下一代格式。比 BAM 压缩率更高(体积减小 30-50%),因为它只记录与参考基因组<strong>不同</strong>的碱基。随着数据量激增,CRAM 正在逐渐取代 BAM。 </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;">[点评]:SAM/BAM 格式的奠基论文。定义了该格式的标准规范,至今仍是生物信息学引用率最高的文献之一。</span> </p> <p style="margin: 12px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px;"> [2] <strong>Bonfield JK, et al. (2021).</strong> <em>The SAM/BAM/CRAM format specifications.</em> <strong>[[GitHub / HTS-Specs]]</strong>. <br> <span style="color: #475569;">[点评]:GA4GH 组织维护的官方技术文档,详细规定了 BAM 文件的每一个字节如何定义,是开发者必须遵循的“法律”。</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;">[[SAM]] (文本) • [[CRAM]] (高压缩) • [[BAI]] (索引)</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;">[[Samtools]] • [[Picard]] • [[GATK]] • [[IGV]]</td> </tr> </table> </div> </div>
返回至
BAM
。
导航
导航
症状百科
疾病百科
药品百科
中医百科
中药百科
人体穴位图
全国医院列表
功能菜单
最近更改
随机页面
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志