macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

BAMファイルからカバレッジトラックを抽出するシンプルで高速なツール covtobed

 

 バイオインフォマティクスの一般的な課題は、次世代シーケンシング実験で生成されたDNAシーケンシングリードを参照ゲノムにマッピングすることである。アラインメントの出力は、一般的にBAMファイルにエンコードされる(Li et al.2009)。DNAシーケンシングのいくつかのアプリケーションでは、特定の場所でのカバレッジデプスをBAMファイルの特定の位置で抽出し、その出力を標準のBEDフォーマット(Quinlan & Hall, 2010)で出力をエンコードする。ここでは、ソートされたBAMファイルから位置ごとのカバレッジの深さを抽出するように設計されたC++プログラムであるcovtobedについて説明する。BAMファイルのパーシング
の解析には、libbamtools(Barnett, Garrison, Quinlan, Strömberg, & Marth, 2011)を使用している。デザインは、UNIXのプログラミング哲学にヒントを得ており(Wikipedia contributors,2019)、したがって、covtobedは単一のタスクを実行し、入力および出力ストリームをサポートしている。

 

ベンチマーク (hyperfine(紹介)を使って実行)

https://github.com/telatin/covtobed/tree/master/benchmark

 

インストール

本体 Github

#conda (link)
mamba install -c bioconda covtobed -y

> covtobed

# covtobed -h

Usage: covtobed [options] [BAM]...

 

Computes coverage from alignments

 

Options:

  -h, --help            show this help message and exit

  --version             show program's version number and exit

  --physical-coverage   compute physical coverage (needs paired alignments in input)

  -q MINQ, --min-mapq=MINQ

                        skip alignments whose mapping quality is less than MINQ

                        (default: 0)

  -m MINCOV, --min-cov=MINCOV

                        print BED feature only if the coverage is bigger than

                        (or equal to) MINCOV (default: 0)

  -x MAXCOV, --max-cov=MAXCOV

                        print BED feature only if the coverage is lower than

                        MAXCOV (default: 100000)

  -l MINLEN, --min-len=MINLEN

                        print BED feature only if its length is bigger (or equal

                        to) than MINLELN (default: 1)

  -z MINCTGLEN, --min-ctg-len=MINCTGLEN

                        Skip reference sequences (contigs) shorter than this value

  -d, --discard-invalid-alignments

                        skip duplicates, failed QC, and non primary alignment,

                        minq>0 (or user-defined if higher) (default: 0)

  --output-strands      output coverage and stats separately for each strand

  --format=CHOICE       output format

 

 

実行方法

ソートされたBAMファイルを読み込み、BED形式でそのカバレッジでをプリントする。同じカバレッジを持つ連続した塩基をstart_pos-end_posとして表すので、特定のカバレッジ範囲を持つ領域のみをBEDファイルに出力することができる。

covtobed input.bam > output.bed

 

テストラン

git clone https://github.com/telatin/covtobed.git
cd covtobed/
covtobed -m 0 -x 5 test/demo.bam
  • -m    print BED feature only if the coverage is bigger than (or equal to) MINCOV (default: 0)
  • -x     print BED feature only if the coverage is lower than MAXCOV (default: 100000)   

 

引用

covtobed: a simple and fast tool to extract coverage tracks from BAM files

Giovanni Birolo and Andrea Telatin

Journal of Open Source Software, vol. 5, issue 47, id. 2119

 

関連