ゲノム中の反復配列を検出するソフト、REpeat Detector : Redの使い方

ゲノム中の反復配列、トランスポゾン等を検出するソフトは色々と開発されている。代表的なものにRepeat Maskerだったり、RepeatScout、WindowMasker、RepeatModeler等々ある。

それぞれライブラリをベースに検出を行ったり、あるいは denovo 法に基づいていたりと様々であるが、計算が遅かったり感度が低かったり、高くても偽陽性が高かったりなど色々問題点は指摘されてきた。

そうした中で開発されたのが今回紹介する Red (REpeat Detector)である。

Redには以下の特徴がある。

  • Red は RepeatModeler などのように別の外部ツールに依存していないため、インストールが非常に簡単である
  • TE (トランスポゾン・転移因子)と TR (タンデムリピート・反復配列)の両方に対して良好に機能する
  • 他のいくつかのdenovo 検出ツールよりも遥かに高速である
  • 偽陽性率が低い
  • にもかかわらず感度が高い
  • 多くの反復セグメントを発見できる
  • 細菌ゲノムの繰り返し配列にも有効
  • アセンブルされていないゲノムも解析可能

等々(Girgis, 2015)。

内部的には機械学習を用いて、発見した繰り返し配列に対して自動でラベリングを行って学習をしていくらしい。詳しい原理等については原著論文を参照のこと。

今回は実際にそのRedを使い方を書き留めておこうと思う。

ダウンロードとインストール

こちらでバイナリもダウンロードできるが、Gitのほうが良いだろう。

https://github.com/BioinformaticsToolsmith/Red

インストールはここのREADMEに従う。

$ git clone https://github.com/BioinformaticsToolsmith/Red.git
$ cd Red/src_2.0
$ make bin
$ make
$ cd ../bin
$ ls

それでそのディレクトリにRedがあれば問題なくコンパイルができている。必要があればそれにPATHを通そう。

This is Red (REpeat Detector) designed and developed by Hani Zakaria Girgis, PhD.

Version: 2.0

Argument pairs of the form: -flag value are required.
Valid argument pairs:
        -gnm input genome directory, required.
                Files with ".fa" extension in this directory are used for completing the table of the adjusted counts.
                These Files are scanned for repeats.
        -dir directory including additional input sequences, optional.
                Files with ".fa" extension in this directory are NOT used for completing the table.
                These Files MUST have different names from those in the genome directory.
                These Files are scanned for repeats.
        -len word length equals k defining the k-mer. The default is floor(log_4(genome size)).
        -ord order of the background Markov chain. The default is floor(k/2)-1.
        -gau half width of the mask. The default is based on the GC content.
                20 if the GC content > 33% and < 67%, 40 otherwise.
        -thr the threshold score of the low adjusted scores of non-repeats. The default is 2.
        -min the minimum number of the observed k-mers. The default is 3.
        -tbl file where the table of the adjusted counts is written, optional.
        -sco directory where scores are saved, optional.
                Score files have the ".scr" extension.
        -cnd directory where candidate regions are saved, optional.
                Candidates files have the ".cnd" extension.
        -rpt directory where repeats locations are saved, optional.
                Repeats files have the ".rpt" extension.
        -msk directory where masked sequences are saved, optional.
                Masked sequences files have the ".msk" extension.
        -frm the format of the output: 1 (chrName:start-end) or 2 (chrName      start   end).
                The output format are zero based and the end is exclusive.
        -hmo file where the HMM is saved, optional.
        -cor integer of the number of threads, optional.
                The more threads, the higher the memory requirement.
                The defaul is the number of cores - 1, or 1 if single core is found.

Examples:
        The following command runs Red with the defaults and generates the masked sequences.
        Red -gnm genome_directory -msk output_directory

        The following command runs Red with the defaults and generates the masked sequences and the locations of repeats.
        Red -gnm genome_directory -msk output_directory -rpt output_directory

こうしたものが出てこればうまくいっている。

オプションについて

オプションは以下の通り。

  • -gnm : 必須項目。ゲノムが入ったディレクトリのパスを渡す。拡張子’.fa’について解析を行う。
  • -dir : 追加のインプットファイルがある場合、そのディレクトリのパスを渡す。’.fa’ではない拡張子である必要がある様子。
  • -len : k-merのサイズ。(デフォルト: log4[ゲノムサイズ])
  • -ord : マルコフ連鎖の順番? (デフォルト: (k/2)-1)
  • -gau : マスクの半分の幅。(デフォルト: GC含有量に基づいて算出)
  • -thr : 非リピートの調整スコアの閾値(デフォルト: 2)
  • -min : 観測されたk-mersの最小数(デフォルト: 3)
  • -sco : スコアの保存先。スコアファイルは ‘.scr’拡張子で保存される。
  • -cnd : 反復配列候補領域の保存先。拡張子は ‘.cnd’
  • -rpt : 反復配列位置情報の保存先。拡張子は ‘.rpt’
  • -msk : マスクされた配列の保存先。拡張子は ‘.msk’
  • -frm : アウトプットの保存形式。1 (chrName:start-end) or 2 (chrName start end).
  • -hmo : 隠れマルコフモデルの保存先。
  • -cor : 使用するスレッド数。デフォルトは[スレッド数-1]。

GPU使って学習を高速化~みたいなのはないのね。

使ってみる

ポリプテルスゲノムを用いてみた。約3.7Gb。環境はRyzen9 3950X、64GB RAM、Ubuntu 20.04 LTSだ。

$ mkdir Red_out
$ Red -gnm . -sco ./Red_out/ -cnd ./Red_out/ -msk ./Red_out/ -frm 2 -cor 32

全然スレッド数は専有しないので、8スレッドとかでも十分回るだろう。38分ほどで終了した。

マスキングされた配列を見たが、これソフトマスク(小文字に変換)なのか……

repのオプションをつけ忘れたので再度やり直そうと思ってディレクトリを同じものを指定したら前のファイルは最初に削除された。もし計算し直すのであればそこは注意しておきたい。

ちなみに、

$ Red -gnm . -rpt ./Red_out/ -frm 2 -cor 32

で出力させると、.bedファイルが出てくる。bedファイルなので、bedtoolsなどで切り出しが可能。

こんな感じで出力される。

NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	1937	3708
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	3738	4109
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	4139	5080
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	5118	5168
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	5298	5570
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	5644	5718
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	5777	8012
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	8093	10158
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	10284	10393
NC_053154.1 Polypterus senegalus isolate Bchr_013 chromosome 1, ASM1683550v1, whole genome shotgun sequence	10457	10575

追記(2021/08/26)

上記のゲノムだと>のヘッダ行にスペースが含まれるため、Bedtoolsが正常に動作しない。

そのため、スペースを削除する工程が必要である。sedコマンドを使ってやればいい。

$ sed 's/ //g' [input file] > [output file]

参考文献

  • Girgis, H. Z. (2015). Red: an intelligent, rapid, accurate tool for detecting repeats de-novo on the genomic scale. BMC bioinformatics16(1), 1-19.

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です