macでインフォマティクス

macでインフォマティクス

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

疑わしいスプライスジャンクションをフィルタリングし、2パスで再アライメントをガイドする 2passtools

 

真核生物のゲノムの転写には、RNAの複雑な代替処理が関与している。ロングリードを用いた完全長RNAのシーケンスは、処理の真の複雑さを明らかにする。しかし、ロングリードシーケンス技術の比較的高いエラー率は、イントロン同定の精度を低下させる可能性がある。ここでは、アライメントメトリクスと機械学習によって得られた配列情報を適用して、ロングリードのアライメントから疑わしいスプライスジャンクションをフィルタリングし、残りのジャンクションを使用して、2パスアプローチでの再アライメントをガイドする方法を紹介する。この方法は、ソフトウェアパッケージ2passtools(https://github.com/bartongroup/2passtools)で利用可能であり、既存の高品質アノテーションの有無にかかわらず、種のスプライスアライメントとトランスクリプトームアセンブリの精度を向上させる。

 

 

インストール

ubuntu18.04にてmambaで環境を作ってテストした。

Github

#conda、ここでは高速なmambaを使う
git clone https://www.github.com/bartongroup/2passtools
cd 2passtools
mamba env create -f 2passtools.yml -n 2passtools
conda activate 2passtools

#pip (レポジトリのsetup.pyを読み取る)
pip install git+git://github.com/bartongroup/2passtools.git

>  2passtools

 

Usage: 2passtools [OPTIONS] COMMAND [ARGS]...

 

Options:

--help Show this message and exit.

 

Commands:

filter 2passtools filter: Convenience tool to filter a junction bed and...

merge 2passtools merge: Merges bed files produced by 2passtools score...

mm2pass

score 2passtools score: A tool for extracting and scores junctions

from...

> 2passtools filter --help

Usage: 2passtools filter [OPTIONS] BED_FN

 

2passtools filter: Convenience tool to filter a junction bed and produce

6-column bed format which is compatible with minimap2.

 

Options:

-o, --output-bed-fn TEXT [required]

--exprs TEXT

-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG

--help Show this message and exit.

 

>  2passtools merge --help

Usage: 2passtools merge [OPTIONS] BED_FNS...

 

2passtools merge: Merges bed files produced by 2passtools score on

individual replicates and recalculates junction strength metrics. Can be

used to create a unified junction set to realign reads from different

replicates.

 

Bed files should be in the 13 column format produced by 2passtools score.

 

Options:

-o, --output-bed-fn TEXT Output file path [required]

-f, --ref-fasta-fn TEXT Path to the fasta file that reads were

mapped to [required]

 

-a, --annot-bed-fn TEXT Optional BED file containing annotated

junctions

 

-j, --jad-size-threshold INTEGER

JAD to threshold at in the decision tree

-d, --primary-splice-local-dist INTEGER

Distance to search for alternative

donor/acceptors when calculating primary d/a

 

-m, --canonical-motifs TEXT Intron motifs considered canonical in

organism. Should be four char DNA motifs

separated by vertical bar only

 

-w, --lr-window-size INTEGER Sequence size to extract to train logistic

regression models

 

-k, --lr-kfold INTEGER Number of cross validation k-folds for

logistic regression models

 

-lt, --lr-low-confidence-threshold FLOAT

Logistic regression low confidence threshold

for decision tree 2

 

-ht, --lr-high-confidence-threshold FLOAT

Logistic regression high confidence

threshold for decision tree 2

 

-c, --classifier-type [decision_tree|random_forest]

When annotated juncs are available, train

this classifier type

 

--keep-all-annot / --filter-annot

When annotated juncs are available, always

keep all annotated juncs

 

-p, --processes INTEGER

-s, --random-seed INTEGER

-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or

DEBUG

 

--help Show this message and exit.

>  2passtools mm2pass --help

Usage: 2passtools mm2pass [OPTIONS]

 

Options:

-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG

--help Show this message and exit. 

> 2passtools score --help

Usage: 2passtools score [OPTIONS] BAM_FN

 

2passtools score: A tool for extracting and scores junctions from a bam

file aligned with minimap2. Filtered junctions can be used to realign

reads in a second pass with minimap2.

 

Bam file must be mapped with minimap2 and have the long form CS tag, e.g.

 

minimap2 -a --cs=long -k14 -x splice ref.fa reads.fq

 

Options:

-o, --output-bed-fn TEXT Output file path [required]

-f, --ref-fasta-fn TEXT Path to the fasta file that reads were

mapped to [required]

 

-a, --annot-bed-fn TEXT Optional BED file containing annotated

junctions

 

-j, --jad-size-threshold INTEGER

JAD to threshold at in the decision tree

-d, --primary-splice-local-dist INTEGER

Distance to search for alternative

donor/acceptors when calculating primary d/a

 

-m, --canonical-motifs TEXT Intron motifs considered canonical in

organism. Should be four char DNA motifs

separated by vertical bar only

 

-w, --lr-window-size INTEGER Sequence size to extract to train logistic

regression models

 

-k, --lr-kfold INTEGER Number of cross validation k-folds for

logistic regression models

 

-lt, --lr-low-confidence-threshold FLOAT

Logistic regression low confidence threshold

for decision tree 2

 

-ht, --lr-high-confidence-threshold FLOAT

Logistic regression high confidence

threshold for decision tree 2

 

-c, --classifier-type [decision_tree|random_forest]

When annotated juncs are available, train

this classifier type

 

--keep-all-annot / --filter-annot

When annotated juncs are available, always

keep all annotated juncs

 

--stranded / --unstranded Whether input data is stranded or

unstranded. direct RNA is stranded, cDNA

often isn't

 

-p, --processes INTEGER

-s, --random-seed INTEGER

-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or

DEBUG

 

--help Show this message and exit.

 

 

実行方法

 2passtools scoreコマンドは、入力として、minimap2 (紹介) を用いてアラインメントされたロングリードシーケンスのbamファイルと、リファレンスのfastaファイルを要求する。bamにはCS tag (format)がついている必要がある。2passtoolsはジャンクションメトリクスと配列情報を抽出し、それを用いてアライメントで見つかったスプライスジャンクションをスコアリングする。

minimap2 -t 38 --cs=long -ax splice -k14 genome.fa long-reads.fa |samtools sort -O BAM -@ 8 > aln.bam && samtools index -@ 4 aln.bam

2passtools score -f assembly.fasta -o out.bed aln.bam

 出力は13フィールドあるジャンクション情報のBEDファイル。このフォーマットはまだフィルタリングされておらず、6カラムのBEDファイルを必要とするminimap2では余分なカラムフォーマットがサポートされていないため、直接minimap2に渡すことはできない。しかし2passtoolsのフィルタを使ってフィルタリングと再フォーマットを行うことができるようになっている。

 

 2passtoolsのfilterコマンドを使って13BEDフィールドファイルをフィルタリングする。

 2passtools filter out.bed -o filtered.bed

 6カラムのBEDファイルが出力される。

 

 

 Githubより

すでに参照アノテーションがあるが、新しいスプライスジャンクションを発見したい場合は、2passtools scoreのアノテーション支援モードの使用を検討する。このモードでは、既存のリファレンスアノテーションから信頼度の高いスプライスジャンクションを含むBEDファイルを追加入力する。2passtoolsは、新規のスプライスジャンクションを検出するde novoモデルを訓練するために、これらをポジティブ例として使用する。既存のアノテーションが比較的完全であるが、かなりの数の新規スプライスジャンクションがある場合に最適である。アノテーションがあまりにも不完全な場合は、事前に訓練されたモデルを使用して2passtoolsを実行する方が良い。新規スプライスジャンクションが非常に少ない場合は、(2passtoolsを使用せずに)リファレンスガイドアライメントを行う方が良いだろう。Genome Biologyの論文には、判断の助けとなるような実験結果が掲載されている。

引用

2passtools: two-pass alignment using machine-learning-filtered splice junctions increases the accuracy of intron detection in long-read RNA sequencing
Matthew T. Parker, Katarzyna Knop, Geoffrey J. Barton & Gordon G. Simpson
Genome Biology volume 22, Article number: 72 (2021)