macでインフォマティクス

macでインフォマティクス

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

曖昧さを考慮したドットプロットによる視覚的な配列解析を行う FlexiDot

 

 FlexiDotはクロスプラットフォームのドットプロットスイートで、高品質の自己、ペアワイズ、all versus allのビジュアライゼーションを生成する。コンセンサス配列とエラーの多い配列を比較する際のドットプロットの適合性を向上させるために、FlexiDotは曖昧さや置換を厳密または緩和して処理するルーチンを備えている。シェーディングモジュールは、配列アノテーションや配列の類似性に関する情報を追加することで、ドットプロットの解釈やモチーフの識別を容易にする。コラージュのような出力と組み合わせることで、FlexiDotは大規模な配列セットの同時視覚的スクリーニングをサポートし、ドットプロットを日常的な分析に使用することを可能にする。

 FlexiDot は Python 2.7 で実装されている。ソフトウェアとドキュメントは http://github.com/molbio-dresden/flexidot から自由に入手できる。

 

SupplementaryData.pdf

https://github.com/molbio-dresden/flexidot/blob/master/documentation/SupplementaryData.pdf

 

インストール

condaでpython2.7の環境を作ってテストした。

依存

  • Python 2.7
  • numpy
  • matplotlib
  • biopython
  • regex
  • colormap
  • easydev (required for colormap)
  • colour

Github

mamba create -n FlexiDot -y python=2.7
conda activate FlexiDot
mamba install -c bioconda -y numpy matplotlib biopython regex colormap easydev colour
git clone https://github.com/molbio-dresden/flexidot.git
cd flexidot/

> python code/flexidot_v1.06.py

FLEXIDOT

-------------------------------------------------------------------

 

Version:

1.06

 

Citation: 

Kathrin M. Seibt, Thomas Schmidt, Tony Heitkam (2018) 

"FlexiDot: Highly customizable ambiguity-aware dotplots for visual sequence investigation"

Bioinformatics 34 (20), 3575–3577, doi: 10.1093/bioinformatics/bty395

 

 

General usage: 

$ python flexidot.py -a [ARGUMENTS]

$ python flexidot.py -i <fasta_file_name> [ARGUMENTS]

 

 

ARGUMENTS

-------------------------------------------------------------------

 

 

INPUT/OUTPUT OPTIONS... required are [-a] OR [-i]

 

-a, --auto_fas Imports all fasta files from current directory (*.fasta, *.fas, *.fa, *.fna)

-i is not needed, if -a is activated

[inactive by default]

 

-i, --in_file Input fasta file (fasta file name or comma-separated file list)

> Provide multiple files: Recall -i or provide comma-separated file names

 

-o, --output_file_prefix File prefix to be added to the generated filenames [default = NONE]

 

-c, --collage_output Multiple dotplots are combined in a collage 

Y or 1 = ON [default]

N or 0 = OFF

 

-m, --m_col Number of columns per page [default = 4] (only if --collage_output is ON)

 

-n, --n_row Number of rows per page [default = 5] (only if --collage_output is ON)

 

-f, --filetype Output file format

0 = PNG [default]

1 = PDF

2 = SVG

 

-s, --alphabetic_sorting Sort sequences alphabetically according to titles 

Y or 1 = ON

N or 0 = OFF [default]

 

 

CALCULATION PARAMETERS...

 

-k, --wordsize Wordsize (kmer length) for dotplot comparison [default = 10]

 

-p, --plotting_mode Mode of FlexiDot dotplotting

0 = self [default]

1 = paired

2 = poly (matrix with all-against-all dotplots)

> Run multiple plotting modes: Recall -p or provide comma-separated numbers

 

-t, --type_nuc Type of residue is nucleotide

Y or 1 = nucleotide [default]

N or 0 = amino acid

 

-w, --wobble_conversion Ambiguity handling for relaxed matching

Y or 1 = ON

N or 0 = OFF [default]

 

-S, --substitution_count Number of substitutions (mismatches) allowed per window for relaxed matching 

[default = 0]

 

-r, --rc_option Find reverse complementary matches (only if type_nuc=y)

Y or 1 = ON [default]

N or 0 = OFF

 

-O, --only_vs_first_seq Limit pairwise comparisons to match all sequences to 1st sequence only 

(only if --plotting_mode=1) 

Y or 1 = ON 

N or 0 = OFF [default]

 

GRAPHIC FORMATTING...

 

-A, --line_width Line width [default = 1]

 

-B, --line_col_for Line color [default = black]

 

-C, --line_col_rev Reverse line color [default = green]

 

-D, --x_label_pos Position of the X-label

Y or 1 = top [default]

N or 0 = bottom

 

-E, --label_size Font size [default = 10]

 

-F, --spacing Spacing between all-against-all dotplots (only if --plotting_mode=2)

[default = 0.04]

 

-L, --length_scaling Scale plot size for pairwise comparison (only if --plotting_mode=1) 

Y or 1 = Scaling ON (axes scaled according to sequence length)

N or 0 = Scaling OFF (squared plots) [default]

 

-M, --mirror_y_axis Flip y-axis bottom to top (cartesian coordinate system)

Y or 1 = y-axis bottom to top 

N or 0 = y-axis top to bottom [default]

 

-P, --plot_size Plotsize [default = 10]

 

-R, --representation Region of plot to display (only if --plotting_mode=2)

0 = full [default]

1 = upper

2 = lower

 

-T, --title_length Limit title length for dotplot comparisons

[default = 20]

Position of selection can be specified by appending a letter (e.g. -T 20E)

B = beginning [default]

E = end

 

 

GFF SHADING (for -p/--plotting_mode=0 only)...

 

-g, --input_gff_files GFF3 file used for markup in self-dotplots

(provide multiple files: Recall -g or provide comma-separated file names)

 

-G, --gff_color_config_file Tab-delimited config file for custom gff shading

column 1: feature type

column 2: color

column 3: alpha

column 4: zoom factor (for small regions)

 

 

LCS SHADING OPTIONS (for -p/--plotting_mode=2 only)...

 

-x, --lcs_shading Shade subdotplot based on the length of the longest common substring (LCS)

Y or 1 = ON

N or 0 = OFF [default]

 

-X, --lcs_shading_num Number of shading intervals (hues) for LCS (-x) and user matrix shading (-u) 

[default = 5]

 

-y, --lcs_shading_ref Reference for LCS shading

0 = maximal LCS length [default]

1 = maximally possible length (length of shorter sequence in pairwise comparison)

2 = given interval sizes - DNA [default 100 bp] or proteins [default 10 aa] - see -Y

 

-Y, --lcs_shading_interval_len Length of intervals for LCS shading (only if --lcs_shading_ref=2) 

[default for nucleotides = 50; default for amino acids = 10]

 

-z, --lcs_shading_ori Shade subdotplots according to LCS on

0 = forward [default],

1 = reverse, or

2 = both strands (forward shading above diagonal, reverse shading on diagonal and below;

if using --input_user_matrix_file, best LCS is used below diagonal)

 

 

CUSTOM USER MATRIX SHADING OPTIONS (for -p/--plotting_mode=2 only)...

 

-u, --input_user_matrix_file Shading above diagonal according to values in matrix file specified by the user

(tab-delimited or comma-separated matrix with sequence name in column 1 and numbers in columns 2-n 

e.g. identity matrix from multiple sequence alignment - strings are ignored)

 

-U, --user_matrix_print Display provided matrix entries in the fields above diagonal of all-against-all dotplot

Y or 1 = ON

N or 0 = OFF [default]

 

 

OTHERS...

 

-h, --help Help screen

 

-v, --verbose Verbose

 

 

テストラン

fasta配列(multi-fastaも可能)を指定する。

python code/flexidot_v1.06.py -i test-data/sSaTar_example/sSaTar.fas

#複数fastaファイル
python flexidot.py -i input1.fas,input2.fas

#カレントの全fasta配列
python flexidot.py -a
  • -i    Input fasta file (fasta file name or comma-separated file list)
  • -a   Imports all fasta files from current directory (*.fasta, *.fas, *.fa, *.fna)

出力

f:id:kazumaxneo:20210420013452p:plain

 

各配列を自分自身と比較するセルフドットプロットモード、ペアワイズで比較するペアワイズドットプロットモード、all-against-allモードの3つがある。-p <0|1|2>で指定する。デフォルトはセルフドットプロットモード(-p 0)になっている。

  • -p   Mode of FlexiDot dotplotting
    0 = self [default]
    1 = paired
    2 = poly (matrix with all-against-all dotplots)

 

 

1、セルフドットプロットモードでは、アノテーションされた配列領域を陰影で強調して、特定の配列コンテクストに明確に割り当てることができる。アノテーション情報は、gff3(general feature format)で提供する。

GFFをテストデータをランする。

python code/flexidot_v1.06.py -i test-data/sSaTar_example/sSaTar.fas -g test-data/sSaTar_example/sSaTar.gff3

f:id:kazumaxneo:20210421020625p:plain

凡例は別のファイルに生成される。

 

 

GFF ベースのシェーディングをカスタマイズするには、ユーザー定義の設定ファイルを -G/--gff_color_config オプションで指定する。

GFFとコンフィグを両方指定して テストデータをランする。

python code/flexidot_v1.06.py -i test-data/sSaTar_example/sSaTar.fas -g test-data/sSaTar_example/sSaTar.gff3

 

f:id:kazumaxneo:20210421020909p:plain

凡例は別のファイルに生成される。

 

ワードサイズや判例の設定など細かく指定してランする。

python code/flexidot_v1.06.py -i test-data/sSaTar_example/sSaTar.fas \
-p 0 -D y -f 1 -k 10 -w y -r y -x n -m 6 -P 15 \
-g test-data/sSaTar_example/sSaTar.gff3 \
-G test-data/sSaTar_example/sSaTar.config

Selfdotplot-GFF_Shading_Legend_n4.pdf

f:id:kazumaxneo:20210420013836p:plain

Selfdotplots_wordsize10_wobbles_collage-001.pdf

f:id:kazumaxneo:20210420013941p:plain

 

2、ペアワイズドットプロットモードではそれぞれの配列がペアワイズ比較される。配列数が多い場合には collage 出力をONにして(-c y)1つの画像ファイルにまとめることが推奨されている(OFFだと大量のファイルが生じるため)。

python code/flexidot_v1.06.py -i test-data/test-seqs.fas -p 1 -D y -f 0 -k 10 -w y -r y -m 5 -c y -L n 
  • -c    Multiple dotplots are combined in a collage
    Y or 1 = ON [default]
    N or 0 = OFF 
  • -L   Scale plot size for pairwise comparison (only if --plotting_mode=1)
    Y or 1 = Scaling ON (axes scaled according to sequence length)
    N or 0 = Scaling OFF (squared plots) [default]

コラージュ出力

f:id:kazumaxneo:20210421021904p:plain

デフォルトでは、ドットプロット画像は正方形のフォーマットになっている。これは、比較した配列の長さが大幅に異なる場合に、視認性を最大にするためと説明されている。

 

スケーリングを有効にする(-L y)。

python code/flexidot_v1.06.py -i test-data/test-seqs.fas -p 1 -D y -f 0 -k 10 -w y -r y -m 5 -c y -L y

f:id:kazumaxneo:20210421022642p:plain

 

スケーリングを有効にすると、コラージュ出力では短い方の配列の終わりを示す赤い破線が追加される。

 

 

all-against-allモードでは、FlexiDotは入力配列のセットから各ペアを比較する。長く共有されている部分配列を一目で確認できるように、FlexiDotはall-against-all比較のLCS長に基づいて類似性の陰影(オプション-x/--lcs_shadingでオン/オフ)を提供する。

python code/flexidot_v1.06.py -i test-data/test-seqs.fas -p 2 -D y -f 0 -t y -k 10 -w y -r y -x y -y 0
  • -x   Shade subdotplot based on the length of the longest common substring (LCS)
    Y or 1 = ON
    N or 0 = OFF [default] 

f:id:kazumaxneo:20210421023124p:plain

 

反復配列や遺伝子を比較することを想定しており、ゲノムのような長い配列にはデフォルトのパラメータでは向いていません。注意して下さい(詳細はPDFマニュアルで確認して下さい)。

引用

FlexiDot: highly customizable, ambiguity-aware dotplots for visual sequence analyses

Kathrin M Seibt, Thomas Schmidt, Tony Heitkam

Bioinformatics. 2018 Oct 15;34(20):3575-3577