@ gmod/ cram (英语)
在节点或浏览器中读取CMAM文件.
- 处理 CRAM 2.x和 3.x,
.crai索引,和每v3和v3.1代码, 包括 fqzcomp 和 tok3 . - 编解码器是 samtool 使用的 Htscodecs C 库,编译为
网络大会和内嵌在捆绑中,所以没有
.wasm要服务的文件 . - Golomb和Golomb-Rice仅使用v2文件,但没有执行.
npm install @gmod/cram
快开始
import { IndexedCramFile, CraiIndex } from '@gmod/cram'
import { IndexedFasta } from '@gmod/indexedfasta'
import { RemoteFile } from 'generic-filehandle2'
const fasta = new IndexedFasta({
fasta: new RemoteFile('https://example.com/reference.fa'),
fai: new RemoteFile('https://example.com/reference.fa.fai'),
})
const indexedFile = new IndexedCramFile({
cramUrl: 'https://example.com/file.cram',
index: new CraiIndex({ url: 'https://example.com/file.cram.crai' }),
fetchReferenceSequence: (seqId, start, end, refName, opts) =>
fasta.getSequence(refName, start, end, opts),
})
const records = await indexedFile.getRecordsForRange('chr1', 10000, 20000)
for (const record of records) {
for (const { code, refPos, bases } of record.getMismatches()) {
console.log(record.readName, String.fromCharCode(code), refPos, bases)
}
}
本地文件, 密码 cramPath, (中文(简体) ), CraiIndex({ path }) 财务报告和审定财务报表
IndexedFasta({ path })。 。 。 .
- 坐标为0-半开,如:
@gmod/bam; 为基于 1 的添加 1 sAM 等格式POS。 。 。 . - 在文件头中查询其名称的引用, 例如
chr1, (中文(简体) ),1或者说CHROMOSOME_I。文件名称缺少返回[]。 。 。 .
错位
record.getMismatches() 列表替换、插入、删除、引用
跳过和剪辑,和 forEachMismatch 把它们交给一个召回. code
是一个CIGAR字符代码(88 for X) (中文(简体) ).
import { RF_SUBST } from '@gmod/cram'
record.forEachMismatch(
(code, refPos, length, bases, qual, refBaseCode, clipLength) => {
if (code === RF_SUBST) {
console.log(refPos, bases)
}
},
{ start: 10000, end: 20000 }, // optional window
)
替换需要快速启动 fetchReferenceSequence,并读 N
没有它。 见 错配 用于字段和窗口,以及
参考序列 为召回.
记录
record.getReadBases() // 'ACGT…', the read sequence
record.getCigarString() // '50M2I48M'
record.getTag('NM') // one auxiliary tag
record.qualityScoreAt(0) // one base quality
record.isReverseComplemented() // the usual SAM flags
文件/附录 列出所有财产和方法.
标题、参考名称和取消
await indexedFile.cram.getReferenceInfo() // [{ name, length, md5 }, ...]
await indexedFile.cram.getSamHeader() // parsed SAM header
await indexedFile.hasDataForReferenceSequence('chrY') // false if the file has no chrY
const controller = new AbortController()
await indexedFile.getRecordsForRange('chr1', 0, 1_000_000, {
signal: controller.signal,
})
业绩
@gmod/range-cache-filehandle
将许多小 HTTP 请求的查询合并为更少, 重复使用字节
各种查询:
import { RemoteFileWithRangeCache } from '@gmod/range-cache-filehandle'
const indexedFile = new IndexedCramFile({
cramFilehandle: new RemoteFileWithRangeCache(url),
index: new CraiIndex({
filehandle: new RemoteFileWithRangeCache(`${url}.crai`),
}),
})
在浏览器中,切片默认在工人池上解码. 过
useSliceWorkerPool: false 关闭,或 numSliceWorkers 设置大小
(单位:千美元)工人) (中文(简体) ).
脚本标签
一个独立的浏览器构建将同样的导出打开 window.gmodCRAM,装入
它的编码工作从同一个目录中解码,没有它,在程序中解码. 这个
示例目录 有工作页.
<script src="https://unpkg.com/@gmod/cram/dist/cram-bundle.js"></script>
文档
学术用途
写为 (原始内容存档于2018-09-21) (韩语). NHGRI 供资,作为 J 浏览如果您在出版物中使用,请引用 最近JBrowse的论文 jbrowse.org (英语)。 。 。 .
许可证
麻省理工学院