macでインフォマティクス

macでインフォマティクス

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

ホストゲノムや汚染配列を検出し、分離を助ける PhylOligo

 

 シーケンシング技術の発展により、複雑な非モデル生物ゲノムおよび生物共同体のゲノムをシーケンシングの標的とすることが可能になった。これらの非モデル生物のいくつかは、それらの環境から単離することが困難だったりin vitroでクローン化ができなかったりする。代わりに、共生細菌または寄生細菌として、宿主内に埋め込まれているかもしれない。その結果、ゲノムアセンブリデータセットには、時として、標的にされていない種のmixureのような予期しないソースからのDNAが含まれる。時には細胞内オルガネラゲノムまたは実験室の汚染物質も含まれるかもしれない。非ターゲット種が追加で存在するケースは、いくつか最近のゲノムアセンブリで報告されている(例えばdraft assembly of domestic cow(Merchant et al、2014)、植物病原菌Magnaporthe oryzaeのいくつかの分離株の報告(Chiapello et al、2015) (Delmont and Eren、2016)。このような混合アセンブリは、下流バイオインフォマティクス分析においていくつかのバイアスと問題を生じ得るため、mixed-organism DNA のアセンブリを扱えるツールが必要となる。

 最近、標的とされていない生物をシーケンシングデータセットから検出してフィルタリングするツールがいくつか設計されている。 khmerソフトウェア(Crusoe et al、2015)によって使用される第1のアプローチのアプローチは、de novoシーケンスアセンブリの前にショートリードのk-merスペクトラムを計算して、フィルタリングする。 Blobtools(Kumar et al。、2013)(紹介)およびAnvi'o(Eren et al、2015)のような他のパッケージは、配列特性(GC含量、オリゴヌクレオチドプロファイル)およびpublicデータベースおよびリファレンス遺伝子との類似性、ゲノムデータセットのrawリードとアセンブリされたコンティグの両方を使用して、標的でない種も同定することができる。最後に、メタゲノムのビニングに特化した様々なソフトウェアがあり、複数のサンプルにわたる配列構成およびカバレッジを使用して自動でコンティグを分類するCONCOCT(Alneberg et al、2014)のようなツールや、kraken(Wood and Salzberg 、2014)(紹介)のように、k-merのデータベースへの exact alignmentによってメタゲノムDNAに taxonomic labelsをアサインするツールがある。

 ここでは、アセンブリされたゲノムデータセットの固有のオリゴヌクレオチドシグネチャのみに依存する、アラインメントフリーの標的配列探索、セグメント化、標的でないmaterialを引き出すためのツールセットであるPhylOligoを紹介する。既存のソフトウェアと比較して、PhylOligoは、(i)連続的かつ間隔をあけたパターンk-merを含むカスタマイズ可能なオリゴヌクレオチドパターン(Břindaet al、2015; Leimeister et al、2014;Noéand Martin、 2014)。 (iii)bare contig-level アセンブリの扱い(検出するためにrawリードおよびカバレッジ情報は必要ない)、(iii)コンティグのシグネチャの類似性および累積サイズのインタラクティブなcladogramに基づく視覚化(iv)領域を非標的生物由来と認識する2つの基準を満たす場合((i)宿主配列オリゴヌクレオチドプロファイル(第2の閾値)と十分な距離があり、(ii) 教師学習によって予め選択された標的でない配列のクラスターから十分に近い。)、 教師学習および二重閾値システムに基づくアセンブリの効果的なsliding window方式の分割スキャンを行う、という特徴を持つ。

(一段落省略)

著者らの戦略は3つのステージからなる。(i)すべてのゲノムコンティグから計算されたオリゴヌクレオチドプロファイルに基づく対話型ツリー可視化を用いるアセンブリ探索、(ii)ユーザによって選択されたコンティグサブセットに基づくオリゴヌクレオチドプロファイルプロトタイプ学習、および)アセンブリ分割を行い、生物固有の領域を特定し、学習したプロトタイプに従ってコンティグまたはセグメントを分類する。

 

PhylOligoに関するツイート

 

インストール

ubuntu18.04のpython3.5環境でテストした。

依存

#(python3、Rやsamtoolsも含めて導入したいなら)
apt-get install python3-dev python3-setuptools r-base git emboss samtools

 GIthub

#If you have administrator right 
git clone https://github.com/itsmeludo/PhylOligo.git
cd PhylOligo
pip3 install .

#Rのgplotsとape、getoptが入ってなかったので直接インストールした。
> install.packages("gplots")
> install.packages("getopt")
> install.packages("apt")

> phyloligo.py -h

$ phyloligo.py -h

usage: phyloligo.py [-h] -i GENOME [-k PATTERN] [-s {both,plus,minus}]

[-d {Eucl,JSD,KT,BC,SC}] [--freq-chunk-size FREQCHUNKSIZE]

[--dist-chunk-size DISTCHUNKSIZE] --method {scoop,joblib}

[--large {None,memmap,h5py}] [-c THREADS_MAX]

[-o OUT_FILE] [-q OUT_FREQ_FILE] [-w WORKDIR] [-p PATTERN]

 

optional arguments:

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

-i GENOME, --assembly GENOME

multifasta of the genome assembly

-k PATTERN, --lgMot PATTERN

word lenght / kmer length / k [default:4]

-s {both,plus,minus}, --strand {both,plus,minus}

strand used to compute microcomposition.

[default:both]

-d {Eucl,JSD,KT,BC,SC}, --distance {Eucl,JSD,KT,BC,SC}

how to compute distance between two signatures : Eucl

: Euclidean[default:Eucl], JSD : Jensen-Shannon

divergence, KT: Kendall's tau, BC: Bray-Curtis,

SC:Spearman Correlation

--freq-chunk-size FREQCHUNKSIZE

the size of the chunk to use in scoop to compute

frequencies

--dist-chunk-size DISTCHUNKSIZE

the size of the chunk to use in scoop to compute

distances

--method {scoop,joblib}

don't use scoop to compute distances use joblib

--large {None,memmap,h5py}

used in combination with joblib for large dataset

-c THREADS_MAX, --cpu THREADS_MAX

how many threads to use for windows microcomposition

computation[default:4]

-o OUT_FILE, --out OUT_FILE

output file[default:phyloligo.out]

-q OUT_FREQ_FILE, --outfreq OUT_FREQ_FILE

kmer frequencies output file [default:infile_None]

-w WORKDIR, --workdir WORKDIR

working directory

-p PATTERN, --pattern PATTERN

spaced-word pattern string, only containing 1s and 0s,

i.e. '100101001', default='1111'

> phyloligo_comparemat.py -h

$ phyloligo_comparemat.py -h

usage: phyloligo_comparemat.py [-h] [--mat1 MATRIX1]

[--format1 {numpy,memmap,h5py}]

[--mat2 MATRIX2]

[--format2 {numpy,memmap,h5py}]

 

optional arguments:

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

--mat1 MATRIX1

--format1 {numpy,memmap,h5py}

--mat2 MATRIX2

--format2 {numpy,memmap,h5py}

——

 

 

テストラン

Generate the all-by-all contig distance matrix: 

ユークリッド距離かジェンセン・シャノン情報量に基づくcontig間のall versus allの距離計算

#先にdata/M.oryzae_TH12.fasta.xzを解凍しておく

phyloligo.py -i data/M.oryzae_TH12.fasta --method joblib -p 1111 -s both -d JSD -c 8 -w data/example1/ -o data/example1/M.oryzae_TH12_ex1_JSD_joblib.mat
  • -i     multifasta of the genome assembly
  • --method {scoop joblib}   don't use scoop to compute distances use joblib
  • -d {Eucl | JSD}    how to compute distance between two signatures : Eucl: Euclidean[default:Eucl], JSD : Jensen-Shannon divergence 
  • -p    spaced-word pattern string, only containing 1s and 0s
  • -s {bothplus | minus}   strand used to compute microcomposition.
  • -c    how many threads to use for windows microcomposition
    computation[default:4]
  • -o    output file[default:phyloligo.out]

 

Regroup contigs by compositional similarity on a tree and explore branching 

phyloselect.R -d -m -c 0.95 -s 4000 -t BIONJ -f c -w 20 \
-i data/example1/M.oryzae_TH12_ex1_JSD_joblib.mat \
-a data/M.oryzae_TH12.fasta \
-o data/genome_conta
  • -d | --dump_R_session  
  • -m | --matrix_heatmap
  • -c | --distance_clip_percentile
  • -w | --branchwidth
  • -i    All-by-all contig distance matrix, tab separated (required)
  • -a   Multifasta file of the contigs (required)
  • -o   Outfile name, default:phyloligo.out

クレードをクリックするとそのクレードが赤くなり、赤い部分だけが別ウィンドウに表示される。

端末の方はプロンプト表示され、指示待ち状態になっている。端末に戻りyを打つと、指定した出力ディレクトリにそのfastaとPDFファイルが出力される。E (exit) で終了(テスト時は終わらなかったのでCtrl+cでプログラムをkillした)。

f:id:kazumaxneo:20181016215445p:plain

data/に出力した。該当する配列のfastaが保存されている。

f:id:kazumaxneo:20181016215244j:plain

 

Regroup contigs by compositional similarity: hierarchical DBSCAN or K-medoids clustering and multidimensional scaling display with t-SNE

phyloselect.py -t -m hdbscan --noX \
-i data/example1/M.oryzae_TH12_ex1_JSD_joblib.mat \
-o genome_conta
  • -t    Perform tsne for visualization and pre-clustering
  • -m {hdbscan | kmedoids}   Method to use to compute cluster on transformed distance matrix
  • --noX   Instead of showing pictures, store them in png
  • -i    DISTMAT The input matrix file
  • -o   OUTPUTDIR

f:id:kazumaxneo:20181016221015p:plain

Extract DNA segments with homogeneous olignonucleotide composition from a genome assembly using ContaLocate

例えば上のphyloselect.Rでコンタミナント、またはホストゲノムのFASTA配列を出力し、そのFASTAを指定する。

contalocate.R -i -a data/M.oryzae_TH12.fasta -c contaminant.fa 
  • -i    Multifasta of the genome assembly (required)
  • -r    learn Host training set (optional)
  • -c    learn Contaminant training set (optional) 

M.oryzae_TH12.fasta_vs__host_threshold.pdf

f:id:kazumaxneo:20181017114304p:plain

 

 

Compare the result matrix with the reference matrix 

phyloligo_comparemat.py --mat1 data/references/M.oryzae_TH12_JSD_ref.mat --format1 numpy --mat2 data/example1/M.oryzae_TH12_ex1_JSD_joblib.mat --format2 numpy

 

他にも高度に保存されたリピートを除いて計算時間を減らすツールなどがあります。詳細はGithubで確認して下さい。

引用

PhylOligo: a package to identify contaminant or untargeted organism sequences in genome assemblies
Ludovic Mallet, Tristan Bitard-Feildel, Franck Cerutti, and Hélène Chiapello

Bioinformatics. 2017 Oct 15; 33(20): 3283–3285

 

関連ツール