macでインフォマティクス

macでインフォマティクス

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

マルチプルシーケンスアラインメント(MSA)のクリーニングツール CIAlign

2022/03/15 論文引用

 

 生物学の分野では、生物学的な特徴や関係性を調べるための多くの調査の基礎となっているのが、複数の配列のアラインメント(MSA)である。これらのアラインメントは、多くのバイオインフォマティクス解析の中心となっている。しかし、MSAの配列は不完全であったり、非常に乖離していたりすることが多く、そのためにアライメントが不十分な領域や、アライメントに大きなギャップが生じてしまうことがある。これは計算を遅くし、生物学的に関連性がなくても結論に影響を与える可能性がある。そのため、これらの領域を除去してアライメントをきれいにすることで、解析を大幅に改善することができる。

 ここでは、複数の可視化オプションを備えた、包括的でユーザーフレンドリーなMSAトリミングツールを提供する。高度にカスタマイズ可能なコマンドラインツールは、様々なオプションを提供することでユーザーに介入力を与えることを目的としており、処理前と処理後のアライメントをグラフィカルに表示して、何が除去されたかの明確な概要をユーザーに提供する。このツールの主な機能には、挿入によるカバレッジの低い領域の除去、ギャップの除去、アライメントの悪い末端領域のクロップ、発散しすぎた配列や短すぎる配列の除去などがある。各機能のしきい値はユーザーが指定することができ、パラメータは個々のMSAに合わせて調整することができる。CIAlignは既存のアラインメントトリミングツールを補完するものであり、特定のアラインメント問題や一般的なアラインメント問題を解決し、ユーザーに透明性を提供することに重点を置いている。

 CIAlignは効果的にMSAからアライメントの悪い領域や配列を除去し、新しい可視化オプションを提供する。このツールは、さらなる解析や処理のためのアラインメントの品質を向上させるために使用することができる。このツールは、MSAの一部を自動的にクリーンアップしたい人や、大規模なMSAを可視化するための新しいアクセス可能な方法を必要としている人を対象としている。

 

CIAlignより、ユーザーは以下のことが可能になる。(Githubより)

MSAからノイズ源を除去する

  • 大部分の配列に存在しない挿入を削除する
  • 閾値以下の塩基数またはアミノ酸数の配列を削除する
  • トリミングの際にアライメントの悪い配列が終了する
  • 隙間だけを含む列を削除する
  • 乖離が閾値パーセンテージ以上の配列を除去する

コンセンサス配列の生成

アライメントの可視化

  • アライメント前後の画像ファイルを生成する
  • シーケンスロゴを描く
  • アライメントの各位置でのカバレッジを可視化する

アライメント統計の分析

  • 各シーケンスペア間の同一性のパーセンテージを示す類似性マトリックスを生成する

アライメントを解除する

UをTに置き換える

 

2023/04/20

2022/03/15

 

 

インストール

condaでpython3.7の仮想環境を作ってテストした(macos10.14使用)。

依存

python >= 3.6
matplotlib >= 2.1.1
numpy >= 1.16.3
scipy >= 1.3.0

Github

conda create -n CIAlign -y python=3.7
conda activate CIAlign
pip3 install cialign

> CIAlign --help

$ CIAlign --help

usage: CIAlign [--infile INFILE] [--inifile INIFILE]

               [--outfile_stem OUTFILE_STEM] [--all] [--silent] [--crop_ends]

               [--crop_ends_mingap_perc CROP_ENDS_MINGAP_PERC]

               [--crop_ends_redefine_perc CROP_ENDS_REDEFINE_PERC]

               [--remove_divergent]

               [--remove_divergent_minperc REMOVE_DIVERGENT_MINPERC]

               [--remove_insertions] [--insertion_min_size INSERTION_MIN_SIZE]

               [--insertion_max_size INSERTION_MAX_SIZE]

               [--insertion_min_flank INSERTION_MIN_FLANK] [--remove_short]

               [--remove_min_length REMOVE_MIN_LENGTH] [--keep_gaponly]

               [--make_consensus] [--consensus_type CONSENSUS_TYPE]

               [--consensus_keep_gaps] [--consensus_name CONSENSUS_NAME]

               [--plot_input] [--plot_output] [--plot_markup]

               [--plot_dpi PLOT_DPI] [--plot_format PLOT_FORMAT]

               [--plot_width PLOT_WIDTH] [--plot_height PLOT_HEIGHT]

               [--make_sequence_logo]

               [--sequence_logo_type SEQUENCE_LOGO_TYPE]

               [--sequence_logo_dpi SEQUENCE_LOGO_DPI]

               [--sequence_logo_font SEQUENCE_LOGO_FONT]

               [--sequence_logo_nt_per_row SEQUENCE_LOGO_NT_PER_ROW]

               [--sequence_logo_filetype SEQUENCE_LOGO_FILETYPE]

               [--list_fonts_only] [--plot_coverage_input]

               [--plot_coverage_output]

               [--plot_coverage_dpi PLOT_COVERAGE_DPI]

               [--plot_coverage_height PLOT_COVERAGE_HEIGHT]

               [--plot_coverage_width PLOT_COVERAGE_WIDTH]

               [--plot_coverage_colour PLOT_COVERAGE_COLOUR]

               [--plot_coverage_filetype PLOT_COVERAGE_FILETYPE]

               [--make_similarity_matrix_input]

               [--make_similarity_matrix_output]

               [--make_simmatrix_dp MAKE_SIMMATRIX_DP]

               [--make_simmatrix_minoverlap MAKE_SIMMATRIX_MINOVERLAP]

               [--make_simmatrix_keepgaps MAKE_SIMMATRIX_KEEPGAPS]

               [--unalign_input] [--unalign_output] [--replace_input]

               [--replace_output] [-h] [-v]

 

Clean and interpret a multiple sequence alignment Args that start with '--'

(eg. --infile) can also be set in a config file (specified via --inifile).

Config file syntax allows: key=value, flag=true, stuff=[a,b,c] (for details,

see syntax at https://goo.gl/R74nmi). If an arg is specified in more than one

place, then commandline values override config file values which override

defaults.

 

Required Arguments:

  --infile INFILE       Path to input alignment file in FASTA format

 

Optional Arguments:

  --inifile INIFILE     Path to config file. Default: None

  --outfile_stem OUTFILE_STEM

                        Prefix for output files, including the path to the

                        output directory. Default: CIAlign

  --all                 Use all available functions with default parameters.

  --silent              Do not print progress to the screen. Default: False

  --crop_ends           Crop the ends of sequences if they are poorly aligned.

                        Default: False

  --crop_ends_mingap_perc CROP_ENDS_MINGAP_PERC

                        Minimum proportion of the sequence length (excluding

                        gaps) that is the threshold for change in gap numbers.

                        Default: 0.05

  --crop_ends_redefine_perc CROP_ENDS_REDEFINE_PERC

                        Proportion of the sequence length (excluding gaps)

                        that is being checked for change in gap numbers to

                        redefine start/end. Default: 0.1

  --remove_divergent    Remove sequences with <= N proportion of positions at

                        which the most common base / amino acid in the

                        alignment is present. Default: False

  --remove_divergent_minperc REMOVE_DIVERGENT_MINPERC

                        Minimum proportion of positions which should be

                        identical to the most common base / amino acid in

                        order to be preserved. Default: 0.75

  --remove_insertions   Remove insertions found in <= 50 percent of sequences

                        from the alignment. Default: False

  --insertion_min_size INSERTION_MIN_SIZE

                        Only remove insertions >= this number of residues.

                        Default: 3

  --insertion_max_size INSERTION_MAX_SIZE

                        Only remove insertions <= this number of residues.

                        Default: 100

  --insertion_min_flank INSERTION_MIN_FLANK

                        Minimum number of bases on either side of an insertion

                        to classify it as an insertion. Default: 5

  --remove_short        Remove sequences <= N bases / amino acids from the

                        alignment. Default: False

  --remove_min_length REMOVE_MIN_LENGTH

                        Sequences are removed if they are shorter than this

                        minimum length, excluding gaps. Default: 50

  --keep_gaponly        Keep gap only columns in the alignment. Default: True

  --make_consensus      Make a consensus sequence based on the cleaned

                        alignment. Default: False

  --consensus_type CONSENSUS_TYPE

                        Type of consensus sequence to make - can be majority,

                        to use the most common character at each position in

                        the consensus, even if this is a gap, or

                        majority_nongap, to use the most common non-gap

                        character at each position. Default: majority

  --consensus_keep_gaps

                        If there are gaps in the consensus (if majority_nongap

                        is used as consensus_type), should these be included

                        in the consensus (True) or should this position in the

                        consensus be deleted (False). Default: False

  --consensus_name CONSENSUS_NAME

                        Name to use for the consensus sequence in the output

                        fasta file. Default: consensus

  --plot_input          Plot a mini alignment - an image representing the

                        input alignment. Default: False

  --plot_output         Plot a mini alignment, an image representing the

                        output alignment. Default: False

  --plot_markup         Draws the input alignment but with the columns and

                        rows which have been removed by each function marked

                        up in corresponding colours. Default: False

  --plot_dpi PLOT_DPI   DPI for mini alignments. Default: 300

  --plot_format PLOT_FORMAT

                        Image format for mini alignments - can be png, svg,

                        tiff or jpg. Default: png

  --plot_width PLOT_WIDTH

                        Mini alignment width in inches. Default: 5

  --plot_height PLOT_HEIGHT

                        Mini alignment height in inches. Default: 3

  --make_sequence_logo  Draw a sequence logo. Default: False

  --sequence_logo_type SEQUENCE_LOGO_TYPE

                        Type of sequence logo - bar/text/both. Default: bar

  --sequence_logo_dpi SEQUENCE_LOGO_DPI

                        DPI for sequence logo image. Default: 300

  --sequence_logo_font SEQUENCE_LOGO_FONT

                        Font for text sequence logo. Default: monospace

  --sequence_logo_nt_per_row SEQUENCE_LOGO_NT_PER_ROW

                        Number of bases / amino acids to show per row in the

                        sequence logo, where the logo is too large to show on

                        a single line. Default: 50

  --sequence_logo_filetype SEQUENCE_LOGO_FILETYPE

                        Image file type to use for the sequence logo - can be

                        png, svg, tiff or jpg. Default: png

  --list_fonts_only     Make a swatch showing available fonts. Default: False

  --plot_coverage_input

                        Plot the coverage of the input MSA. Default: False

  --plot_coverage_output

                        Plot the coverage of the output MSA. Default: False

  --plot_coverage_dpi PLOT_COVERAGE_DPI

                        DPI for coverage plot. Default: 300

  --plot_coverage_height PLOT_COVERAGE_HEIGHT

                        Height for coverage plot (inches). Default: 3

  --plot_coverage_width PLOT_COVERAGE_WIDTH

                        Width for coverage plot (inches). Default: 5

  --plot_coverage_colour PLOT_COVERAGE_COLOUR

                        Colour for coverage plot (hex code or name). Default:

                        #007bf5

  --plot_coverage_filetype PLOT_COVERAGE_FILETYPE

                        File type for coverage plot (png, svg, tiff, jpg).

                        Default: png

  --make_similarity_matrix_input

                        Make a similarity matrix for the input alignment.

                        Default: False

  --make_similarity_matrix_output

                        Make a similarity matrix for the output alignment.

                        Default: False

  --make_simmatrix_dp MAKE_SIMMATRIX_DP

                        Number of decimal places to display in the similarity

                        matrix output file. Default: 4

  --make_simmatrix_minoverlap MAKE_SIMMATRIX_MINOVERLAP

                        Minimum overlap between two sequences to have non-zero

                        similarity in the similarity matrix. Default: 1

  --make_simmatrix_keepgaps MAKE_SIMMATRIX_KEEPGAPS

                        Include positions with gaps in either or both

                        sequences in the similarity matrix calculation. Can be

                        0 - exclude positions which are gaps in either or both

                        sequences, 1 - exclude positions which are gaps in

                        both sequences, 2 - consider all positions regardless

                        of gaps. Default: 0

  --unalign_input       Generate a copy of the input alignment with no gaps.

                        Default: False

  --unalign_output      Generate a copy of the cleaned alignment with no gaps.

                        Default: False

  --replace_input       Replaces all Us by Ts in input alignment. Default:

                        False

  --replace_output      Replaces all Us by Ts in output alignment. Default:

                        False

  -h, --help            Show all available parameters with an explanation.

  -v, --version         Show the current version.

 

 

実行方法

デフォルト設定で実行するには入力配列のmulti-fastaと出力prefixを指定する。

CIAlign --infile  seq.fasta --outfile_stem outpreifx

出力はクリーニングされたFASTAとlogファイル、除去された部位のテキストファイルになる。

logファイルSTEM_log.txt

f:id:kazumaxneo:20201008020737p:plain

 

全機能の実行は--allをつける。

CIAlign --infile seq.fasta --outfile_stem outpreifx --all

$ CIAlign --infile rRNA.aln --outfile_stem out --all

Removing divergent sequences

Removing gap only columns

Removing insertions

Removing gap only columns

Cropping ends

Removing gap only columns

Removing short sequences

Removing gap only columns

Building similarity matrix for input alignment

 

出力

f:id:kazumaxneo:20201008022235p:plain

coverage.png

f:id:kazumaxneo:20201008022049p:plain

outpreifx_markup_legend.png

f:id:kazumaxneo:20201008201114p:plain

outpreifx_markup.pngf:id:kazumaxneo:20201008201134p:plain

outpreifx_logo_bar.png

f:id:kazumaxneo:20201008201041p:plain

引用

CIAlign - A highly customisable command line tool to clean, interpret and visualise multiple sequence alignments

Charlotte Tumescheit, Andrew E. Firth, Katherine Brow

bioRxiv, Posted September 16, 2020

 

2022/03/15

CIAlign: A highly customisable command line tool to clean, interpret and visualise multiple sequence alignments

Charlotte Tumescheit, Andrew E. Firth, Katherine Brown​

10.7717/peerj.12983

 

関連