macでインフォマティクス

macでインフォマティクス

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

アセンブリのグラフを分析する Asgan

 

 Asgan - [As] sembly [G] raphs [An] alyzer - は、アセンブリグラフを分析するためのツールである。 このツールはGFA形式の2つのアセンブリグラフを入力として受け取り、そのグラフの最小セットの相同配列(シンテニーパス)を見つけ、見つかったパスに基づいてさまざまな統計を計算する。

 

詳細はこちら

 


 

 インストール

ubuntu16.0.4のminiconda3-4.3.30環境でテストした(docker使用、ホストOS macos10.12)。*1

依存

  • networkx、decorator等
  • graphviz (graph visualization)
conda install -y decorator networkx 
conda install -y graphviz

> dot -?

$ dot -?

Usage: dot [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>

(additional options for neato)    [-x] [-n<v>]

(additional options for fdp)      [-L(gO)] [-L(nUCT)<val>]

(additional options for memtest)  [-m<v>]

(additional options for config)  [-cv]

 

 -V          - Print version and exit

 -v          - Enable verbose mode 

 -Gname=val  - Set graph attribute 'name' to 'val'

 -Nname=val  - Set node attribute 'name' to 'val'

 -Ename=val  - Set edge attribute 'name' to 'val'

 -Tv         - Set output format to 'v'

 -Kv         - Set layout engine to 'v' (overrides default based on command name)

 -lv         - Use external library 'v'

 -ofile      - Write output to 'file'

 -O          - Automatically generate an output filename based on the input filename with a .'format' appended. (Causes all -ofile options to be ignored.) 

 -P          - Internally generate a graph of the current plugins. 

 -q[l]       - Set level of message suppression (=1)

 -s[v]       - Scale input by 'v' (=72)

 -y          - Invert y coordinate in output

 

 -n[v]       - No layout mode 'v' (=1)

 -x          - Reduce graph

 

 -Lg         - Don't use grid

 -LO         - Use old attractive force

 -Ln<i>      - Set number of iterations to i

 -LU<i>      - Set unscaled factor to i

 -LC<v>      - Set overlap expansion factor to v

 -LT[*]<v>   - Set temperature (temperature factor) to v

 

 -m          - Memory test (Observe no growth with top. Kill when done.)

 -m[v]       - Memory test - v iterations.

 

 -c          - Configure plugins (Writes $prefix/lib/graphviz/config 

               with available plugin information.  Needs write privilege.)

 -?          - Print usage and exit

 本体 Github

git clone --recurse-submodules https://github.com/epolevikov/Asgan
make -C Asgan/lib/minimap2

 > python asgan.py -h

$ python asgan.py -h

usage: asgan.py [-h] [--input-query INPUT_QUERY] [--input-target INPUT_TARGET]

                [--out-dir OUT_DIR]

 

optional arguments:

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

  --input-query INPUT_QUERY

  --input-target INPUT_TARGET

  --out-dir OUT_DIR

 

 

テストラン

2つのアセンブリのGFAファイルを指定する。

cd Asgan
python asgan.py \
--input-query=test/NCTC9016-Flye.gfa \
--input-target=test/NCTC9016-Canu.gfa \
--out-dir=output

テストデータはCanuとflyeのアセンブリ結果のGFAを指定している。graphvizに対応したgzファイル(.dot)が出力される。

 

stats

f:id:kazumaxneo:20190704235628p:plain

synteny_paths.txt

f:id:kazumaxneo:20190704235715p:plain

 

視覚化

cd output/
dot -Tpng -O adjacency_graph_query.gv
dot -Tpng -O adjacency_graph_target.gv

 

 

adjacency_graph_target.gv.png

下の図は、フォワードのパスが実線、リバースのパスが破線で表されている。ターゲット(ここではcanu)のアセンブリグラフパスは、フォワードが-2, -1, -4, +3、リバースが-3, +4, +1, +2のパスになっている。

f:id:kazumaxneo:20190622175529p:plain

 

adjacency_graph_query.gv.png

クエリとターゲットのパス番号は対応している。番号がついていない黒い線はターゲットのcanuには対応しないパスで、リピート解像されていない。

f:id:kazumaxneo:20190622175542p:plain

 

アセンブルを真面目に考えたい人にとっては便利なツールですね。まだ開発中のようですが、早めに紹介しました。Documentationが出てきたら詳細を追記します。

引用

GitHub - epolevikov/Asgan: A tool for analysis of assembly graphs

 

https://zenodo.org/record/3198701#.XQ3v8C_ANts

 

参考

https://dev.classmethod.jp/tool/graphviz-beginner/

 

ubuntu graphviz-dev パッケージ

Ubuntu – Package Search Results -- graphviz

 

*1

仮想環境でテストしましたが、導入時トラブりました。いきなり本番環境にいれないほうがいいと思います。