macでインフォマティクス

macでインフォマティクス

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

GPUによる高速相同性検索に対応した MMseqs2

 

 急速に増加するタンパク質配列データベースの進化情報を検索するには、常に高速化が必要である。これは、配列のフィルタリングやギャップアラインメントを実行する革新的なアルゴリズムによって達成される。ここでは、8GPUで最大100TCUPSを達成するギャップレスフィルタリングと、タンパク質プロファイルを使用したギャップドアラインメントのためのGPU最適化アルゴリズムを紹介する。MMseqs2-GPUに実装されたこれらのアルゴリズムは、NVIDIA L40S GPU上で、128コアCPU上のMMseqs2 k-merと比較して、20倍高速で71倍安価な検索を実現している。ColabFoldでは、AlphaFold2と一致する精度で構造予測を23倍高速化。MMseqs2-GPUは、mmseqs.comのCUDAデバイスで利用可能なオープンソースソフトウェアである。

 

 

wiki

https://github.com/soedinglab/MMseqs2/wiki#compile-from-source-for-linux-with-gpu-support

 

インストール

リリースから配布されている静的バイナリを使用した(テストしたマシンのCUDAバージョン:  NVIDIA-SMI 560.35.03、GPU: RTX3090)。

ハードウェア

  • requires an NVIDIA GPU of the Ampere generation or newer for full speed, however, also works at reduced speed for Tesla-generation GPUs. 

Github

# MMseqs2-GPU mostly-static AVX2 build requiring glibc >= 2.29 and nvidia driver >=525.60.13 (see below)
wget https://mmseqs.com/latest/mmseqs-linux-gpu.tar.gz; tar xvfz mmseqs-linux-gpu.tar.gz; export PATH=$(pwd)/mmseqs/bin/:$PATH

> mmseqs

MMseqs2 (Many against Many sequence searching) is an open-source software suite for very fast, 

parallelized protein sequence searches and clustering of huge protein sequence data sets.

 

Please cite: M. Steinegger and J. Soding. MMseqs2 enables sensitive protein sequence searching for the analysis of massive data sets. Nature Biotechnology, doi:10.1038/nbt.3988 (2017).

 

MMseqs2 Version: ddf2e85f8835ea3f697ab3de665cea139b2f9990

© Martin Steinegger (martin.steinegger@snu.ac.kr)

 

usage: mmseqs <command> [<args>]

 

Easy workflows for plain text input/output

  easy-search           Sensitive homology search

  easy-cluster          Slower, sensitive clustering

  easy-linclust         Fast linear time cluster, less sensitive clustering

  easy-taxonomy         Taxonomic classification

  easy-rbh              Find reciprocal best hit

 

Main workflows for database input/output

  search                Sensitive homology search

  map                   Map nearly identical sequences

  rbh                   Reciprocal best hit search

  linclust              Fast, less sensitive clustering

  cluster               Slower, sensitive clustering

  clusterupdate         Update previous clustering with new sequences

  taxonomy              Taxonomic classification

 

Input database creation

  databases             List and download databases

  createdb              Convert FASTA/Q file(s) to a sequence DB

  createindex           Store precomputed index on disk to reduce search overhead

  convertmsa            Convert Stockholm/PFAM MSA file to a MSA DB

  msa2profile           Convert a MSA DB to a profile DB

 

Format conversion for downstream processing

  convertalis           Convert alignment DB to BLAST-tab, SAM or custom format

  createtsv             Convert result DB to tab-separated flat file

  convert2fasta         Convert sequence DB to FASTA format

  taxonomyreport        Create a taxonomy report in Kraken or Krona format

 

An extended list of all modules can be obtained by calling 'mmseqs -h'.

 

Bash completion for modules and parameters can be installed by adding "source MMSEQS_HOME/util/bash-completion.sh" to your "$HOME/.bash_profile".

Include the location of the MMseqs2 binary in your "$PATH" environment variable.

> mmseqs makepaddedseqdb -h

usage: mmseqs makepaddedseqdb <i:sequenceDB> <o:sequenceDB> [options]

 By Milot Mirdita <milot@mirdita.de> & Martin Steinegger <martin.steinegger@snu.ac.kr>

options: prefilter:             

 --mask INT              Mask sequences in prefilter stage with tantan: 0: w/o low complexity masking, 1: with low complexity masking [1]

 --mask-prob FLOAT       Mask sequences is probablity is above threshold [0.900]

 --mask-lower-case INT   Lowercase letters will be excluded from k-mer search 0: include region, 1: exclude region [0]

 --mask-n-repeat INT     Repeat letters that occure > threshold in a rwo [0]

align:                 

 --score-bias FLOAT      Score bias when computing SW alignment (in bits) [0.000]

common:                

 --sub-mat TWIN          Substitution matrix file [aa:blosum62.out,nucl:nucleotide.out]

 --threads INT           Number of CPU-cores used (all by default) [128]

 -v INT                  Verbosity level: 0: quiet, 1: +errors, 2: +warnings, 3: +info [3]

expert:                

 --write-lookup INT      write .lookup file containing mapping from internal id, fasta id and file number [1]

 

examples:

 Generate a padded sequence DB

 

references:

 - Kallenborn F, Chacon A, Hundt C, Sirelkhatim H, Didi K, Dallago C, Mirdita M, Schmidt B, Steinegger M: GPU-accelerated homology search with MMseqs2. bioRxiv, 2024.11.13.623350 (2024)

 

実行方法

GPUを利用するには、makepaddedseqdbモジュールでターゲットデータベースをGPU用にフォーマットし、searchまたはeasy-searchに--gpu 1パラメータを渡す必要がある。

1,まずクエリとDBのmmseq形式ファイルを作成

cd MMseqs2/examples/

#クエリのアミノ酸配列DBファイル作成
mmseqs createdb QUERY.fasta queryDB

#ターゲットデータベースのアミノ酸配列DBファイル作成
mmseqs createdb DB.fasta targetDB

 

2,mmseqs makepaddedseqdbコマンドでターゲットDBのデータベースをGPU用にフォーマットする

mmseqs makepaddedseqdb targetDB targetDB_gpu


targetDB_gpuのファイル群ができる

 

3,クエリとデータベースのファイルを指定してホモロジーサーチを実行する。tmpは作業ディレクトリ。巨大なデータベースを使う場合、十分な容量とI/Oの高速なストレージの利用が推奨されている(詳細はユーザーガイド参照)。

mmseqs search queryDB targetDB resultDB tmp

 

eash-searchの場合、”--gpu”を指定。ワンコマンドで実行できるがデータベース作成には時間がかかる(:CPU版と比べて余分なデータベース変換プロセスがあるため、小さなデータセットだとCPU版よりトータルの時間は長くなることがある、しかし中間ファイルができないのは便利)。

mmseqs easy-search query.faa database.faa.gz result /tmp --gpu 1

 

テスト

以下のファイルを使ってテストする。細菌ゲノム600個のproteomeを集めてgzip圧縮したものがDB、クエリは関心のある500アミノ酸程度の配列を99個集めたもの。ファイルサイズがこちら

順番に実行していく。

1、データベースのアミノ酸配列DB作成

mmseqs createdb DB.fasta targetDB

出力例

2,続いてクエリのアミノ酸配列DB作成

mmseqs createdb QUERY.fasta queryDB

出力例

3,makepaddedseqdbでターゲットデータベースをGPU用にフォーマット

mmseqs makepaddedseqdb targetDB targetDB_gpu

出力例

4,mmseqs searchの実行

mmseqs search queryDB targetDB_gpu resultDB tmp --gpu 1

nvtopでモニタしたが、GPU使用率は一瞬だけ100%となった。配列空間がテストするには小さすぎたと思われる。

相同性検索は、

real読みで0.3秒で終了した (RTX3090使用)。

 

CPU版も試す(5995WX)。

mmseqs search queryDB targetDB resultDB_CPU tmp

real読みで9秒、GPUの方が30倍ほど短い時間で終了した。

 

5、結果をblast様のタブ仕分けファイルに変換

mmseqs convertalis queryDB targetDB resultDB output.txt --format-mode 0
#CPU
mmseqs convertalis queryDB targetDB resultDB_CPU output_CPU.txt --format-mode 0
  • --format-mode 0   output format 0: BLAST-TAB, 1: PAIRWISE, 2: BLAST-TAB + query/db length 

 

出力

行数が同じかだけ確認

> wc output*

当然完全には一致しないが、行数には変化なし

 

その他

  • GPU版を使うにはsearchモジュールまたはeasy-searchモジュールに--gpu 1パラメータを渡す必要がある。
  • exampleディレクトリにテスト用のクエリとデータベースファイルが準備されている。

引用

GPU-accelerated homology search with MMseqs2

Felix Kallenborn,  Alejandro Chacon, Christian Hundt, Hassan Sirelkhatim,  Kieran Didi,  Christian Dallago,  Milot Mirdita, Bertil Schmidt,  Martin Steinegger

bioRxiv, Posted November 15, 2024.

 

関連

 

ベンチマーク補足

テストと同じデータと同じハードウェア構成でdiamond blastpも試した。感度を上げる--very-sensitive設定付きだとreal読みで6.1秒だった。