macでインフォマティクス

macでインフォマティクス

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

複雑な反復配列を迅速にインタラクティブなドットプロットで可視化する ModDotPlot

 

 ゲノムの反復配列を分析する一般的な方法は、ドットプロットによって可視化された配列類似性マトリックスを作成することである。StainedGlassのような革新的なアプローチは、ドットプロットを配列同一性のヒートマップとしてレンダリングすることにより、この古典的な可視化を改良し、研究者がセントロメアやゲノムの他のヘテロクロマティック領域内のマルチメガベースタンデムリピート配列をより良く可視化できるようにした。しかし、ヒートマップの類似度推定を行うには、高い計算オーバーヘッドが必要であり、精度が低下する可能性がある。本研究では、アライメントを必要としないインタラクティブなドットプロットビューアModDotPlotを紹介する。ModDotPlotは、k-merベースの封じ込めインデックスにより平均的なヌクレオチドの同一性を近似することで、StainedGlassよりも何桁も速く正確なプロットを作成する。本著者らは、シロイヌナズナの128Mbpの全ゲノムをラップトップで5分以内に可視化できる階層的モディマイザースキームを使用することにより、これを達成した。ModDotPlotはPythonで実装され、染色体全体のリアルタイム対話的ナビゲーションをサポートするグラフィカルユーザーインターフェースを持つ。ModDotPlotはhttps://github.com/marbl/ModDotPlotから利用できる。

 

 

レポジトリより

ModDotPlotは、StainedGlassに似た新しいドットプロット可視化ツールである。ModDotPlotは、modimizers を利用して、ゲノムのペアワイズコンビネーション間のContainment Indexを計算し、その平均ヌクレオチド同一性を高速に近似する。これにより、これらのプロットを作成するのに必要な計算時間が大幅に短縮され、リアルタイムで表示することを達成している。

インストール

M1 macでテストした(Rosetta2エミュレーション下)。

Github

https://github.com/marbl/ModDotPlot

git clone https://github.com/marbl/ModDotPlot.git
cd ModDotPlot
python -m venv venv
source venv/bin/activate
python -m pip install .

> moddotplot -h

  __  __           _   _____        _     _____  _       _   

 |  \/  |         | | |  __ \      | |   |  __ \| |     | |  

 | \  / | ___   __| | | |  | | ___ | |_  | |__) | | ___ | |_ 

 | |\/| |/ _ \ / _` | | |  | |/ _ \| __| |  ___/| |/ _ \| __|

 | |  | | (_) | (_| | | |__| | (_) | |_  | |    | | (_) | |_ 

 |_|  |_|\___/ \__,_| |_____/ \___/ \__| |_|    |_|\___/ \__|

 

v0.8.1 

 

usage: moddotplot [-h] {interactive,static} ...

 

ModDotPlot: Visualization of Complex Repeat Structures

 

positional arguments:

  {interactive,static}  Choose mode: interactive or static

    interactive         Interactive mode commands

    static              Static mode commands

 

options:

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

 

> moddotplot interactive -h

 

  __  __           _   _____        _     _____  _       _   

 |  \/  |         | | |  __ \      | |   |  __ \| |     | |  

 | \  / | ___   __| | | |  | | ___ | |_  | |__) | | ___ | |_ 

 | |\/| |/ _ \ / _` | | |  | |/ _ \| __| |  ___/| |/ _ \| __|

 | |  | | (_) | (_| | | |__| | (_) | |_  | |    | | (_) | |_ 

 |_|  |_|\___/ \__,_| |_____/ \___/ \__| |_|    |_|\___/ \__|

 

v0.8.1 

 

usage: moddotplot interactive [-h] (-f FASTA [FASTA ...] | -l LOAD) [-k KMER] [-m MODIMIZER] [-r RESOLUTION] [-w WINDOW] [-id IDENTITY] [-d DELTA] [-o OUTPUT_DIR] [--compare | --compare-only] [-s] [--port PORT] [--ambiguous] [-q] [--no-plot]

 

options:

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

  -f FASTA [FASTA ...], --fasta FASTA [FASTA ...]

                        Path to input fasta file(s).

  -l LOAD, --load LOAD  Load previously computed hierarchical matrices.

  -k KMER, --kmer KMER  k-mer length.

  -m MODIMIZER, --modimizer MODIMIZER

                        Modimizer sketch size. A lower value will reduce the number of modimizers, but will increase performance. Must be less than window length `-w`.

  -r RESOLUTION, --resolution RESOLUTION

                        Dotplot resolution, or the number of intervals to compare against.

  -w WINDOW, --window WINDOW

                        Window size, or the length in genomic coordinates of each interval. Default is set to (genome length)/(resolution)

  -id IDENTITY, --identity IDENTITY

                        Identity cutoff threshold.

  -d DELTA, --delta DELTA

                        Fraction of neighboring partition to include in identity estimation. Must be between 0 and 1, use > 0.5 is not recommended.

  -o OUTPUT_DIR, --output-dir OUTPUT_DIR

                        Directory name for saving matrices and coordinate logs. Defaults to working directory.

  --compare             Create a dotplot for each pairwise combination of input sequences (in addition to self-identity plots).

  --compare-only        Create a dotplot for each pairwise combination of input sequences (skips self-identity plots).

  -s, --save            Save hierarchical matrices to file.

  --port PORT           Port number for launching interactive mode on localhost. Only used in interactive mode.

  --ambiguous           Preserve diagonal when handling strings of ambiguous homopolymers (eg. long runs of N's).

  -q, --quick           Launch a quick, non-interactive version of interactive mode.

  --no-plot             Prevent launching dash after saving. Must be used in combination with --save.

 

 

 

実行方法

インタラクティブモードとStaticモードがある。

 

1、インタラクティブモード

モードの指定後、fastaファイルを指定する。

#インタラクティブ
moddotplot interactive -f input.fasta
  • interactive      Interactive mode commands
  • static              Static mode commands
  • -f    Fasta files to input. Multifasta files are accepted. Interactive mode will only support a maximum of two sequences at a time.

  • -o   Name of output directory for bed file & plots. Default is current working directory.

  • --port     Port to display ModDotPlot on. Default is 8050, this can be changed to any accepted port.

 

実行すると、計算が終わるまでしばらく時間がかかる。計算が終わるとマシンのlocalhost上でDashアプリケーションが起動する。ウェブブラウザを開き、http://127.0.0.1:にアクセスする。ここではhttp://127.0.0.1:8050/にアクセスする

(Dash が使用するデフォルトのポート番号は 8050で、 --portオプションを使ってカスタマイズできる)。

 

plotly のプロットは、ズーム(虫眼鏡)とパン(手)のアイコンを使って拡大と移動ができる。

リセットするには、ダブルクリックするかホームボタンをクリックする。

 

同一性(Identity)の閾値は右側のスライダーで変更できる。厳しくした。

2,Staticモード

moddotplot static -f input.fasta

計算が終わると染色体ごとにdot plotが出力される。

 

3,2つの配列間の比較

(マニュアルより)ModDotPlotは、入力配列のペア毎の組み合わせについて、a対bスタイルのドットプロットを作成することができる(注;interactiveモードでは最大2つの配列まで可能)。 self-identity plotの作成をスキップしたい場合は、-compare-onlyを使用する。

#a対bスタイルのドットプロットを作成
moddotplot interactive -f chr14_segment.fa chr21_segment.fa --compare

#a対bスタイルのドットプロットを作成、self-identity plotの作成はスキップ
moddotplot interactive -f chr14_segment.fa chr21_segment.fa --compare-only
  • --compare   If set when 2 or more sequences are input into ModDotPlot, this will show an a vs. b style plot, in addition to a self-identity plot. Note that interactive mode currently only supports a maximum of two sequences. If more than two sequences are input, only the first two will be shown.

  • --compare-only   If set when 2 or more sequences are input into ModDotPlot, this will show an a vs. b style plot, without showing self-identity plots

インタラクティブモードで --compare を実行すると、ドロップダウンメニューが表示され、自己同一性プロットとペアワイズプロットを切り替えることができる。

 

4,サーバーで実行した時

(マニュアルより)HPC環境でインタラクティブモードを実行するには、ポートフォワーディングを使用する。まずリモートのサーバーにアクセスして、通常通りModDotPlotを実行する。次にローカルマシンでポート転送トンネルをセットアップする。

moddotplot interactive -f in.fasta --port 8050

ssh -N -f -L <LOCAL_PORT_NUMBER>:127.0.0.1:8050 HPC@LOGIN.CREDENTIALS
#例
ssh  -N -f -L 8050:127.0.0.1:8050 kazuamx@xxx.xxx.x.xxx
  • --port     Port to display ModDotPlot on. Default is 8050, this can be changed to any accepted port.

これでhttp://127.0.0.1:にアクセスしてModDotPlotの結果を確認できる。

chromeでアクセスした。

 

その他

  • ModDotPlotをstaticプロットで実行する場合(特に極端にカスタマイズされたプロットを作成する場合)、設定ファイルを使用することが推奨される。JSON形式の設定ファイルはコマンドライン引数と同じ構文を受け付ける。
  • 論文にStainedGlassと比較したベンチマークがある。CPU時間はStainedGlassより2桁以上短く、メモリ使用量もStainedGlassより1/10以下になっている。

引用

ModDotPlot—Rapid and interactive visualization of complex repeats

Alexander P. Sweeten,  Michael C. Schatz,  Adam M. Phillippy

bioRixv, Posted April 19, 2024.

 

コメント

一度紹介してますが、プレプリントが出て使い方も変わっているので再度紹介しました。

 

関連

大量のタンデムリピート構造を含むゲノムをインタラクティブに可視化する StainedGlass