macでインフォマティクス

macでインフォマティクス

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

インタラクティブなDNA配列の2次元プロットを作成する Squiggle

 

 次世代シークエンシング技術の登場により、DNA配列解析は、バイオインフォマティクスと生物学の両方でますます一般的なツールとなっている。この理由から、注釈されていないDNA配列を迅速に検査する能力は極めて重要である。しかし、FASTAファイルに含まれるようなrawシーケンシングデータは、視覚的に類似した文字の長いシーケンスであり、人間が探索するにはあまり適していない。例えば、複数の高度に保存されたコード配列を見る場合、肉眼で見るのが困難な異なる文字が比較的少なくてもよい。配列データをよりよく表示するために、DNAを構成するAs、Ts、Gs、およびCsの長い配列を2次元のグラフィカル表現に変えることができる多数の視覚化アルゴリズムがある(Gates、1986; Yauetal、2003; Randic et al 、2003b; Qi and Qi、2007)。
文献に記載された数多くのrawDNAシーケンシング可視化方法にもかかわらず、文献の総説はこれらの方法のオープンソースソフトウェア実装を特定しなかった。したがって、オープンソースコマンドラインツールであるSquiggleと、塩基配列を対話型のブラウザベースの2次元視覚化に変換するPythonパッケージを提案する。 

Squiggleは、raw DNA配列のインタラクティブなWebベースの2次元グラフィカル表現を自動的に生成するソフトウェアツールである。使いやすさを考慮して構築されたSquiggleは、いくつかの従来のシーケンス視覚化アルゴリズムを実装し、人間の使い勝手を最大限にするように設計された新しいvisualization手法を導入している。

 

マニュアル

https://squiggle.readthedocs.io/en/latest/

 

インストール

mac os10.13のpython3.4環境下でテストした。

Github

pip install squiggle

> squiggle -h

$ squiggle -h

Usage: squiggle [OPTIONS] [FASTA]...

 

Options:

  -w, --width FLOAT               The width of the line. Defaults to 1.

  -p, --palette TEXT              Which color palette to use. Choose from boke

                                  h.pydata.org/en/latest/docs/reference/palett

                                  es.html. Defaults to Category10.

  --color / --no-color            Whether to plot the visualizations in color.

  --hide / --no-hide              Whether to hide sequences when clicked in

                                  the legend. Defaults to false if plotting

                                  one sequence and true if plotting multiple.

  --bar / --no-bar                Whether to show a progress bar when

                                  processing multiple sequences. Defaults to

                                  true.

  -t, --title TEXT                A title to display when plotting sequences

                                  together.

  --separate                      Whether to plot the visualizations

                                  separately.

  -c, --cols INTEGER              The number of columns when plotting

                                  separately. Defaults to a the closest to

                                  square layout as possible.

  --link-x / --no-link-x          Whether to link the x axes for separate

                                  plotting. Defaults to true.

  --link-y / --no-link-y          Whether to link the y axes for separate

                                  plotting. Defaults to false.

  -o, --output PATH               The output file for the visualization. If

                                  not provided, will open visualization in

                                  browser. The filetype must be .html

  --offline                       Whether to include the resources needed to

                                  plot offline when outputting to file.

                                  Defaults to false.

  --method [squiggle|gates|yau|yau-bp|randic|qi]

                                  The visualization method.

  -d, --dimensions WIDTH HEIGHT   The width and height of the plot,

                                  respectively. If not provided, will default

                                  to 750x500.

  --skip / --no-skip              Whether to skip any warnings. Defaults to

                                  false.

  --mode [seq|file|auto]          Whether to treat each sequence or file as

                                  the individual object. Defaults to automatic

                                  selection.

  --legend-loc [top_left|top_center|top_right|center_right|bottom_right|bottom_center|bottom_left|center_left|center]

                                  Where to put the legend, if applicable.

                                  Defaults to top left.

  --output-backend [canvas|svg|webgl]

                                  Which output backend to use while plotting.

                                  Defaults to canvas.

  -s, --downsample INTEGER        The downsampling factor. Useful for handling

                                  large sequences. Default value is 1.

  -h, --help                      Show this message and exit.

 

 

実行方法

分析対象のFASTAを指定してsquiggleを叩く。(オフライン環境なら"--offline"をつける必要あり)。

squiggle human_HBB.fasta -o output.html

"-o outout.html"を除くと、デフォルトブラウザに標準出力される。

f:id:kazumaxneo:20180924183028p:plain

squiggle/example_seqsにあるテストデータを使っている。グラフは、インタラクティブなグラフを描けるBokehを使って作られていて、右上のボタンからリアルタイムに移動や拡大縮小ができる。

 

複数ゲノム

squiggle human_HBB.fasta chimpanzee_HBB.fasta norway_rat_HBB.fasta rhesus_HBB.fasta

f:id:kazumaxneo:20180924183134p:plain

 

分割描画

squiggle human_HBB.fasta chimpanzee_HBB.fasta --separate

f:id:kazumaxneo:20180924183428p:plain

出力のボタン操作はグラフ間で連動します(目盛りのリンクは--no-link-xと--no-link-yで無効化)。 

 

2ゲノム間の高発現な遺伝子を、26遺伝子までランダムサンプリングして比較

squiggle human_HBB.fasta chimpanzee_HBB.fasta --separate

 

グラフの高さと幅、タイトル、色を変更

squiggle human_HBB.fasta -d 650 150 -t β-globin -p Accent
  • -d <WIDTH HEIGHT>   The width and height of the plot, respectively. If not provided, will default to 750x500.
  • -t  TEXT     A title to display when plotting sequences together.
  • -p TEXT     Which color palette to use. Choose from bokeh.pydata.org/en/latest/docs/reference/palettes.html. Defaults to Category10.

f:id:kazumaxneo:20180924184617p:plain

Visualisation methodsはオンラインマニュアルにまとめられている。defaultでは"--method squiggle"(the 2bit encoding scheme that maps T to 00, C to 01, A to 10, and G to 11)だが、他のmethodに変更することもできる(link1, link2, link3)。

https://squiggle.readthedocs.io/en/latest/methods.html

 

 

引用

Squiggle: a user-friendly two-dimensional DNA sequence visualization tool

Benjamin D Lee

Bioinformatics 2018 ACCEPTED MANUSCRIPT