macでインフォマティクス

macでインフォマティクス

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

Scaffold情報を用いてメタゲノムビンの連続性と質の向上を行う Binnacle

 

 ハイスループットシーケンシングは微生物学の分野に革命をもたらしたが、メタゲノムショットガンシーケンシングデータから生物の完全なゲノムを再構築することは依然として困難である。回収されたゲノムは、生物の存在量の不均一性、ゲノム内およびゲノム間のリピート、シーケンスエラー、株レベルの変異などにより、非常に断片的であることが多い。メタゲノムアセンブリの断片化に対処するために、科学者たちは、同一生物に由来すると考えられるコンティグをまとめる「ビニング」というプロセスを利用している。既存のビニングアルゴリズムでは、サンプル内およびサンプル間のオリゴヌクレオチド頻度とコンティグアバンダンス(カバレッジ)を用いて、同一生物からのコンティグをまとめている。しかし、これらのアルゴリズムでは、短いコンティグや、通常とは異なるカバレッジ転移因子などのDNA組成の特徴を持つ領域からのコンティグを見逃すことが多い。ここでは、アセンブリグラフから得られる情報が、メタゲノムのビニングのための現在の戦略を支援することを提案する。メタゲノム解析ツールMetaCarvelを用いて、コンティグをノードとし、ペアエンドリードに基づいてエッジを推定するアセンブリグラフを構築した。アセンブリグラフから情報を抽出し、スキャフォールドを包括的なビンにクラスター化するツール「Binnacle」を開発した。Binnacleは、既存のビニング手法と統合するためのラッパースクリプトも提供する。BinnacleのパイプラインはGitHubに掲載されている(https://github.com/marbl/binnacle)。コンティグではなく、グラフベースのスキャフォールドをビニングすることで、結果として得られるビンの連続性と品質が向上し、再構成される生物の遺伝子のより広いセットを捉えることができることを示す。

 

Preparing the Data

https://github.com/marbl/binnacle/wiki/2.-Preparing-the-Data

 

インストール

依存

  • Binnacleを実行するには、Python 3.7.x、Bedtools、Samtools、BioPython、networkx、numpy、およびPandasが必要

Github

git clone https://github.com/marbl/binnacle.git
cd binnacle/
mamba env create --file Environment.yml
conda activate binnacle_env
cd src/

> python Estimate_Abundances.py -h

$ python Estimate_Abundances.py -h

usage: Estimate_Abundances.py [-h] [-g ASSEMBLY] [-a COVERAGE] [-bam BAMFILE]

[-bed BEDFILE] [-c CONTIGS] -d DIR [-o COORDS]

[-w WINDOW_SIZE] [-t THRESHOLD]

[-n NEIGHBOR_CUTOFF] [-p POSCUTOFF]

[-pre PREFIX]

 

binnacle: A tool for binning metagenomic datasets using assembly graphs and

scaffolds generated by metacarvel. Estimate_Abundances.py estimates abundance

for scaffolds generated by MetaCarvel. If the coordinates computed by binnacle

is specified then the abundance for each scaffold is estimated based on the

contig abundances and the coordinates. If the coordinates are not specified

then binnacle etimates the abundance from scratch. While calculating all vs

all abundances please specify the coordinates(Coordinates_After_Delinking.txt)

through the "coords" parameter. The abundances can be provided as a bed file,

bam file or a text file describing the per base coverage obtained by running

the genomeCoverageBed program of the bedtools suite.

 

optional arguments:

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

-g ASSEMBLY, --assembly ASSEMBLY

Assembly Graph generated by Metacarvel

-a COVERAGE, --coverage COVERAGE

Output generated by running genomecov -d on the bed

file generated by MetaCarvel.

-bam BAMFILE, --bamfile BAMFILE

Bam file from aligning reads to contigs

-bed BEDFILE, --bedfile BEDFILE

Bed file from aligning reads to contigs. If bed file

is provided please provide a fasta file of the contigs

-c CONTIGS, --contigs CONTIGS

Contigs generated by the assembler, contigs.fasta

-d DIR, --dir DIR output directory for results

-o COORDS, --coords COORDS

Coordinate file generated by Binnacle

-w WINDOW_SIZE, --window_size WINDOW_SIZE

Size of the sliding window for computing test

statistic to identify changepoints in coverages

(Default=1500)

-t THRESHOLD, --threshold THRESHOLD

Threshold to identify outliers (Default=99)

-n NEIGHBOR_CUTOFF, --neighbor_cutoff NEIGHBOR_CUTOFF

Filter size to identify outliers within (Defualt=100)

-p POSCUTOFF, --poscutoff POSCUTOFF

Position cutoff to consider delinking (Default=100)

-pre PREFIX, --prefix PREFIX

Prefix to be attached to all outputs

python Collate.py -h

$ python Collate.py -h

usage: Collate.py [-h] -d DIR [-m METHOD] [-k KEEP]

 

binnacle: A tool for binning metagenomic datasets using assembly graphs and

scaffolds generated by metacarvel.Estimate_Abundances.py estimates abundance

for scaffolds generated by MetaCarvel. The program Collate.py collects the

summary files generated by Estimate_Abundances.py

 

optional arguments:

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

-d DIR, --dir DIR Output directory that contains the summary files

generated by running Estimate_Abundances.py

-m METHOD, --method METHOD

Binning method to format the output to. Presently we

support 1. Metabat 2. Maxbin 3. Concoct 4. Binnacle

(Default)

-k KEEP, --keep KEEP Retain the summary files generated by

Estimate_Abundances.py. Defaults to True

 

 

実行方法

 megahitなどのアセンブリにシングルモードでリードをマッピングする。

#build the index
bowtie2-build megahit/final.contigs.fa idx

#map read1
bowtie2 -p 20 -x idx -U first.fastq.gz | samtools sort -@ 4 - > alignment_1.bam

#map read2
bowtie2 -p 20 -x idx -U second.fastq.gz | samtools sort -@ 4 - > alignment_2.bam

#merge the alignments
samtools merge -@ 4 alignment_total.bam alignment_1.bam alignment_2.bam

#sort by read names
samtools sort -@ 4 -n alignment_total.bam > alignment.bam

 

2、contigとbamファイルを指定してmetagenome contigのscaffoldingを行う。MetaCarvel(紹介)を使う。

python run.py -a megahit/final.contigs.fa -m alignment.bam -d outputdir -r true -k true -v true
python find_motifs.py -d outputdir
  • -a    assembled contigs
  • -m   mapping of read to contigs in bam format
  • -d    output directory for results 

 

3、ベースごとのコンティグ・カバレッジの推定。最初のアセンブリ配列にマッピングして、bedtoolsのgenomeCoverageBedユーティリティで求める。複数のサンプルがあるなら、全ての組み合わせで実行する必要がある(4つのアセンブリがあってそれら4つのfastqがあるなら16通り)。下は1つのアセンブリでの例。

cd outputdir/
bowtie2-build megahit/final.contigs.fa idx

bowtie2 -p 20 -x idx -U READS_1.fq.gz,READS_2.fq.gz --no-unal | samtools sort -@ 8 | genomeCoverageBed -ibam stdin -bga -split > coverage.txt

LC_ALL=C sort -k1,1 coverage.txt > coverage_sorted.txt

 

4、Binnacleの実行。ベースごとのコンティグ・カバレッジファイルを用いてスキャフォールドのアバンダンスを推定する。-gでMetaCarvelの出力ディレクトリの.gmlファイルを指定する。3と同様、複数のサンプルがあるなら、全ての組み合わせで実行する必要がある。

python Estimate_Abundances.py -g outputdir/oriented.gml -a coverage_sorted.txt -c megahit/final.contigs.fa -d sample1_outdir -pre S1

出力

f:id:kazumaxneo:20210824225637p:plain

 

5、スキャフォールドアバンダンスファイルを含むディレクトリを指定する。

python Collate.py -m metabat -d sample1_outdir 

Feature-Matrix-metabat.txtとScaffolds.fastaが4の出力ディレクトリに追加される。

f:id:kazumaxneo:20210824225819p:plain

 

6、このFeature-Matrix-metabat.txtとScaffolds.fastaを使ってmetabat2でビニングを行う。

mkdir metabat2_outdir
metabat2 -i sample1_outdir/Scaffolds.fasta -a sample1_outdir/Feature-Matrix-metabat.txt -o metabat2_outdir/metabat2 -t 20

 

試したデータでは、1サンプル分のデータしか提供しなかったにも関わらず、metabat2のbin配列数が70個から77個に増加した。

引用

Binnacle: Using Scaffolds to Improve the Contiguity and Quality of Metagenomic Bins

Harihara Subrahmaniam Muralidharan†, Nidhi Shah†, Jacquelyn S. Meisel and Mihai Pop

Front. Microbiol., 24 February 2021

 

関連