macでインフォマティクス

macでインフォマティクス

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

パンゲノムグラフから微生物の多様性を調べる PPanGGOLiN

2020 4/10 引用追加、タイトル修正

2021 1/4 追記

2023/5/30追記

2024/02/26 追記

 

 機能研究、進化研究、疫学研究のために比較ゲノムを使用するには、与えられた種での発現の観点から遺伝子ファミリーを分類する方法が必要である。これらの方法は、通常、分割や最適なクラス数を推論するための多変量統計モデルを持たず、またゲノム構成を考慮していない。本研究では、パンゲノムをモデル化するために、ノードが遺伝子ファミリーを、エッジがゲノム近傍を表すグラフ構造を導入した。この手法はPPanGGOLiNと名付けられ、多変量Bernoulli混合モデルとMarkov Random Fieldを組み合わせた期待値最大化アルゴリズムを用いてノードを分割する。このアプローチでは、グラフのトポロジーとパンゲノム中の遺伝子の有無を考慮して、遺伝子ファミリーを永続的、クラウド、1つまたは複数のシェルパーティションに分類する。本研究では、439種の単離されたゲノムと78種のメタゲノムアセンブリゲノムのパンゲノム分割グラフを解析し、本手法が永続的ゲノムの推定に有効であることを示した。興味深いことに、シェルゲノムはゲノムダイナミクスを理解する上で重要な要素であることが示された。PPanGGOLiNが提案するグラフベースのアプローチは、何千もの株のゲノム全体の多様性をコンパクトな構造で表現するのに有用であり、非常に大規模な比較ゲノムのための有効な基礎を提供する。本ソフトウェアは、https://github.com/labgem/PPanGGOLiN から自由に入手可能である。

 PPanGGOLiNは、ゲノムDNA配列または提供されたゲノムアノテーションのセットから原核生物のパンゲノムを作成し、操作するソフトウェアスイートである。数万のゲノムまでスケールアップできるように設計されている。

PPanGGOLiNは、グラフィカルモデルと統計的手法を用いて、永続ゲノム、シェルゲノム、クラウドゲノムの遺伝子ファミリーを分割し、パンゲノムを構築する。また、その際には、遺伝子ファミリーのグラフを作成するために、タンパク質をコードする遺伝子とそのゲノム近傍の情報を統合し、各ノードが遺伝子ファミリー、各エッジが遺伝的連続性の関係である遺伝子ファミリーのグラフを作成する。この分割法は、グラフ上で隣りあった2つの遺伝子ファミリーが同じ分割に属する可能性が高いことを促進する。これにより、微生物の多様性をナビゲートするために、生物学者が地下鉄地図のようにゲノムをレール上に描く永続ノード、シェルノード、クラウドノードで構成された分割パンゲノムグラフ(PPG)が完成する。

 さらに、PPanGGOLiNに含まれるpanRGP法(Bazin et al. 2020)は、各ゲノムについて、パンゲノムグラフのシェルゲノムとクラウドゲノムからなる遺伝子のクラスターであるRegions of Genome Plasticity(RPP)を予測する。その多くは遺伝子水平伝播(HGT)から発生し、ゲノムアイランド(GI)に対応している。次に、異なるゲノムからのRGPは、保存されている側方の永続的な遺伝子に基づいて、挿入のスポットでグループ化される。

 

wiki

https://github.com/labgem/PPanGGOLiN/wiki

 

インストール

ubuntu18.04LTSでテストした。

本体 Github

#bioconda (link)
mamba create -n ppanggolin-env -y
conda activate ppanggolin-env
mamba install -c bioconda ppanggolin -y

ppanggolin -h

$ ppanggolin -h

usage: ppanggolin [-h] [-v]  ...

 

Depicting microbial species diversity via a Partitioned PanGenome Graph Of Linked Neighbors

 

optional arguments:

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

  -v, --version  show program's version number and exit

 

subcommands:

  

    Basic:

      workflow      Easy workflow to run a pangenome analysis in one go

      panrgp        Easy workflow to run a pangenome analysis with genomic islands and spots of insertion detection

    

    Expert:

      annotate      Annotate genomes

      cluster       Cluster proteins in protein families

      graph         Create the pangenome graph

      partition     Partition the pangenome graph

      rarefaction   Compute the rarefaction curve of the pangenome

    

    Output:

      draw          Draw figures representing the pangenome through different aspects

      write         Writes 'flat' files representing the pangenome that can be used with other softwares

      info          Prints information about a given pangenome graph file

    

    Regions of genomic Plasticity:

      align         Aligns a genome or a set of proteins to the pangenome gene families representatives and predict informations from it

      rgp           Predicts Regions of Genomic Plasticity in the genomes of your pangenome

      spot          Predicts spots in your pangenome

 

ppanggolin workflow -h

$ ppanggolin workflow -h

usage: ppanggolin workflow [-h] [--fasta FASTA] [--anno ANNO]

                           [--clusters CLUSTERS] [-o OUTPUT]

                           [--basename BASENAME] [--rarefaction]

                           [-K NB_OF_PARTITIONS] [--defrag] [--tmpdir TMPDIR]

                           [--verbose {0,1,2}] [--log LOG] [-c CPU] [-f]

 

Input arguments:

  The possible input arguments :

 

  --fasta FASTA         A tab-separated file listing the organism names, and

                        the fasta filepath of its genomic sequence(s) (the

                        fastas can be compressed). One line per organism. This

                        option can be used alone. (default: None)

  --anno ANNO           A tab-separated file listing the organism names, and

                        the gff filepath of its annotations (the gffs can be

                        compressed). One line per organism. This option can be

                        used alone IF the fasta sequences are in the gff

                        files, otherwise --fasta needs to be used. (default:

                        None)

  --clusters CLUSTERS   a tab-separated file listing the cluster names, the

                        gene IDs, and optionnally whether they are a fragment

                        or not. (default: None)

 

Optional arguments:

  -o OUTPUT, --output OUTPUT

                        Output directory (default:

                        ppanggolin_output_DATE2020-04-10_HOUR14.53.05_PID8487)

  --basename BASENAME   basename for the output file (default: pangenome)

  --rarefaction         Use to compute the rarefaction curves (WARNING: can be

                        time consumming) (default: False)

  -K NB_OF_PARTITIONS, --nb_of_partitions NB_OF_PARTITIONS

                        Number of partitions to use. Must be at least 3. If

                        under 3, it will be detected automatically. (default:

                        -1)

  --defrag              Realign gene families to associated fragments with

                        their non-fragmented gene family. (default: False)

 

Common arguments:

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

  --tmpdir TMPDIR       directory for storing temporary files (default:

                        /var/folders/v0/rdv6fcx11fz1dy2jjvthmx1r0000gn/T)

  --verbose {0,1,2}     Indicate verbose level (0 for warning and errors only,

                        1 for info, 2 for debug) (default: 1)

  --log LOG             log output file (default: stdout)

  -c CPU, --cpu CPU     Number of available cpus (default: 1)

  -f, --force           Force writing in output directory and in pangenome

                        output file. (default: False)

ppanggolin panrgp -h

$ ppanggolin panrgp -h

usage: ppanggolin panrgp [-h] [--fasta FASTA] [--anno ANNO]

                         [--clusters CLUSTERS] [-o OUTPUT]

                         [--basename BASENAME] [--rarefaction]

                         [-K NB_OF_PARTITIONS] [--interest INTEREST]

                         [--defrag] [--tmpdir TMPDIR] [--verbose {0,1,2}]

                         [--log LOG] [-c CPU] [-f]

 

Input arguments:

  The possible input arguments :

 

  --fasta FASTA         A tab-separated file listing the organism names, and

                        the fasta filepath of its genomic sequence(s) (the

                        fastas can be compressed). One line per organism. This

                        option can be used alone. (default: None)

  --anno ANNO           A tab-separated file listing the organism names, and

                        the gff filepath of its annotations (the gffs can be

                        compressed). One line per organism. This option can be

                        used alone IF the fasta sequences are in the gff

                        files, otherwise --fasta needs to be used. (default:

                        None)

  --clusters CLUSTERS   a tab-separated file listing the cluster names, the

                        gene IDs, and optionnally whether they are a fragment

                        or not. (default: None)

 

Optional arguments:

  -o OUTPUT, --output OUTPUT

                        Output directory (default:

                        ppanggolin_output_DATE2020-04-10_HOUR14.53.35_PID8500)

  --basename BASENAME   basename for the output file (default: pangenome)

  --rarefaction         Use to compute the rarefaction curves (WARNING: can be

                        time consumming) (default: False)

  -K NB_OF_PARTITIONS, --nb_of_partitions NB_OF_PARTITIONS

                        Number of partitions to use. Must be at least 3. If

                        under 3, it will be detected automatically. (default:

                        -1)

  --interest INTEREST   Comma separated list of elements to flag when drawing

                        and writing hotspots (default: )

  --defrag              Realign gene families to associated fragments with

                        their non-fragmented gene family. (default: False)

 

Common arguments:

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

  --tmpdir TMPDIR       directory for storing temporary files (default:

                        /var/folders/v0/rdv6fcx11fz1dy2jjvthmx1r0000gn/T)

  --verbose {0,1,2}     Indicate verbose level (0 for warning and errors only,

                        1 for info, 2 for debug) (default: 1)

  --log LOG             log output file (default: stdout)

  -c CPU, --cpu CPU     Number of available cpus (default: 1)

  -f, --force           Force writing in output directory and in pangenome

                        output file. (default: False)

> ppanggolin write -h

$ ppanggolin write -h

usage: ppanggolin write [-h] -p PANGENOME -o OUTPUT [--soft_core SOFT_CORE]

                        [--dup_margin DUP_MARGIN] [--gexf] [--light_gexf]

                        [--csv] [--Rtab] [--projection] [--stats]

                        [--partitions] [--compress] [--json] [--regions]

                        [--spots] [--families_tsv] [--all_genes]

                        [--all_prot_families] [--all_gene_families]

                        [--tmpdir TMPDIR] [--verbose {0,1,2}] [--log LOG]

                        [-c CPU] [-f]

 

Required arguments:

  One of the following arguments is required :

 

  -p PANGENOME, --pangenome PANGENOME

                        The pangenome .h5 file (default: None)

  -o OUTPUT, --output OUTPUT

                        Output directory where the file(s) will be written

                        (default: None)

 

Optional arguments:

  --soft_core SOFT_CORE

                        Soft core threshold to use (default: 0.95)

  --dup_margin DUP_MARGIN

                        minimum ratio of organisms in which the family must

                        have multiple genes for it to be considered

                        'duplicated' (default: 0.05)

  --gexf                write a gexf file with all the annotations and all the

                        genes of each gene family (default: False)

  --light_gexf          write a gexf file with the gene families and basic

                        informations about them (default: False)

  --csv                 csv file format as used by Roary, among others. The

                        alternative gene ID will be the partition, if there is

                        one (default: False)

  --Rtab                tabular file for the gene binary presence absence

                        matrix (default: False)

  --projection          a csv file for each organism providing informations on

                        the projection of the graph on the organism (default:

                        False)

  --stats               tsv files with some statistics for each organism and

                        for each gene family (default: False)

  --partitions          list of families belonging to each partition, with one

                        file per partitions and one family per line (default:

                        False)

  --compress            Compress the files in .gz (default: False)

  --json                Writes the graph in a json file format (default:

                        False)

  --regions             Write the RGP in a tab format, one file per genome

                        (default: False)

  --spots               Write spot summary and a list of all rgp in each spot

                        (default: False)

  --families_tsv        Write a tsv file providing the association between

                        genes and gene families (default: False)

  --all_genes           Write all nucleotic CDS sequences (default: False)

  --all_prot_families   Write Write representative proteic sequences of all

                        the gene families (default: False)

  --all_gene_families   Write representative nucleic sequences of all the gene

                        families (default: False)

 

Common arguments:

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

  --tmpdir TMPDIR       directory for storing temporary files (default:

                        /var/folders/v0/rdv6fcx11fz1dy2jjvthmx1r0000gn/T)

  --verbose {0,1,2}     Indicate verbose level (0 for warning and errors only,

                        1 for info, 2 for debug) (default: 1)

  --log LOG             log output file (default: stdout)

  -c CPU, --cpu CPU     Number of available cpus (default: 1)

  -f, --force           Force writing in output directory and in pangenome

                        output file. (default: False)

他のコマンドは省略

 

 

テストラン

ランにはゲノムのテキストファイルを指定する必要がある。テキストファイルの最初のカラムにはユニークな生物名、2 番目の列には関連する FASTA ファイルのパスが含まれていること。

organisms.fasta.list

f:id:kazumaxneo:20210104232153p:plain

 

 

テキストファイルを指定して実行。

git clone https://github.com/labgem/PPanGGOLiN.git
cd PPanGGOLiN/testingDataset/
ppanggolin workflow --fasta organisms.fasta.list --cpu 12

#あるいはallコマンドを使う。20スレッド指定
ppanggolin all --fasta list.tsv -c 20 -o outdir --rarefaction
  • -o    Output directory 
  • --basename   basename for the output file (default: pangenome)
  • -c    Number of available cpus (default: 1)

 

PPanGGOLiNでは、遺伝子クラスタリングに不可欠な2つのパラメータ、 --identity (default: 0.8) と--coverage (default: 0.8)を設定できる。デフォルト値は、種レベルでの配列のアラインメントとクラスタリングに経験的に効果的なパラメータとして選択されている。workflowにはこのオプションはないので、指定したいなら annotateコマンドとclusterコマンドを個別に実行していく。

 

出力

興味のある分類群のパンゲノムを様々な方法で記述したファイルや図が得られる

f:id:kazumaxneo:20200404112413p:plain

PPanGGOLiNはMMseqs2を呼び出して、MMseqs2のgreedy set cover algorithmを使用して、すべての遺伝子配列に対してクラスタリングを実行する(--identity(デフォルト0.8)と --coverage(デフォルト0.8)で調整可能)。

 

gene_presence_absence.Rtab

f:id:kazumaxneo:20200410160101p:plain

列はパンゲノムを構築するために使用されたゲノム、行は遺伝子ファミリー。ゲノム内に遺伝子ファミリーが存在する場合は1、そうでない場合は0のバイナリー。

 

matrix.csv

f:id:kazumaxneo:20200404112254p:plain

 roary で生成された gene_presence_absence.csv ファイルに似たフォーマットの .csv ファイル。パンゲノムワイドな関連付け研究を行いたい場合には scoary で動作する。  

 

Ushaped_plot.html

f:id:kazumaxneo:20200404112212p:plain

 

tile_plot.html

タイルプロットは、パンゲノムを構成する生物(x軸)の遺伝子ファミリー(y軸)を表すヒートマップ。タイルは、その遺伝子ファミリーが生物に存在する場合は色付きで、存在しない場合は色なしで表示される。

f:id:kazumaxneo:20200404112125p:plain

拡大

f:id:kazumaxneo:20200404112154p:plain

データ量が多く、ブラウザで開くのが困難な場合、「クラウド」遺伝子ファミリーを除外できる。以下のオプションを使用する。全データが収められたpangenome.h5を対象に以下のコマンドを実行する。

ppanggolin draw -p pangenome.h5 --tile_plot --nocloud

 

 

organisms_statistics.tsv

f:id:kazumaxneo:20200404112320p:plain

 

 

gephiで.gexfファイルと_light.gexfファイルを開く。light.gexfファイルは遺伝子ファミリーをノードとし、遺伝子ファミリー間の関係を記述したエッジを含んでいる。、.gexfファイルも同じものを含むが、各遺伝子や遺伝子ファミリー間の関係についてより詳細な情報を含んでいる。

partitionを選択し、適用をクリック。

f:id:kazumaxneo:20200410154525p:plain

 

レイアウトはForceAtlas2を選択。

f:id:kazumaxneo:20200410154527p:plain

 

視覚化した。ノードには、その遺伝子ファミリーに属する遺伝子の数、最も共通する遺伝子名(アノテーションを提供した場合)、最も一般的な産物名(アノテーションを提供した場合)、それが属するパーティションヌクレオチド単位での平均サイズと中央値、この遺伝子ファミリーを持つ生物の数が格納される。エッジにはパンゲノムに存在する回数が記載される。(wikiより)

f:id:kazumaxneo:20200410154522p:plain

 ノードの色は以下の属性を表す。

f:id:kazumaxneo:20200410155015p:plain

 

 

fastaファイルを"--fasta"で指定する代わりに、PROKKAでアノテーションして得たGFFファイル( gff3、.gbk、.gbff、またはそれらの混合)を指定することもできる、

ppanggolin workflow --anno ORGANISMS_ANNOTATION_LIST --cpu 20

#アノテーションにゲノム配列が含まれていない場合両方のオプションを同時に使用する
ppanggolin workflow --anno ORGANISM_ANNOTATION_LIST --fasta ORGANISM_FASTA_LIST --cpu 20

 

  • 小さなパンゲノム(数百ゲノム)は通常のデスクトップコンピュータで簡単に解析できるが、最大のパンゲノムはかなりの量のRAMを必要とする。例えば、20 656ゲノムでは約1日と120GB RAMを必要とした(Githubより)。
  • Roaryのような任意の閾値の使用を避けるため、PPanGGoLiN pangenome pipelineは期待値最大化アルゴリズムを用いて遺伝子クラスターをその存在-不在パターンと遺伝子シンテニーに基づくいくつかのグループに分割する(論文)。

 

 

 

追記

ステップバイステップで進めることもできる(解説)。例えばアノテーションのみ行うには以下のように打つ。結果は.h5に格納される。

#annotationのみ
ppanggolin annotate --fasta fasta.list --cpu 12

#.h5のstatusを確認
ppanggolin info -p pangenome.h5 --content --status

#予測された全遺伝子を書き出す
ppanggolin write -p pangenome.h5 -o outdir --all_genes

#予測された全遺伝子を書き出す
ppanggolin write -p pangenome.h5 -o outdir --all_genes

 

引用

PPanGGOLiN: Depicting microbial diversity via a partitioned pangenome graph
Guillaume Gautreau, Adelme Bazin, Mathieu Gachet, Rémi Planel, Laura Burlot, Mathieu Dubois, Amandine Perrin, Claudine Médigue, Alexandra Calteau, Stéphane Cruveiller, Catherine Matias, Christophe Ambroise, Eduardo P. C. Rocha, David Vallenet

PLoS Comput Biol. 2020 Mar; 16(3): e1007732

 

 

PPanGGOLiN: Depicting microbial diversity via a Partitioned Pangenome Graph

Guillaume Gautreau, Adelme Bazin, Mathieu Gachet, Rémi Planel, Laura Burlot, Mathieu Dubois, Amandine Perrin, Claudine Médigue, Alexandra Calteau, Stéphane Cruveiller, Catherine Matias, Christophe Ambroise, Eduardo PC Rocha, David Vallenet

bioRxiv, Posted November 09, 2019

 

関連