macでインフォマティクス

macでインフォマティクス

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

大規模アラインメントの系統推定を高速化した VeryFastTree

コマンドの誤り修正(very抜け)

 

 FastTree-2は、大規模系統樹を推定するための最も成功したツールの1つである。FastTree-2の設計の核心はスピードであるが、FastTree-2の実装には、その性能とスケーラビリティを害する重要な問題がまだある。これらの限界に対処するために、本著者らはVeryFastTreeを導入する。VeryFastTreeはFastTree-2ツールの高度に調整された実装であり、並列化とベクトル化戦略を利用して性能を向上させる。VeryFastTreeは、超大規模な330kアライメントから倍精度演算を使用して、標準的なサーバー上でツリーをわずか4.5時間で構築することができ、これは逐次および最良の並列FastTree-2の時間よりもそれぞれ7.8倍および3.5倍高速である。

VeryFastTreeはGitHubリポジトリhttps://github.com/citiususc/veryfasttreeで利用できる。

 

論文が出たのは2020年だが、現在もバージョンアップが続いており、2023年7月にはバージョン4.0がリリースされている。

インストール

ビルド依存

  • CMake v3.5+
  • C++11 compiler
  • GCC 5+ (GCC 4 is bugged)
  • Visual studio 2015 (previous versions with support for C++11 may work)
  • Clang (requires minimal support for C++11 and OpenMP)
  • make (Linux only)
  • CUDA Toolkit (CUDA only)

Github

#conda link (2023年9月現在v.4.0.2が最新)
mamba install -c bioconda veryfasttree 

#ビルド
git clone https://github.com/citiususc/veryfasttree.git
cd veryfasttree/
#cmake - cmakeネイティブコンパイルを無効にし、SSE4.1命令を使用する例
cmake -DUSE_NATIVE=OFF -DUSE_SEE4=ON .
#* AVX2やAVX512、CUDAに対応している。

make
make install

> VeryFastTree 

VeryFastTree 4.0.2 (OpenMP, AVX2)

  VeryFastTree protein_alignment > tree

  VeryFastTree < protein_alignment > tree

  VeryFastTree -out tree protein_alignment

  VeryFastTree -nt nucleotide_alignment > tree

  VeryFastTree -nt -gtr < nucleotide_alignment > tree

  VeryFastTree < nucleotide_alignment > tree

  VeryFastTree accepts alignments in NEXUS, Fasta, Fastq or Phylip interleaved formats compressed with ZLib and libBZ2.

 

Usage: VeryFastTree [OPTIONS] [protein_alignment]

 

Common options:

  -n <number>                 to analyze multiple alignments (phylip format only) (use for global bootstrap, with seqboot and CompareToBootstrap.pl)

  -intree newick_file         to set the starting tree(s)

  -intree1 newick_file        to use this starting tree for all the alignments (for faster global bootstrap on huge alignments)

  -quiet                      to suppress reporting information

  -nopr                       to suppress progress indicator

  -log logfile                save intermediate trees, settings, and model details

  -quote                      allow spaces and other restricted characters (but not ' ) in sequence names and quote names in the output tree (fasta/fastq input only; VeryFastTree will not be able to read these trees back in)

  -pseudo                     to use pseudocounts (recommended for highly gapped sequences)

  -noml                       to turn off maximum-likelihood

  -lg                         Le-Gascuel 2008 model (amino acid alignments only)

  -wag                        Whelan-And-Goldman 2001 model (amino acid alignments only)

  -gtr                        generalized time-reversible model (nucleotide alignments only)

  -cat n                      to specify the number of rate categories of sites (default 20) or -nocat to use constant rates

  -gamma                      after optimizing the tree under the CAT approximation, rescale the lengths to optimize the Gamma20 likelihood

  -nome                       to turn off minimum-evolution NNIs and SPRs (recommended if running additional ML NNIs with -intree), -nome -mllen with -intree to optimize branch lengths for a fixed topology

  -nosupport                  to not compute support values

  -fastest Excludes: -slow    speed up the neighbor joining phase & reduce memory usage (recommended for >50,000 sequences)

  -constraints constraintAlignment

                              to constrain the topology search constraintAlignment should have 1s or 0s to indicates splits

  -threads n (Env:OMP_NUM_THREADS)

                              number of threads (n) used in the parallel execution.

  -double-precision           to use double precision arithmetic. Therefore, it is equivalent to compile FastTree-2 with -DUSE_DOUBLE

  -ext name=AUTO              to speed up computations enabling the vector extensions. Available: AUTO(default), NONE, SSE, SSE3 , AVX, AVX2, AVX512 or CUDA

  -expert                     see more options

For more information, see http://www.microbesonline.org/fasttree/, https://github.com/citiususc/veryfasttree or the comments in the source code

 

 

 

実行方法

VeryFastTreeを使用しやすくするため、FastTree2 と同じコマンド・インターフェイスを実装している(引数が FastTree2 とまったく同じ動作をする)。

#タンパク質配列、JTT+CAT model
VeryFastTree alignment_file > tree

#塩基配列、GTR+CAT model
VeryFastTree -gtr -nt alignment.file > tree
  • -lg        Le-Gascuel 2008 model (amino acid alignments only)
  • -wag    Whelan-And-Goldman 2001 model (amino acid alignments only)
  • -gtr     generalized time-reversible model (nucleotide alignments only)

利用可能な命令セットが自動で選択される。

 

ZLibとlibBZ2で圧縮されたNEXUSFasta、FastqまたはPhylipインターリーブフォーマットのアラインメントも受け入れる。

#タンパク質配列
VeryFastTree  protein.msa.fa.gz > tree

 

(レポジトリより)”-threads [n]” 並列実行で使用されるスレッド数(n)を指定する。このオプションが設定されていない場合、対応する値は環境変数 OMP_NUM_THREADS から取得される。( FastTree-2 と同じアプローチ)。n=1 の場合、VeryFastTree は -DOPENMP フラグなしでコンパイルされた FastTree-2 と同じように動作する。”-threads-level”では、並列化の程度をレベル0~4で指定する。

VeryFastTree -threads 20 protein.msa.fa.gz > tree
  • -threads   number of threads (n) used in the parallel execution.
  • -ext name=AUTO    to speed up computations enabling the vector extensions. Available: AUTO(default), NONE, SSE, SSE3 , AVX, AVX2, AVX512 or CUDA

 

  • VeryFastTreeはFasttreeの再実装で、元のソースコードは最適化され並列化されているが、アルゴリズムは同じ(#5)。
  • v.4ではメモリが足りない場合に備え、ディスクを選択可能(#10)。巨大な配列の計算では有用かもしれない(#8)。
  • VeryFastTree論文の補足資料に、FastTree と比較した場合のメモリ消費量の数値が掲載されている(#6)。
  • #枝長がfasttreeと誤差以上に変わるかもという話がある(#7)。大規模計算をする前に、比較的小さな配列セットでfasttree2やfasttreeMPとの比較は一度は行ったほうが良いかもしれない。

引用

Very Fast Tree: speeding up the estimation of phylogenies for large alignments through parallelization and vectorization strategies 
César Piñeiro,  José M Abuín,  Juan C Pichel
Bioinformatics, Volume 36, Issue 17, September 2020, Pages 4658–4659

 

fasttree document

http://www.microbesonline.org/fasttree/

使用方法の説明ほか、配列数を変えながら、樹形精度が維持されるか、RAxMLやPhyMLなどと比較した表もあり。