[关闭]
@lakesea 2021-04-27T01:10:57.000000Z 字数 3018 阅读 1202

比对文件BAM/CAM深度检测好用工具:Mosdepth

生信工具


做完比对后,最直接的一个问题就是想知道:你的reads比对上了哪些区域没比对上哪些区域,有多少reads比对上特定的区域(该区域比对深度)。传统手艺一般可以使用bedtools cov或者samtools depth来直接实现,但是受限其速度,这些工具我个人用起来体验不太好,特别是对文件大小很大的BAM file。今天就给大家推荐一款我觉得非常好用,速度很快的比对文件BAM/CAM深度检测好用工具,Mosdepth

工具简介

Mosdepth是一种新的命令行工具,用于快速计算全基因组测序覆盖率。它测量BAM或CRAM文件在基因组中每个核苷酸位置或基因组区域的深度。可以将基因组区域指定为被BED文件覆盖的指定区域,或者指定为CNV calling所需的固定大小窗口。Mosdepth使用一种计算效率高的简单算法,使其能够快速生成覆盖摘要。Mosdepth比现有工具更快,并且提供了所产生的覆盖剖面类型的灵活性。

工具特点

总的来说,Mosdepth有以下几项比较显著的特点:

工作原理

当遇到每条染色体时,mosdepth会在染色体的长度上创建一个数组。对于遇到的每个起始位置,它会增加数组位置的值。对于每个停止的位置,它会减少该位置。由此,特定位置处的深度是其前面的所有阵列位置的累积和(在BEDTools中使用类似的算法,其中单独跟踪开始和停止)。 mosdepth避免重复计算重叠的配偶对,并使用CIGAR操作跟踪每个读取的每个比对上的部分。由于这种数据结构,可以在不显着增加运行时间的情况下完成覆盖分布计算。下图显示了这个概念:

这个数组计算非常快。因为其没有额外的分配或跟踪对象,它在概念上也很简单。由于这些原因,它比samtools depth更快。

工具安装

目前最新版是v 0.2.6,安装方法有很多可以直接下载编译好的版本:

  1. ###下载地址
  2. https://github.com/brentp/mosdepth/releases

或者直接通过conda来安装

  1. conda install mosdepth

使用说明

  1. mosdepth 0.2.3
  2. Usage: mosdepth [options] <prefix> <BAM-or-CRAM>
  3. Common Options:
  4. -t --threads <threads> number of BAM decompression threads. (use 4 or fewer) [default: 0]
  5. -c --chrom <chrom> chromosome to restrict depth calculation.
  6. -b --by <bed|window> optional BED file or (integer) window-sizes.
  7. -n --no-per-base dont output per-base depth. skipping this output will speed execution
  8. substantially. prefer quantized or thresholded values if possible.
  9. -f --fasta <fasta> fasta file for use with CRAM files.
  10. Other options:
  11. -F --flag <FLAG> exclude reads with any of the bits in FLAG set [default: 1796]
  12. -i --include-flag <FLAG> only include reads with any of the bits in FLAG set. default is unset. [default: 0]
  13. -x --fast-mode dont look at internal cigar operations or correct mate overlaps (recommended for most use-cases).
  14. -q --quantize <segments> write quantized output see docs for description.
  15. -Q --mapq <mapq> mapping quality threshold [default: 0]
  16. -T --thresholds <thresholds> for each interval in --by, write number of bases covered by at
  17. least threshold bases. Specify multiple integer values separated
  18. by ','.
  19. -R --read-groups <string> only calculate depth for these comma-separated read groups IDs.
  20. -h --help show help

简单说说我平时常用到的参数:

根据bed文件来计算指定区间的覆盖度:

  1. mosdepth -b capture.bed sample-output sample.exome.bam

进一步使用-T根据指定阀值进行计算:

  1. mosdepth --by exons.bed --thresholds 1,10,20,30 $prefix $bam

输出效果如下:

  1. #chrom start end region 1X 10X 20X 30X
  2. 1 11869 12227 ENSE00002234944 358 157 110 0
  3. 1 11874 12227 ENSE00002269724 353 127 10 0
  4. 1 12010 12057 ENSE00001948541 47 8 0 0
  5. 1 12613 12721 ENSE00003582793 108 0 0 0

该工具我个人体验非常好,又快又好用,输出结果简单易懂。如果有需要计算比对覆盖需求的小伙伴可以试一试哦。最后给大家附上其github链接以便大家进一步研究使用该工具:https://github.com/brentp/mosdepth

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注