macでインフォマティクス

macでインフォマティクス

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

包括的なメタゲノム解析パイプライン ATLAS

2019 10/26関連ツール追加、10/26 インストール手順修正、10/29 同上、10/29 コメント追加

2020 6/28 論文とツイート追記、実行手順は確認中、2/7, 4/27, 4/29 インストール手順とラン手順追記

2021 5/1  dockerインストール追記、5/12 バグ修正手順追記(非公式です)

2022/04/17 v2.9.1 インストール

2022/06/25  インストール追記

 

 

 メタゲノミクスおよびメタトランスクリプトミクス研究は、多様な環境からの微生物集団の組成および機能に関する貴重な洞察を提供するが、培養株の遺伝子カタログまたはゲノムデータベースへのリードマッピングに依存するデータ処理パイプラインは、未培養微生物の遺伝子および機能的可能性を過小評価した結果をもたらす。シークエンスアセンブリ法の最近の改善により、ゲノムデータベースへの依存が緩和され、それにより未培養微生物からのゲノムの回収が可能になった。ただし、これらのツールを構成し、それらを高度なビニングおよびアノテーションツールとリンクし、処理の出所を維持することは、研究者にとって引き続き困難である。
 ここでは、最新のツールを使用して、メタゲノムシークエンスとメタトランスクリプトームのデータの生のシークエンスリードアセンブリし、アノテーション付け、定量し、ビニングし、機能的および分類学アノテーション付けまで行うカスタマイズ可能なデータ処理のためのソフトウェアパッケージであるATLASを紹介する。データセットの各サンプルについて、ゲノム中心の解像度と存在量の推定値が提供される。 ATLASはPythonで記述され、ワー​​クフローはSnakemakeで実装されている。 Linux環境で動作し、Python 3.5以降およびAnaconda 3以降のバージョンと互換性がある。 ATLASのソースコードは無料で入手でき、BSD-3ライセンスの下で配布されている。(一部略)condaを使用して簡単にインストールでき、GitHubオープンソースとしてhttps://github.com/metagenome-atlas/atlasで管理されている。

 

 

 

 

Documents

https://metagenome-atlas.readthedocs.io/en/latest/usage/getting_started.html

 

 

インストール

mambaを使って導入した。しばらく経ってから入れなおすと、ラン開始後のsnakemakeの環境作りのステップでconda環境作成があるが、この段階で止まってしまった。オーサー提供のdockerイメージを使うようにした。

v2.9からpython3.10に対応したので(リリース)、python3.10の環境を作るようにした。

依存

  • Atlas should be run on linux

ハードウェア

データベースビルド時、CATが100GB以上のメモリを要求する。これを満たしてる必要がある。また、ランには最低250GBほどメモリが必要。

本体 GIthub

追記

 *1 biocondaから依存含めて導入されると勘違いしていた。recipeを見ると入ってない。つまり、使うツールは自分で入れてパスを通しておく事になる。

#1 2021 2/5 Mambaを使う, 依存の関係でpython3.6を指定
mamba create -y -n atlasenv python=3.6
conda activate atlasenv
mamba install -y -c bioconda -c conda-forge metagenome-atlas -y

# 2022/04/17 v2.9.1 (mambaが古いとコマンドが動かないので最新版にアップデートしておく)。python3.10の環境を作る。
mamba create -y -n atlasenv python=3.10
conda activate atlasenv
mamba install -y -c bioconda -c conda-forge metagenome-atlas==2.9.1 -y


#old 仮想環境を作り導入
conda create -n atlasenv python=3.6 -y
conda activate atlasenv
#本体導入 bioconda (link)
conda install -c bioconda -c conda-forge -y metagenome-atlas

#依存の導入、使わないツールは入れる必要なし
conda install -c bioconda -c conda-forge -y cat #diamondとprodigalも入る
conda install -c bioconda -y metabat2 maxbin2
conda install -c bioconda -y metaspades megahit
conda install -c bioconda -y mmseqs2
conda install -c bioconda -y das_tool
conda install -c bioconda -y drep


#2 docker image (link) (manual) テストランでも250GBほどメモリが必要。足りないと途中でkillされる(250GBでも足りないかも) 。lastetタグのバージョンは2.3となっている。
docker pull metagenomeatlas/atlas
#help
sudo docker run -it --rm metagenomeatlas/atlas atlas -h
mkdir -p AtlasDB/GTDB-TK AtlasDB/EggNOGV2

#test data
wget https://zenodo.org/record/3992790/files/test_reads.tar.gz
tar -xzf test_reads.tar.gz

#run
docker run -i -u $(id -u):$(id -g) -v $(pwd):/WD -v $(pwd)/AtlasDB/EggNOGV2/:/databases/EggNOGV2 -v $(pwd)/AtlasDB/GTDB-TK/:/databases/GTDB-TK -t metagenomeatlas/atlas:latest /bin/bash

atlas init -d /databases /WD/test_reads
atlas run all

#バージョンチェック

> atlas --version

f:id:kazumaxneo:20220417201438p:plain

atlas

$ atlas

Usage: atlas [OPTIONS] COMMAND [ARGS]...

 

  ATLAS - workflows for assembly, annotation, and genomic binning of

  metagenomic and metatranscriptomic data.

 

  For updates and reporting issues, see: https://github.com/metagenome-

  atlas/atlas

 

Options:

  --version   Show the version and exit.

  -h, --help  Show this message and exit.

 

Commands:

  download  download reference files (need ~50GB)

  init      prepare configuration file and sample table for atlas run

  run       run atlas main workflow

atlas init -h 

$ atlas init -h

Usage: atlas init [OPTIONS] PATH_TO_FASTQ

 

  Write the file CONFIG and complete the sample names and paths for all

  FASTQ files in PATH.

 

  PATH is traversed recursively and adds any file with '.fastq' or '.fq' in

  the file name with the file name minus extension as the sample ID.

 

Options:

  -d, --db-dir PATH               location to store databases (need ~50GB)

                                  [default: /Users/kazu/Desktop/databases]

  -w, --working-dir PATH          location to run atlas

  --assembler [megahit|spades]    assembler  [default: spades]

  --data-type [metagenome|metatranscriptome]

                                  sample data type  [default: metagenome]

  --threads INTEGER               number of threads to use per multi-threaded

                                  job

  --skip-qc                       Skip QC, if reads are already pre-processed

  -h, --help                      Show this message and exit.

atlas run -h

$ atlas run -h

Usage: atlas run [OPTIONS]

                 qc|assembly|binning|genomes|genecatalog|None|all

                 [SNAKEMAKE_ARGS]...

 

  Runs the ATLAS pipline

 

  By default all steps are executed but a sub-workflow can be specified.

  Needs a config-file and expects to find a sample table in the working-

  directory. Both can be generated with 'atlas init'

 

  Most snakemake arguments can be appended to the command for more info see

  'snakemake --help'

 

  For more details, see: https://metagenome-atlas.readthedocs.io

 

Options:

  -w, --working-dir PATH  location to run atlas.

  -c, --config-file PATH  config-file generated with 'atlas init'

  -j, --jobs INTEGER      use at most this many jobs in parallel (see cluster

                          submission for mor details).  [default: 12]

  --no-conda              do not use conda environments. good luck!  [default:

                          False]

  -n, --dryrun            Test execution.  [default: False]

  -h, --help              Show this message and exit.

> atlas download -h

$ atlas download -h

Usage: atlas download [OPTIONS] [SNAKEMAKE_ARGS]...

 

  Executes a snakemake workflow to download reference database files and

  validate based on their MD5 checksum.

 

Options:

  -d, --db-dir PATH   location to store databases  [required]

  -j, --jobs INTEGER  number of simultaneous downloads  [default: 1]

  -h, --help          Show this message and exit.

 

 

 

実行方法

準備したデータベースと解析するfastqを指定する(*2)。

wget https://zenodo.org/record/3992790/files/test_reads.tar.gz
tar -xzf test_reads.tar.gz
atlas init --db-dir databases test_reads

#docker
docker run -itv $PWD:/data -w /data --rm metagenomeatlas/atlas atlas init --db-dir databases test_reads

config.yamlとsamples.tsv が出力される。 

f:id:kazumaxneo:20210207203427p:plain

config.yaml先頭部分

f:id:kazumaxneo:20210207204039p:plain

変更したいパラメータがあればラン前に編集しておく。

 

準備ができたらコンピューティングリソース使用量を記載してランする。カレントのyaml とtsvが認識され、ランが開始される。

atlas run all --resources mem=245 --jobs 16

はじめにデータベースのダウンロードが行われ、それからランが実行される。2回目以降はatlas initでデータベースのパスを記載しておく。

 

ランにはかなりの時間がかかる。

出力

f:id:kazumaxneo:20210208115300p:plain

 

sample1

f:id:kazumaxneo:20210208120627p:plain

sample2

f:id:kazumaxneo:20210208120643p:plain

 

sample1/binning

f:id:kazumaxneo:20210208120714p:plaingenomes/

f:id:kazumaxneo:20210208115952p:plain

 

genomes/dererplication

f:id:kazumaxneo:20210208120229p:plain

genomes/dererplication/figures/

f:id:kazumaxneo:20210208120251p:plain

genomes/dererplication/dereplicated_genomes/

f:id:kazumaxneo:20210208120321p:plain

genomes/annotations

f:id:kazumaxneo:20210208120133p:plain

 

genomes/annotations/genes

f:id:kazumaxneo:20210208120153p:plain

genomes/taxonomy/gtdb/

f:id:kazumaxneo:20210208115849p:plain

genomes/tree

f:id:kazumaxneo:20210208120016p:plain

report/

f:id:kazumaxneo:20210208115324p:plain

f:id:kazumaxneo:20210208115515p:plain

f:id:kazumaxneo:20210208115705p:plain 

f:id:kazumaxneo:20210208115723p:plain

 

実際のサンプルを解析する際は、ペアエンドと個々のサンプルを期別できるfastqにする。たとえばテストサンプルではsample1がsample1_R1.fq.gzsample1_R2.fq.gz、sample2がsample2_R1.fq.gzsample2_R2.fq.gzになっている。

 

結果の分析

git clone https://github.com/metagenome-atlas/atlas_analyze.git
cd atlas_analyze
conda activate analyze
analyze.py path/to/atlas_workingdir

 

 

2021/11/2

v2.8がリリースされています。VambとSemiBinを統合しています。また、ゲノムの機能的アノテーションKEGGパスウェイの各モジュールを生成するようになっています。atlas run gene catalogコマンドでは、異なる遺伝子のアバンダンスを直接生成するようになっています。

2022/04/05

v2.9がリリースされています。NCBI SRAのパブリックデータからアトラスプロジェクトを作成できるatlas init-publicコマンドが新たに追加されたとの事です。inStrainを用いた株レベルの解析もサポートされています。


引用 

ATLAS (Automatic Tool for Local Assembly Structures) - a comprehensive infrastructure for assembly, annotation, and genomic binning of metagenomic and metatranscriptomic data

Richard Allen White III​, Joseph Brown, Sean Colby, Christopher C Overall, Joon-Yong Lee, Jeremy Zucker, Kurt R Glaesemann, Christer Jansson, Janet K Jansson​

PeerJ Preprints 5:e2843v1 March 2, 2017

 

2020 6/27 

ATLAS: a Snakemake workflow for assembly, annotation, and genomic binning of metagenome sequence data

Silas Kieser, Joseph Brown, Evgeny M. Zdobnov, Mirko Trajkovski, Lee Ann McCue
BMC Bioinformatics volume 21, Article number: 257 (2020)

 

 関連


 

 

 

 

 過去に試して苦戦した時

このように順番に進捗が報告されていく。
CATが使うnrデータベースが一番重い。他が早く終わってもこのデータベースのダウンロードとビルドに時間がかかる(memory100GB以上必要)。

f:id:kazumaxneo:20191027200118p:plain

 

数回試したが、CATのデータベースビルドでエラーになる。最終的にCATだけ手動でダウンロードし、databases/CAT/のファイルと入れ替える事でダウンロードすることができた。すなわち、

#CATのデータベースダウンロードと解凍、ここでは20190712リリースを使う。
wget tbb.bio.uu.nl/bastiaan/CAT_prepare/CAT_prepare_20190719.tar.gz
tar -xvzf CAT_prepare_20190719.tar.gz
mv CAT_prepare_20190719/2019-07-19_CAT_database/* databases/CAT/
mv CAT_prepare_20190719/2019-07-19_taxonomy/* databases/CAT/

再実行

atlas download -d databases -j 4

f:id:kazumaxneo:20191029125541p:plain

一瞬で終わった。atlas database successfully~が出ているので 一度先に進んでみる。

 

 

GTDBのデータベース更新でエラーになる。

download-db.shの6行目の

wget https://data.ace.uq.edu.au/

のところで問題が起きている。公式dockerイメージ(Atlas v2.3)を使っているなら

mkdir -p AtlasDB/GTDB-TK AtlasDB/EggNOGV2

#test data
wget https://zenodo.org/record/3992790/files/test_reads.tar.gz
tar -xzf test_reads.tar.gz

#download GTDB DB manually (release89)
wget https://data.ace.uq.edu.au/public/gtdb/data/releases/release89/89.0/gtdbtk_r89_data.tar.gz
tar -zxzf gtdbtk_r89_data.tar.gz
=> release89/ created

#run
docker run -i -u $(id -u):$(id -g) -v $(pwd):/WD -v $(pwd)/AtlasDB/EggNOGV2/:/databases/EggNOGV2 -v $(pwd)/AtlasDB/GTDB-TK/release89/:/databases/GTDB-TK -t metagenomeatlas/atlas:latest /bin/bash

atlas init -d /databases /WD/test_reads
atlas run all

これでランできるはず。DTDBはrelease202もダウンロードできるが、202はGTDB-tkのバージョンを1.5に上げないと使えない。そのため、202をデータベースにしたいならdocker内で

conda install -y -c bioconda -c conda-forge metagenome-atlas -y

してATLASを2.5にアップデートしておく。GTDB-tkもv1.5になるはず(docker imageはATLAS2.3が最新で、ATLAS v2.5はpushされていない)。

 

また、メモリを256GB利用できるマシンではテストデータでもエラーになった。configのメモリを減らせばランできるかもしれないが未検討。メモリ512GBのマシンでは、このdocker設定にて、テストデータを上手くランすることができた。メモリが十分あってもランできないときは、atlas init で作成されるconfigファイルのメモリ設定を見直す(最大値を倍くらいにしておく。同時にCPU利用数も増やしておけば、並列ジョブ数が減るようになり、結果的に全体のメモリ使用量は減る)。