基因注釋:基于SNAP+Augustus+GeneMark的maker3 pipeline

我使用的maker版本為3.01.04

第一輪:將已知基因比對(duì)到基因組

包括兩個(gè)部分:
??屏蔽重復(fù)序列
??將已知的轉(zhuǎn)錄組/蛋白序列與基因組進(jìn)行比對(duì)

1.(可選)構(gòu)建自定義重復(fù)序列數(shù)據(jù)庫

安裝RepeatModeler
RepeatModeler Download Page (repeatmasker.org)
RepeatModeler的安裝(包含RepeatMasker安裝)_nnnnnnny-的博客-CSDN博客_repeatmodeler安裝

/path/RepeatModeler/BuildDatabase -name pyu pyu_contig.fasta
RepeatModeler -pa 4 -database pyu -LTRStruct >& repeatmodeler.log

運(yùn)行結(jié)束后獲得pyu-families.fa,將其提供給maker_opts.ctl文件的“rmlib= ”選項(xiàng)

2.創(chuàng)建maker控制文件
maker -CTL
#將創(chuàng)建三個(gè)控制文件:maker_boopts.ctl、maker_exe.ctl、maker_opts.ctl
3.修改控制文件maker_opts.ctl
vi maker_opts.ctl

genome=pyu_contig.fasta

est=unigene.fasta #從頭組裝的轉(zhuǎn)錄組序列
protein=protein.fasta #uniprot中下載的同源蛋白序列

rmlib=pyu-families.fa
softmask=1 #軟屏蔽,將重復(fù)序列轉(zhuǎn)為小寫而不是N,因此基因內(nèi)的短重復(fù)序列仍然可以作為基因的一部分進(jìn)行注釋

est2genome=1 #使用轉(zhuǎn)錄組證據(jù)
protein2genome=1 #使用同源蛋白證據(jù)

TMP=/workdir/tmp  #對(duì)于大型基因組來說很重要

??如果單獨(dú)運(yùn)行RepeatMasker,如https://gist.github.com/darencard/bb1001ac1532dd4225b030cf0cd61ce2
中所述,“rmlib”選項(xiàng)應(yīng)不填,“rm_gff”選項(xiàng)應(yīng)該填寫重復(fù)序列的gff文件

maker -base pyu_rnd1 maker_opts.ctl maker_bopts.ctl maker_exe.ctl
第二輪——使用SNAP進(jìn)行基因預(yù)測(cè)
1.訓(xùn)練SNAP基因模型

首先使用上一輪產(chǎn)生的比對(duì)結(jié)果進(jìn)行訓(xùn)練

mkdir SNAP1
cd SNAP1
gff3_merge -d ../pyu_rnd1.maker.output/pyu_rnd1_master_datastore_index.log
maker2zff -l 50 -x 0.5 pyu_rnd1.all.gff

??maker2zff生成一個(gè)ZFF格式文件(genome.ann)和一個(gè)FASTA格式文件(genome.dna),過濾用于再次訓(xùn)練的高置信度基因,共有7個(gè)選項(xiàng):
-c 由EST/mRNA-Seq比對(duì)確定的剪接位點(diǎn)的比例,默認(rèn)0.5
-e 與EST/mRNA-Seq比對(duì)重疊的外顯子的比例,默認(rèn)0.5
-o 和任何證據(jù)(EST或者蛋白)重疊的外顯子的比例,默認(rèn)0.5
-a 從頭預(yù)測(cè)證實(shí)的剪接位點(diǎn)的比例,默認(rèn)0
-t 和從頭預(yù)測(cè)結(jié)果重疊的外顯子的比例,默認(rèn)0
-l mRNA翻譯的蛋白質(zhì)序列的最短長度
-x 最大AED值,默認(rèn)0.5
-n 不過濾
??AED值:maker2使用注釋編輯距離(AED)來評(píng)估基因組注釋的準(zhǔn)確性,AED是一個(gè)介于 0 和 1 之間的數(shù)字,衡量注釋與支持它的evidence的擬合優(yōu)度,0 表示與可用證據(jù)完全一致,1 表示缺乏對(duì)注釋基因模型的支持

fathom -categorize 1000 genome.ann genome.dna #過濾
fathom -export 1000 -plus uni.ann uni.dna
forge export.ann export.dna
hmm-assembler.pl pyu . > ../pyu1.hmm
mv pyu_rnd1.all.gff ../
cd ..
2.使用SNAP預(yù)測(cè)基因

為第一輪的maker_opts.ctl 保存副本

cp maker_opts.ctl maker_opts.ctl_backup_rnd1

編輯第二輪的maker_opts.ctl

vi maker_opts.ctl 

maker_gff= pyu_rnd1.all.gff
est_pass=1 # 使用第一輪的EST比對(duì)結(jié)果
protein_pass=1 #使用第一輪的protein比對(duì)結(jié)果
rm_pass=1 # 使用gff文件中的repeats
snaphmm=pyu1.hmm
est= # 刪除est文件,這一步不需要再跑EST比對(duì)了
protein= # 同上
model_org= #同上
rmlib= # 同上
repeat_protein= #同上
est2genome=0 # 不需要再構(gòu)建基于EST證據(jù)的基因模型
protein2genome=0 #同上
pred_stats=1 #report AED stats
alt_splice=0 # 0: keep one isoform per gene; 1: identify splicing variants of the same gene
keep_preds=1 # keep genes even without evidence support, set to 0 if no

運(yùn)行maker

maker -base pyu_rnd2 maker_opts.ctl maker_bopts.ctl maker_exe.ctl
第三輪——重新訓(xùn)練SNAP模型并進(jìn)行另一輪SNAP基因預(yù)測(cè)

SNAP一共需要運(yùn)行2~3輪
1.首先訓(xùn)練一個(gè)新的SNAP模型

mkdir SNAP2
cd SNAP2
gff3_merge -d ../pyu_rnd2.maker.output/pyu_rnd2_master_datastore_index.log
maker2zff -l 50 -x 0.5 pyu_rnd2.all.gff

fathom -categorize 1000 genome.ann genome.dna
fathom -export 1000 -plus uni.ann uni.dna
forge export.ann export.dna
hmm-assembler.pl pyu . > ../pyu2.hmm
mv pyu_rnd2.all.gff ..
cd ..

2.使用SNAP預(yù)測(cè)基因
為第二輪的maker_opts.ctl 保存副本

cp maker_opts.ctl maker_opts.ctl_backup_rnd2

編輯第三輪的maker_opts.ctl

vi maker_opts.ctl 

maker_gff=pyu_rnd2.all.gff
snaphmm=pyu2.hmm

運(yùn)行maker

maker -base pyu_rnd3 maker_opts.ctl maker_bopts.ctl maker_exe.ctl
第四輪——訓(xùn)練AUGUSTUS模型
1.格式轉(zhuǎn)換
mkdir augustus1
cd augustus1
gff3_merge -d ../pyu_rnd1.maker.output/pyu_rnd1_master_datastore_index.log

過濾gff文件,只保留maker注釋

awk '{if ($2=="maker") print }' pyu_rnd1.all.gff > maker_rnd1.gff

將maker_rnd1.gff和pyu_contig.fasta轉(zhuǎn)為Genbank格式的文件pyu.gb
保留每個(gè)基因上下游2000bp的序列用于訓(xùn)練模型

gff2gbSmallDNA.pl maker_rnd1.gff pyu_contig.fasta 2000 pyu.gb

檢查訓(xùn)練集中的基因數(shù)目

grep -c LOCUS pyu.gb 
2.開始訓(xùn)練

首先創(chuàng)建一個(gè)Augustus新物種

new_species.pl --species=pyu

初始訓(xùn)練

etraining --species=pyu pyu.gb

檢查初始模型是否存在

ls -ort $AUGUSTUS_CONFIG_PATH/species/pyu

創(chuàng)建一個(gè)更小的測(cè)試集pyu.gb.evaluation,便于在優(yōu)化前后進(jìn)行評(píng)估

randomSplit.pl pyu.gb 200
mv pyu.gb.test pyu.gb.evaluation

預(yù)測(cè)測(cè)試集中的基因,并檢查結(jié)果

augustus --species=pyu pyu.gb.evaluation >& first_evaluate.out
grep -A 22 Evaluation first_evaluate.out

示例:

*******      Evaluation of gene prediction     *******

---------------------------------------------\
                 | sensitivity | specificity |
---------------------------------------------|
nucleotide level |       0.873 |       0.626 |
---------------------------------------------/

----------------------------------------------------------------------------------------------------------\
           |  #pred |  #anno |      |    FP = false pos. |    FN = false neg. |             |             |
           | total/ | total/ |   TP |--------------------|--------------------| sensitivity | specificity |
           | unique | unique |      | part | ovlp | wrng | part | ovlp | wrng |             |             |
----------------------------------------------------------------------------------------------------------|
           |        |        |      |                253 |                101 |             |             |
exon level |    484 |    332 |  231 | ------------------ | ------------------ |       0.696 |       0.477 |
           |    484 |    332 |      |   35 |    0 |  218 |   36 |    0 |   65 |             |             |
----------------------------------------------------------------------------------------------------------/

----------------------------------------------------------------------------\
transcript | #pred | #anno |   TP |   FP |   FN | sensitivity | specificity |
----------------------------------------------------------------------------|
gene level |   156 |   100 |   47 |  109 |   53 |        0.47 |       0.301 |
----------------------------------------------------------------------------/

??100個(gè)基因中有47個(gè)被準(zhǔn)確預(yù)測(cè)
??69.6%的外顯子被準(zhǔn)確預(yù)測(cè)
??47.7%預(yù)測(cè)的外顯子在測(cè)試集中確切存在

優(yōu)化模型,該步驟極其耗時(shí)

randomSplit.pl pyu.gb 1000
optimize_augustus.pl --species=pyu --kfold=24 --cpus=24 --rounds=3 --onlytrain=pyu.gb.train pyu.gb.test 

優(yōu)化后再次訓(xùn)練

etraining --species=pyu pyu.gb

使用優(yōu)化后的模型評(píng)估測(cè)試集,并檢查結(jié)果

augustus --species=pyu pyu.gb.evaluation >& second_evaluate.out
grep -A 22 Evaluation second_evaluate.out

在這些步驟之后,物種模型位于目錄 augustus_config/species/pyu 中

3.使用新的 augustus 模型運(yùn)行 maker
vi maker_opts.ctl

maker_gff= pyu_rnd1.all.gff
est_pass=1 # use est alignment from round 1
protein_pass=1 #use protein alignment from round 1
rm_pass=1 # use repeats in the gff file
augustus_species=pyu # augustus species model you just built
est= # remove est file, do not run EST blast again
protein= # remove protein file, do not run blast again
model_org= #remove repeat mask model, so not running RM again
rmlib= # not running repeat masking again
repeat_protein= #not running repeat masking again
est2genome=0 # do not do EST evidence based gene model
protein2genome=0 # do not do protein based gene model.
pred_stats=1 #report AED stats
alt_splice=0 # 0: keep one isoform per gene; 1: identify splicing variants of the same gene
keep_preds=1 # keep genes even without evidence support, set to 0 if no
maker -base pyu_rnd4 maker_opts.ctl maker_bopts.ctl maker_exe.ctl
第五輪——訓(xùn)練GeneMark

GeneMark訓(xùn)練只需要基因組組裝文件

gmes_petap.pl -ES -fungus -cores 10 -sequence pyu_contig.fasta

將生成的gmhmm.mod添加到maker_opts.ctl文件中

vi maker_opts.ctl

gmhmm=gmhmm.mod

最后一次運(yùn)行maker

maker -base pyu_rnd5 maker_opts.ctl maker_bopts.ctl maker_exe.ctl
六、最后的整合
gff3_merge -n -d ../pyu_rnd5.maker.output/pyu_rnd5_master_datastore_index.log
fasta_merge -d pyu_rnd5.maker.output/pyu_rnd5_master_datastore_index.log

獲得一個(gè)不包含基因組序列的gff3 文件:pyu_rnd5.all.gff,以及一系列蛋白質(zhì)和轉(zhuǎn)錄組fasta 文件。

maker最終結(jié)果

tips:要使基因名稱更短,可使用以下命令:
maker_map_ids --prefix pyu_ --justify 8 --iterate 1 pyu_rnd5.all.gff > id_map
map_gff_ids id_map pyu_rnd5.all.gff
map_fasta_ids id_map pyu_rnd5.all.maker.proteins.fasta
map_fasta_ids id_map pyu_rnd5.all.maker.transcripts.fasta
參考文章:https://biohpc.cornell.edu/doc/annotation_2019_exercises1_v2.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容