Assembly DereplicatorはRyan R. Wickさんが公開、メンテナンスしているゲノムアセンブリのdereplicationを行うスクリプト。十分に近いアセンブリを除いてアセンブリがよりユニークになるようにする。。dereplicator.pyはスタンドアローンのスクリプトで、標準ライブラリのみを使用する。Pythonパッケージには依存していない。外部依存関係にあるにはMashで、Mashのパスが通っている必要がある。
Githubより
このスクリプトは、まず、Mash を使用して、アセンブリ間のすべての対数の距離を取得する。次に、アセンブリを頂点とし、距離のしきい値以下の 2 つのアセンブリがエッジで接続されたグラフを構築する。グラフの各連結要素はクラスターであり、そのクラスター内でN50が最大のアセンブリが代表として選択される(つまり、ドラフトアセンブリよりも完全なアセンブリが優先される)。このグラフベースのアプローチは、シングルリンケージクラスタリングと同等である。
Mash は非常に効率的だが、多数のアセンブリ (例: 1 万以上) がある場合は、すべてとすべての比較が面倒になる。そこで、このスクリプトでは、ランダムに選択された小さなバッチ(デフォルトでは一度に500個だが、--batch_sizeで設定可能)でクラスタリングを行う。この作業を繰り返し行うが、ある反復回に達するとアセンブリ削除に失敗することがある。これが起こると、スクリプトはほとんどのレプリケーションが消去されたと判断し、残りのすべてのアセンブリに対して最終的なデレプリケーションラウンドを行う。
このバッチベースのデレプリケーションを追加したのは、主に大規模なデータセットのRAM使用量を削減するためで、特にアセンブリコレクションに多くの冗長性がある場合に有効である。しかし、これはシングルリンケージクラスタリングの一般的な批判である「 long thin clusters」にも少し役立つ。サブセットを一度にクラスタリングすることで、大きなクラスタがバラバラになる可能性が高くなる。これは、バッチサイズを変更すると、dereplicateされたアセンブリの数が変わる可能性があることを意味している。
インストール
依存
- Python 3.5 or later
- Mash
#依存
mamba install -c bioconda mash -y
git clone https://github.com/rrwick/Assembly-dereplicator
cd Assembly-dereplicator/
> dereplicator.py -h
usage: dereplicator.py [--threshold THRESHOLD] [--sketch_size SKETCH_SIZE] [--batch_size BATCH_SIZE] [--threads THREADS] [--verbose] [-h] [--version] in_dir out_dir
Assembly dereplicator
Positional arguments:
in_dir Directory containing all assemblies
out_dir Directory where dereplicated assemblies will be copied
Settings:
--threshold THRESHOLD Mash distance clustering threshold (default: 0.005)
--sketch_size SKETCH_SIZE Mash assembly sketch size (default: 10000)
--batch_size BATCH_SIZE Dereplication iterations will occur on random batches of this many assemblies (default: 500)
--threads THREADS Number of CPU threads for Mash (default: 12)
--verbose Display more clustering information (default: False)
Other:
-h, --help Show this help message and exit
--version Show program's version number and exit
実行方法
dereplicator.py --threshold 0.01 assembly_dir output_dir
- --threshold Mash distance clustering threshold (default: 0.005)
引用
https://github.com/rrwick/Assembly-Dereplicator/tree/v0.1.0#license
関連
参考