macでインフォマティクス

macでインフォマティクス

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

メタゲノムシーケンシングデータからMLST タイピングを行う MetaMLST

2020 5/24 レポジトリが引っ越ししているので、リンク更新

2022/09/06 インストール手順更新

 

 高分解能の微生物菌株同定およびトレースは、臨床および研究環境の両方において重要な課題である。微生物の菌株レベルのタイピングのための最も一般的な方法の1つは、すべての株に存在することが知られている少数の種特異的ゲノム遺伝子座(通常は7つ)をシーケンシングすることに基づくmultilocus sequence typing(MLST)を与えられた標的種全てで行うことである。そのシンプルさと解像度のおかげで、多くの原核生物(ref.2,3)および真核微生物(ref.4)にMLSTアプローチが定義され採用されてきた。様々な 病原菌種に対応した何千ものMLSTのプロファイルとシーケンスのデータベースが利用可能になっている(ref.5,6)。

 臨床でのMLSTの日常的な使用を妨げる制限要因は、関心のある各細菌種を単離して培養する必要性である。 MLSTプロトコル(標的遺伝子座のDNA抽出、PCR増幅、精製およびシーケンシング)も高価で面倒である。次世代シークエンシング技術のスループット向上によるコスト削減により、サンプル(metagenomics(ref.7))の全DNA含量を直接シーケンシングして、時間のかかる単離および培養をスキップして複雑な微生物群集の特性評価を行う効果的なアプローチが可能になっている。メタゲノムデータセットは、所与の微生物群集に存在するすべての菌株のシーケンス情報を含み、理論的には、サンプル中のすべての種のデータをタイピングすることができる。

 メタゲノムMLSTタイピングを達成するための可能な戦略は、メタゲノミクスアセンブリを行い、そのメタゲノミクスコンティグをMLSTデータベースに対してマッピングすることである。しかしながら、このアプローチは、豊富な株(すなわちアセンブリのための十分なデプスを有する株)しか明らかにならない。さらに、メタゲノミクスアセンブリは計算上要求が厳しい。したがって、現在、メタゲノムからMLST遺伝子座を容易かつ効率的に抽出する方法はない。

 MLST手法の有効性と、培養フリーかつ高処理能力のメタゲノミクスを組み合わせるために、著者らはMetaMLSTと呼ばれる微生物タイピングのための新しい計算パイプラインを開発した。利用可能なMLST lociを持つ種について、MLST lociのテンプレートデータベースが与えられると、MetaMLSTは、メタゲノミクス試料中の微生物株のlociプロファイルのin silicoコンセンサス配列再構築を行う。再構成されたloci(プロファイル)は、PubMLST(ref.5)で維持されている公に利用可能なプロファイルのデータベースと比較することによって同定される。新しいalleles、すなわちデータベースに存在しない新しいallelesは、配列内部データベースをテンプレートとして使用し、与えられた信頼スコアに基づき、comparative sequence reconstruction によって決定される。このマッピングベースの手法は、計算上の制限を克服し、メタゲノムアセンブリと比較して検出限界を減らすことできる。下流の標準MLSTパイプラインに続いて、サンプルを個別に処理してsequence types(ST)プロファイルを決定し、疫学分析のために組み合わせ、可能であれば公的データベースで利用可能な多数のプロファイリングされた株と統合する。このソフトウェアは、http://segatalab.cibio.unitn.it/tools/metamlst/のサポート資料で自由に入手できる。

 

HP

Segata Lab - Computational Metagenomics

wiki

https://bitbucket.org/CibioCM/metamlst/wiki/Home

Segata Lab のツールは以前も何度か紹介させてもらっています。

f:id:kazumaxneo:20181027100151p:plain

MetaMLST works by reconstructing the MLST loci-sequences using the closest reference from the publicly available datsets (PubMLST) and traces the most abundant strain of each species.  Bitbucketより。

 

インストール

mac os10.13のanaconda3-5.0.0環境でテストした。

依存

Bitbucket Github

git clone https://github.com/SegataLab/metamlst.git
cd metamlst/

> python3 metamlst.py

$ python3 metamlst.py

usage: metamlst.py [-h] [-o OUTPUT FOLDER] [-d DB PATH]

                   [--filter species1,species2...] [--penalty PENALTY]

                   [--minscore MINSCORE] [--max_xM XM] [--min_read_len LENGTH]

                   [--min_accuracy CONFIDENCE] [--debug] [--presorted]

                   [--quiet] [--version] [--nloci NLOCI] [--log] [-a]

                   [BAMFILE]

 

Reconstruct the MLST loci from a BAMFILE aligned to the reference MLST loci

 

positional arguments:

  BAMFILE               BowTie2 BAM file containing the alignments (default:

                        None)

 

optional arguments:

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

  -o OUTPUT FOLDER      Output Folder (default: ./out) (default: ./out)

  -d DB PATH, --database DB PATH

                        Specify a different MetaMLST-Database. If unset, use

                        the default Database. You can create a custom DB with

                        metaMLST-index.py) (default: /Users/kamisakakazuma/loc

                        al/metamlst/metamlst_databases/metamlstDB_2018.db)

  --filter species1,species2...

                        Filter for specific set of organisms only (METAMLST-

                        KEYs, comma separated. Use metaMLST-index.py

                        --listspecies to get MLST keys) (default: None)

  --penalty PENALTY     MetaMLST penaty for under-represented alleles

                        (default: 100)

  --minscore MINSCORE   Minimum alignment score for each alignment to be

                        considered valid (default: 80)

  --max_xM XM           Maximum SNPs rate for each alignment to be considered

                        valid (BowTie2s XM value) (default: 5)

  --min_read_len LENGTH

                        Minimum BowTie2 alignment length (default: 50)

  --min_accuracy CONFIDENCE

                        Minimum threshold on Confidence score (percentage) to

                        pass the reconstruction step (default: 0.9)

  --debug               Debug Mode (default: False)

  --presorted           The input BAM file is sorted and indexed with

                        samtools. If set, MetaMLST skips this step (default:

                        False)

  --quiet               Suppress text output (default: False)

  --version             Prints version informations (default: False)

  --nloci NLOCI         Do not discard samples where at least NLOCI (percent)

                        are detected. This can lead to imperfect MLST typing

                        (default: 100)

  --log                 generate logfiles (default: False)

  -a                    Write known sequences (default: False)

>python3 metamlst-merge.py -h

$ python3 metamlst-merge.py -h

usage: metamlst-merge.py [-h] [-d DB PATH] [--filter species1,species2...]

                         [-z ED] [--meta METADATA_PATH] [--idField IDFIELD]

                         [--outseqformat {A,A+,B,B+,C,C+}]

                         [-j subjectID,diet,age...] [--jgroup] [--version]

                         [folder]

 

Detects the MLST profiles from a collection of intermediate files from MetaMLST.py

 

positional arguments:

  folder                Path to the folder containing .nfo MetaMLST.py files

 

optional arguments:

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

  -d DB PATH, --database DB PATH

                        Specify a different MetaMLST-Database. If unset, use the default Database. You can create a custom DB with metaMLST-index.py)

  --filter species1,species2...

                        Filter for specific set of organisms only (METAMLST-KEYs, comma separated. Use metaMLST-index.py --listspecies to get MLST keys)

  -z ED                 Maximum Edit Distance from the closest reference to call a new MLST allele. Default: 5

  --meta METADATA_PATH  Metadata file (CSV)

  --idField IDFIELD     Field number pointing to the 'sampleID' value in the metadata file

  --outseqformat {A,A+,B,B+,C,C+}

                        A  : Concatenated Fasta (Only Detected STs)

                        A+ : Concatenated Fasta (All STs)

                        B  : Single loci (Only New Loci)

                        B+ : Single loci (All loci)

                        C  : CSV STs Table [default]

  -j subjectID,diet,age...

                        Embed a LIST of metadata in the the output sequences (A or A+ outseqformat modes). Requires a comma separated list of field names from the metadata file specified with --meta

  --jgroup              Group the output sequences (A or A+ outseqformat modes) by ST, rather than by sample. Requires -j

  --version             Prints version informations

 

 

実行方法

1、データベースの準備

初回のみデータベースのダウンロードとビルドを行う必要がある。データベースが見つからなければラン時に再構築される。

#オーサーが準備した2018更新データがダウンロードされる。
python3 metamlst-index.py

#indexing
python3 metamlst-index.py -i bowtie_index

または下記からダウンロードする。

https://bitbucket.org/CibioCM/metamlst/downloads/

f:id:kazumaxneo:20181027103345p:plain

a$ metamlst-index.py -i bowtie_index

-bash: metamlst-index.py: command not found

kamisakBookpuro:metamlst kamisakakazuma$ python3 metamlst-index.py -i bowtie_index

Database /Users/kamisakakazuma/local/metamlst/metamlst_databases/metamlstDB_2018.db contains:

133 organisms

923 total loci

115566 total alleles (~54.71 Megabases)

13928 total profiles

COLLECTING DATA...                                                [ -  ...  - ]

BUILDING INDEX                                                    [ -  ...  - ]

BUILDING INDEX                                                    [ -  DONE - ]

完了。以後は作成した"bowtie_index"を使う。

 

2、データベースへのマッピング

example/4_single_sample_multiple_species/の2サンプルを使う。

#サンプル1
bowtie2 --threads 4 --very-sensitive-local -a --no-unal -x bowtie_index \
metamlst_examples/4_two_samples_with_metadata/SRS015937_epidermidis.fastq \
| samtools view -bS - > SRS015937_epidermidis.bam

#サンプル2
bowtie2 --threads 4 --very-sensitive-local -a --no-unal -x bowtie_index \
metamlst_examples/4_two_samples_with_metadata/SRS013261_epidermidis.fastq \
| samtools view -bS - > SRS013261_epidermidis.bam

ペアエンドは-1-2フラグを立てて指定する。並列処理数は--threadsで指定する。bamが出力される。

 

3、データベースへのアライメント結果からベストマッチの配列を決め、MLST alleleを再構成する

#1
metamlst.py SRS015937_epidermidis.bam -o ./out/

#2
metamlst.py SRS013261_epidermidis.bam -o ./out/

$ python3 metamlst.py SRS013261_epidermidis.bam -o ./out/

 

---------------------------  SRS013261_epidermidis  ----------------------------

 sepidermidis       Detected Loci: arcC, aroE, gtr, mutS, pyrR, tpiA, yqiL

 

Closest allele identification                                     [ -  ...  - ]

 

  Locus    Avg. Coverage  Score  Hits Reference Allele(s)                

  arcC             33.51  183.3  2990 8                                   

  aroE             24.02  179.0  1656 7                                   

  gtr              26.63  177.9  1863 12                                  

  mutS             31.48  178.2  1613 4                                   

  pyrR             25.38  183.8  1607 12                                  

  tpiA             28.89  180.1  1637 2                                   

  yqiL             34.91  172.2  2531 2                                   

 

Building Consensus Sequences                                      [ -  ...  - ]

 

  Locus  Ref.    Length     Ns   SNPs     Confidence     Notes

  arcC   8          465      0      0        100.0 %        --

  aroE   7          420      0      0        100.0 %        --

  gtr    12         438      0      0        100.0 %        --

  mutS   4          412      0      0        100.0 %        --

  pyrR   12         428      0      0        100.0 %        --

  tpiA   2          424      0      0        100.0 %        --

  yqiL   2          416      0      0        100.0 %        --

 

Reconstruction Successful                                         [ - WRITE - ]

 pacnes             Detected Loci: CAMP2, aroE, atpD, gmk, guaA, lepA, sodA, tly

 

Closest allele identification                                     [ -  ...  - ]

 

  Locus    Avg. Coverage  Score  Hits Reference Allele(s)                

  CAMP2           101.19  184.6   864 6                                   

  aroE             25.29  176.8   106 1                                   

  atpD             28.22  174.0   129 1                                   

  gmk              17.56  175.1    71 1                                   

  guaA             26.13  179.4   130 3                                   

  lepA             46.12  187.6   226 1                                   

  sodA              30.4  177.7   138 1                                   

  tly              36.64  184.3   297 8                                   

 

Building Consensus Sequences                                      [ -  ...  - ]

 

  Locus  Ref.    Length     Ns   SNPs     Confidence     Notes

  CAMP2  6          804      0      0        100.0 %        --

  aroE   1          424      0      0        100.0 %        --

  atpD   1          453      0      0        100.0 %        --

  gmk    1          400      0      0        100.0 %        --

  guaA   3          493      0      0        100.0 %        --

  lepA   1          452      0      0        100.0 %        --

  sodA   1          450      0      0        100.0 %        --

  tly    8          777      0      0        100.0 %        --

 

Reconstruction Successful                                         [ - WRITE - ]

 saureus            Detected Loci: tpi, yqiL

                    Missing Loci : arcC, aroE, glpF, gmk, pta

 

 szooepidemicus     Detected Loci: tpi

                    Missing Loci : arcC, nrdE, proS, spi, tdk, yqiL

 

 sbsec              Detected Loci: tpi

                    Missing Loci : ddl, gki, glnA, mutS, mutS2, pheS, proS, pyrE, thrS

 

 kpneumoniae        Detected Loci: pgi

                    Missing Loci : gapA, infB, mdh, phoE, rpoB, tonB

 

 koxytoca           Detected Loci: pgi

                    Missing Loci : gapA, infB, mdh, phoE, rpoB, tonB

 

 mabscessus         Detected Loci: Mab-rpoB

                    Missing Loci : Mab-argH, Mab-cya, Mab-gnd, Mab-murC, Mab-pta, Mab-purH

 

 cdiphtheriae       Detected Loci: atpA, rpoB

                    Missing Loci : dnaE, dnaK, fusA, leuA, odhA

 

 pfluorescens       Detected Loci: rpoB

                    Missing Loci : glnS, gyrB, ileS, nuoD, recA, rpoD

 

 streptomyces       Detected Loci: atpD

                    Missing Loci : 16S, gyrB, recA, rpoB, trpB

 

 soralis            Detected Loci: ddl

                    Missing Loci : aroE, gdh, gki, hexB, recP, xpt

 

 spneumoniae        Detected Loci: ddl, gki

                    Missing Loci : aroE, gdh, recP, spi, xpt

 

 bcc                Detected Loci: lepA

                    Missing Loci : atpD, gltB, gyrB, phaC, recA, trpB

 

 mcaseolyticus      Detected Loci: tuf

                    Missing Loci : ack, cpn60, fdh, pta, purA, sar

 

 arcobacter         Detected Loci: aspA

                    Missing Loci : atpA, glnA, gltA, glyA, pgm, tkt

 

 ecoli              Detected Loci: adk, fumC

                    Missing Loci : gyrB, icd, mdh, purA, recA

 

 mcanis             Detected Loci: tuf

                    Missing Loci : ack, cpn60, fdh, pta, purA, sar

 

 aeromonas          Detected Loci: groL

                    Missing Loci : gltA, gyrB, metG, ppsA, recA

 

 neisseria          Detected Loci: fumC

                    Missing Loci : abcZ, adk, aroE, gdh, pdhC, pgm

 

 smaltophilia       Detected Loci: recA

                    Missing Loci : atpD, gapA, guaA, mutM, nuoD, ppsA

 

 tenacibaculum      Detected Loci: atpA

                    Missing Loci : dnaK, glyA, gyrB, infB, rlmN, tgt

 

 clari              Detected Loci: Cla-atpA

                    Missing Loci : Cla-adk, Cla-glnA, Cla-glyA, Cla-pgi, Cla-pgm, Cla-tkt

 

 bpseudomallei      Detected Loci: gltB

                    Missing Loci : ace, gmhD, lepA, lipA, narK, ndh

 

 efaecalis          Detected Loci: gyd

                    Missing Loci : aroE, gdh, gki, pstS, xpt, yqiL

 

 efaecium           Detected Loci: gyd

                    Missing Loci : adk, atpA, ddl, gdh, pstS, purK

 

 senterica          Detected Loci: purE

                    Missing Loci : aroC, dnaN, hemD, hisD, sucA, thrA

 

 spseudintermedius  Detected Loci: tuf

                    Missing Loci : ack, cpn60, fdh, pta, purA, sar

 

                                                               [ - Completed - ]

検出されたlociとmissingのlociがそれぞれ表示される。

 

4、複数サンプルの解析では、次のステップにメタデータファイルを読み込む必要があるので、ここで準備する。ここでは公式に習いsample_metadata.txtといファイル名にした。書式はexample5のメタデータファイルを真似した。

sampleID metadata_field_1 dataset_name source

SRS013261 some_data1 hmp source1

SRS015937 some_data1 hmp source1

 

5、strain typing

metamlst-merge.py --meta sample_metadata.txt ./out/

$ metamlst-merge.py ./out/

+------------------------------------------------------------------------------+

|                          Staphylococcus epidermidis                          |

+------------------------------------------------------------------------------+

KNOWN MLST profiles found:

ST arcC aroE gtr mutS pyrR tpiA yqiL Hits

19 8 7 12 4 12 2 2 1

 

 

NEW MLST profiles found:

ST arcC aroE gtr mutS pyrR tpiA yqiL Hits

100001 1 1 1 2 2 1 13 1

 

 

REJECTED NEW MLST profiles, as they have > SNPs than max-threshold (-z 5)

ST arcC aroE gtr mutS pyrR tpiA yqiL Hits

 

Outputing results                                                 [ -  ...  - ]

+------------------------------------------------------------------------------+

|                           Propionibacterium acnes                            |

+------------------------------------------------------------------------------+

KNOWN MLST profiles found:

ST CAMP2 aroE atpD gmk guaA lepA sodA tly Hits

4 6 1 1 1 3 1 1 8 1

 

 

NEW MLST profiles found:

ST CAMP2 aroE atpD gmk guaA lepA sodA tly Hits

 

 

REJECTED NEW MLST profiles, as they have > SNPs than max-threshold (-z 5)

ST CAMP2 aroE atpD gmk guaA lepA sodA tly Hits

 

Outputing results                                                 [ -  ...  - ]

Colour Legend:

--------------------------------------------------------------------------------

Alleles: [Known] [NEW] [NEW-RECURRING]

Profiles: [Known] [NEW] [NEW*]

New* profiles are composed by Known and Recurring alleles only

--------------------------------------------------------------------------------

Completed! Have a nice day.

出力ディレクトリにmergedディレクトリができる。

f:id:kazumaxneo:20181027134700p:plain

解説: Githubより

MetaMLST Report File: Contains the aggregate analysis for all the samples.

MetaMLST ST File : Contains the new S. epidermidis ST table after the analys (all the known profiles plus the new profiles detected in the samples).

 

ツールにPATHが通っていれば、他のexampleもそれぞれのサブディレクトリのtest.shを叩くことで実行できます。wikiの他のexampleには、MetaMLSTで解析後、タイピング結果を元に系統樹やMinimum Spanning Trees (wiki)を描く流れにも簡単に触れられています。

 

感想

メタゲノムアセンブリのbinningツールは、データによってはspeciesレベルのbinningを可能にしますが、ultra deep シーケンシングしてもstrainレベルの分類はまだ困難なままです(論文 Fig.2d Critical Assessment of Metagenome Interpretation—a benchmark of metagenomics software)。これは、メタゲノムのショートリードシーケンシングデータからde novoアセンブリを行っても、よく似たゲノムはまとめられてしまうためです。研究の目的によっては、MLSTのようなstrainレベルの分解能を持った手法も引き続き重要になってきます。

引用
MetaMLST: multi-locus strain-level bacterial typing from metagenomic samples
Zolfo M, Tett A, Jousson O, Donati C, Segata N

Nucleic Acids Res. 2017 Jan 25;45(2):e7