2026/07/17追記
最近のロングリードアセンブリは、利用可能なリファレンスゲノムの品質と完全性を上回ることが多く、その検証は困難を極めている。ここでは、効率的なk-merセット操作に基づいてリファレンスフリーにアセンブリを評価する新しいツール、Merquryを紹介する。Merquryは、de novo アセンブリのk-merを、未アセンブリの高精度リードに含まれるk-merと比較することで、ベースレベルの精度と完全性を推定する。Triosの場合、Merquryはハプロタイプ固有の精度、完全性、フェーズブロックの連続性、スイッチエラーも評価できる。評価のために、k-merスペクトルプロットなどの複数の視覚化を生成することができる。ヒトと植物の両方のゲノムにおいて、Merquryがアセンブリ検証のための高速で堅牢な手法であることを実証する。
"Merqury: reference-free quality and phasing assessment for genome assemblies" from @ArangRhie Everything you need for k-mer-based assembly validation! https://t.co/zq5VZ7j8j7 pic.twitter.com/7TEFvjAgYZ
— Adam Phillippy (@aphillippy) March 17, 2020
Githubより
ゲノムアセンブリプロジェクトでは、アセンブルされた個体のイルミナ全ゲノムシークエンスリードが利用できることが多い。このリードセットからのk-merスペクトラムは、高品質のリファレンスを必要とせずに、アセンブリ品質の独立した評価に使用できる。Merquryは、この目的のために一連のツールを提供しています。
インストール
condaでpython3.9の仮想環境を作って導入した(ubuntu18.04)。
依存
- gcc 7.4 or higher (for installing meryl)
- meryl v1.3
- Java run time environment (JRE)
- R with argparse, ggplot2, and scales (recommend R 4.0.3+)
- bedtools
- samtools
#conda(link)
mamba create -n merqury -c conda-forge -c bioconda merqury openjdk=11 -y
conda activate merqury
mamba install -c conda-forge -c bioconda merqury -y
> merqury.sh -h
Usage: merqury.sh [-c] <read-db.meryl> [<mat.meryl> <pat.meryl>] <asm1.fasta> [asm2.fasta] <out>
-c : [OPTIONAL] input meryl databases are homopolymer compressed, while asm.fasta isn't
This option is not supported for trio-based analysis. Use pre-compressed assemblies with no -c option.
<read-db.meryl> : k-mer counts of the read set
<mat.meryl> : k-mer counts of the maternal haplotype (ex. mat.hapmer.meryl)
<pat.meryl> : k-mer counts of the paternal haplotype (ex. pat.hapmer.meryl)
<asm1.fasta> : Assembly fasta file (ex. pri.fasta, hap1.fasta or maternal.fasta)
[asm2.fasta] : Additional fasta file (ex. alt.fasta, hap2.fasta or paternal.fasta)
*asm1.meryl and asm2.meryl will be generated. Avoid using the same names as the hap-mer dbs
<out> : Output prefix
Arang Rhie, 2022-09-07. arrhie@gmail.com
> meryl -h
usage: meryl ...
A meryl command line is formed as a series of commands and files, possibly
grouped using square brackets. Each command operates on the file(s) that
are listed after it.
COMMANDS:
statistics display total, unique, distinct, present number of the kmers on the screen. accepts exactly one input.
histogram display kmer frequency on the screen as 'frequency<tab>count'. accepts exactly one input.
print display kmers on the screen as 'kmer<tab>count'. accepts exactly one input.
count Count the occurrences of canonical kmers in the input. must have 'output' specified.
count-forward Count the occurrences of forward kmers in the input. must have 'output' specified.
count-reverse Count the occurrences of reverse kmers in the input. must have 'output' specified.
k=<K> create mers of size K bases (mandatory).
n=<N> expect N mers in the input (optional; for precise memory sizing).
memory=M use no more than (about) M GB memory.
threads=T use no more than T threads.
compress compress homopolymer runs to a single letter.
less-than N return kmers that occur fewer than N times in the input. accepts exactly one input.
greater-than N return kmers that occur more than N times in the input. accepts exactly one input.
equal-to N return kmers that occur exactly N times in the input. accepts exactly one input.
not-equal-to N return kmers that do not occur exactly N times in the input. accepts exactly one input.
increase X add X to the count of each kmer.
decrease X subtract X from the count of each kmer.
multiply X multiply the count of each kmer by X.
divide X divide the count of each kmer by X.
divide-round X divide the count of each kmer by X and round results. count < X will become 1.
modulo X set the count of each kmer to the remainder of the count divided by X.
union return kmers that occur in any input, set the count to the number of inputs with this kmer.
union-min return kmers that occur in any input, set the count to the minimum count
union-max return kmers that occur in any input, set the count to the maximum count
union-sum return kmers that occur in any input, set the count to the sum of the counts
intersect return kmers that occur in all inputs, set the count to the count in the first input.
intersect-min return kmers that occur in all inputs, set the count to the minimum count.
intersect-max return kmers that occur in all inputs, set the count to the maximum count.
intersect-sum return kmers that occur in all inputs, set the count to the sum of the counts.
subtract return kmers that occur in the first input, substracting counts from the other inputs
difference return kmers that occur in the first input, but none of the other inputs
symmetric-difference return kmers that occur in exactly one input
MODIFIERS:
output O write kmers generated by the present command to an output meryl database O
mandatory for count operations.
EXAMPLES:
Example: Report 22-mers present in at least one of input1.fasta and input2.fasta.
Kmers from each input are saved in meryl databases 'input1' and 'input2',
but the kmers in the union are only reported to the screen.
meryl print \
union \
[count k=22 input1.fasta output input1] \
[count k=22 input2.fasta output input2]
Example: Find the highest count of each kmer present in both files, save the kmers to
database 'maxCount'.
meryl intersect-max input1 input2 output maxCount
Example: Find unique kmers common to both files. Brackets are necessary
on the first 'equal-to' command to prevent the second 'equal-to' from
being used as an input to the first 'equal-to'.
meryl intersect [equal-to 1 input1] equal-to 1 input2
実行方法
1、Illuminaリードからmeryl DBを作る。k-mer長、スレッド数、使用メモリを設定し、IlluminaリードのR1とR2について、それぞれk-merをカウントする。
mkdir -p merqury_analysis
cd merqury_analysis
k=19
threads=24
memory=100
export OMP_NUM_THREADS=$threads
meryl k=$k memory=$memory count \
reads_R1.fastq.gz \
output reads_R1.k${k}.meryl
meryl k=$k memory=$memory count \
reads_R2.fastq.gz \
output reads_R2.k${k}.meryl
=> 入力されたFASTQファイルに含まれるk-merの出現回数を数え、Meryl形式のデータベースとして保存。Merylデータベースは単一のファイルではなく、複数のファイルを含む。
2、次に、R1とR2から作成したデータベースを、meryl union-sumで合算する。
meryl union-sum \
reads_R1.k${k}.meryl \
reads_R2.k${k}.meryl \
output reads.k${k}.meryl
union-sumは、2つのデータベースに含まれる同一k-merの出現回数を足し合わせる。merqury_analysis/reads.k19.meryl/をDBとする。
3、CPU数は環境変数で指定し、Merylデータベース、評価対象のアセンブリFASTA、出力名の順に指定してMerquryを実行する。
export OMP_NUM_THREADS=24
merqury.sh \
reads.k19.meryl \
assembly.fasta \
assembly_merqury
Merquryは、Illuminaリードに含まれる信頼性の高いk-merと、アセンブリに含まれるk-merを比較してリファレンスゲノムを使用せずにアセンブリの塩基精度や完全性を評価する。
主な出力
assembly_merqury.qv
assembly_merqury.completeness.stats
assembly_merqury.spectra-cn.*
assembly_merqury.qvには、アセンブリにのみ存在するk-merの割合から推定されたQVが出力される。QVが高いほど、アセンブリの推定塩基精度が高いことを示す。
assembly_merqury.completeness.statsには、Illuminaリード中の信頼できるk-merが、アセンブリにどの程度回収されているかが出力される。
assembly_merqury.spectra-cn.*には、リード中のk-mer出現頻度と、アセンブリ中のコピー数の関係を示したグラフが出力される。このグラフから、アセンブリに含まれていない配列や、ハプロタイプの重複、コピー数の過不足などを確認できる。
引用
Merqury: reference-free quality, completeness, and phasing assessment for genome assemblies
Arang Rhie, Brian P. Walenz, Sergey Koren & Adam M. Phillippy
Genome Biology volume 21, Article number: 245 (2020)
関連