macでインフォマティクス

macでインフォマティクス

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

アラインメント操作と要約統計量の計算のための高速なツールキット AMAS

 

 近年、系統学で用いられるデータ量は爆発的に増加しており、数百から数千の遺伝子座と多数の分類群から多くの系統が推定されている。このような最新の系統学研究では、遺伝子のサブセットや連結配列の多重解析に加え、各遺伝子座の個別解析が必要となることが多い。何千もの単一遺伝子座や大規模な連結配列を扱い、その特性を計算するための計算効率の良いツールが必要とされている。ここでは、AMAS (Alignment Manipulation And Summary)を紹介する。このツールは、スタンドアローンコマンドラインユーティリティとしても、Pythonパッケージとしても使用できる。AMASはアミノ酸ヌクレオチドのアラインメントに対応し、配列操作の機能と基本的な統計量を計算する機能を兼ね備えている。操作機能としては、一般的なフォーマット間の変換、連結、部位の抽出、あらかじめ定義された分割スキームに従った分割、複製データセットの作成、分類子の除去がある。算出される統計情報は、分類数、アライメント長、マトリックスセルの総数、未確定文字の総数、欠損データの割合、ATおよびGCコンテンツ(DNAアライメントの場合)、可変サイトの数と割合、parsimony情報サイトの数と割合、塩基またはアミノ酸アルファベットに関する全文字数などである。AMASは、数百の分類群および数千の遺伝子座を含む非常に大規模なアライメントに特に適している。計算効率が高く、並列処理を利用し、他の一般的なツールよりも連結のパフォーマンスが優れている。AMASはPython 3プログラムであり、Pythonのコアモジュールにのみ依存し、追加の依存関係は必要ない。AMASのソースコードとマニュアルは、GNU General Public Licenseのもと、http://github.com/marekborowiec/AMAS/ からダウンロードすることができる。

 

インストール

Github

#conda(link)
mamba install -c bioconda amas -y

#pip(pypi)
pip install amas

> AMAS.py -h

usage: AMAS <command> [<args>]

 

The AMAS commands are:

  concat      Concatenate input alignments

  convert     Convert to other file format

  replicate   Create replicate data sets for phylogenetic jackknife

  split       Split alignment according to a partitions file

  summary     Write alignment summary

  remove      Remove taxa from alignment

  translate   Translate DNA alignment into protein alignment

  trim        Remove columns from alignment

 

Use AMAS <command> -h for help with arguments of the command of interest

 

positional arguments:

  command     Subcommand to run

 

optional arguments:

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

 

 

実行方法

concat - アラインメントの連結

ディレクトリにあるすべてのDNA phylipファイルを連結する。ファイルの拡張子はphyとする。入力フォーマットは-fで指定する。

AMAS.py concat -f phylip -d dna -i *phy -c 1
  • -p    File name for the concatenated alignment partitions. Default: 'partitions.txt'
  • -t     File name for the concatenated alignment. Default: 'concatenated.out'
  • -y {nexus, raxml, unspecified}   Format of the partitions file. Default: 'unspecified'
  • -c    Number of cores used. Default: 1
  • -i     Alignment files to be taken as input. You can specify multiple files using wildcards (e.g. --in-files *fasta)
  • -f {fasta, phylip, nexus, phylip-int, nexus-int}   The format of input alignment
  • -d {aa, dna}    Type of data

結果は、新しいアライメントが構築されたパーティションを含むpartitions.txtと、アライメントそのものを含むfasta形式のconcatenated.outの2つのファイルに書き込まれる。アラインメントファイルが事前に整列されていない場合も出力されるが、結果に意味は無い点に注意する(-eでチェック可能)。

 

出力をnexus形式にする。出力フォーマットは-uで指定する。

AMAS.py concat -f fasta -d aa -i *fas -u nexus -c 1
  • -u {fasta, phylip, nexus, phylip-int, nexus-int}   File format for the output alignment. Default: fasta

多数のファイルを扱う場合、並列処理(-c)で計算時間を短縮できる。全体のアライメントサマリーに加えて、シーケンス(タクソン)ごとに計算された統計情報を表示することもできる。これをオンにするには、-s または --by-taxon フラグを使用する。このモードのAMASは、各入力アライメントについて、全体のアライメントサマリーとタクソンサマリーのファイルを1つずつ出力する(マニュアルより)。

 

convert - ファイルフォーマットの変換

fasta形式からnexus形式に変換

AMAS.py convert -d dna -f fasta -i *fas -u nexus

<input.name>-out.nexがそれぞれ出力される。

パーティションファイルがある場合、連結されたアライメントを分割し、各パーティションごとにファイルを書き込むことができる。その場合、入力ファイルは1つだけ、パーティションファイルも1つだけ指定する。

 

translate - DNAアライメントをタンパク質配列に変換

NCBIの翻訳表を利用して、ヌクレオチドアライメントをアミノ酸に翻訳する。昆虫のミトコンドリア遺伝子のアライメントで、2番目のコドン位置から始まるものを翻訳する。

AMAS.py translate -f nexus -d dna -i concat.nex -b 5 -k 2 --out-format phylip
  • -b {1,2,3,4,5,6,9,10,11,12,13,14,16,21,22,23,24,25,26}   NCBI genetic code to use: 1. The Standard Code, 2. The Vertebrate Mitochondrial Code, 3. The Yeast Mitochondrial Code, 4. The Mold, Protozoan, and Coelenterate Mitochondrial Code and the Mycoplasma/Spiroplasma Code, 5. The Invertebrate Mitochondrial Code, 6. The Ciliate, Dasycladacean and Hexamita Nuclear Code, 9. The Echinoderm and Flatworm Mitochondrial Code, 10. The Euplotid Nuclear Code, 11. The Bacterial, Archaeal and Plant Plastid Code, 12. The Alternative Yeast Nuclear Code, 13. The Ascidian Mitochondrial Code, 14. The Alternative Flatworm Mitochondrial Code, 16. Chlorophycean Mitochondrial Code, 21. Trematode Mitochondrial Code, 22. Scenedesmus obliquus Mitochondrial Code, 23. Thraustochytrium Mitochondrial Code, 24. Pterobranchia Mitochondrial Code, 25. Candidate Division SR1 and Gracilibacteria Code, 26. Pachysolen tannophilus Nuclear Code. Default: 1.
  • -k {1, 2, 3}  Number specifying reading frame; i.e. '2' means codons start at the second character of the alignment. Default: 1

 

remove - アライメントから指定したtaxaを削除

ディレクトリ内のすべての nexus ファイルについて、species1 と species2 というtaxaを削除する。それには、-xの後に、削除する配列名を指定する。AMASは入力配列名に含まれるスペースをアンダースコアに変換し、引用符を除去してから処理を行うので、削除する名前を適宜修正する必要があることに注意する。引数 -gで出力ファイル名に付加する接頭辞を指定する。

AMAS.py remove -x species1 species2 -d dna -f nexus -i *nex -u nexus-int -g no_species12_
  • -x    Taxon/sequence names to be removed.
  • -g    File name prefix for the concatenated alignment. Default: 'reduced_'

 

summary - 要約統計の表示

AMAS.py summary -f fasta -d aa -i my_aln.fasta my_aln2.fasta
  • -o    File name for the alignment summary. Default: 'summary.txt'
  • -s     In addition to alignment summary, write by sequence/taxon summaries. Default: Don't write

デフォルトではsummary.txtというファイルに書き込まれる。算出される統計情報は、分類数、アライメント長、マトリックスセルの総数、全体の未確定文字数、欠損データの割合、ATおよびGCコンテンツ(DNAアライメントの場合)、可変サイトの数と割合、パーシモンの情報提供サイトの数と割合、関連アルファベットに存在する全ての文字の数など。

 

  • ランダムに選んだアラインメントを連結したアラインメントを作成することができる。例えば系統樹ジャックナイフ解析に使用することができる。例えば、1000 個の phylip ファイルがあり、それぞれに 1 つの遺伝子座がアラインメントされているとして、すべての入力ファイルからランダムに選んだ 100 個の遺伝子座から、それぞれ 200 個の複製したアラインメントを作成するにはreplicateコマンドを使う(レポジトリ参照)。
  • AMASはPythonパイプラインの中でモジュールとしてimportして使用できる(レポジトリ参照)。

 

引用

AMAS: a fast tool for alignment manipulation and computing of summary statistics
Marek L. Borowiec

PeerJ. 2016; 4: e1660