生信 | 基因組組裝實戰(zhàn)(四):組裝軟件mecat2、flye、wtdbg2、Canu、Falcon

寫在前面

  • 以下內(nèi)容均來自我在菲沙基因(Frasergen)暑期生信培訓班上記錄的課堂筆記

1.基因組概念

  • 基因組應該指單倍體細胞中包括編碼序列和非編碼序列在內(nèi)的全部DNA分子。即核基因組是單倍體細胞核內(nèi)的全部DNA分子;線粒體基因組則是一個線粒體所包含的全部DNA分子 ;葉綠體基因組則是一個葉綠體所包含的全部DNA分子。

2.三代PacBio數(shù)據(jù)準備

2.1 數(shù)據(jù)格式
  • Pacbio平臺測序出來的reads,由接頭序列, 條碼序列, 插入序列間隔線性分布,即ABIB-ABIB—ABIB-ABIB—(A: adapter, B: barcode, I: insert)
├── Sample
│ └── Library(不分文庫時文庫名為 all)
│ └── Cell
│ ├── *.subreads.bam 用于下游分析的有效數(shù)據(jù)(相當于clean data)
│ ├── *.subreads.bam.pbi subreads.bam文件的索引文件
│ └── *.xml 測序信息記錄文件
2.2 數(shù)據(jù)格式轉(zhuǎn)換(bam轉(zhuǎn)fq/fa)
conda install -c yuxiang bam2fastq -y
  • bam 轉(zhuǎn) fastq/ fasta(后綴自動補充為.fastq/ fasta)
bam2fastq *subreads.bam –o *subreads.bam -u
bam2fasta *subreads.bam –o *subreads.bam -u

-u:輸出文件不壓縮。去掉則輸出壓縮文件,由于后續(xù)需要用到非壓縮文件,所以這里加上-u參數(shù),且節(jié)省時間

  • 數(shù)據(jù)量統(tǒng)計(小工具:GNX)
#安裝與編譯
git clone https://github.com/mh11/gnx-tools.git
mkdir bin
javac -d bin/ src/uk/ac/ebi/gnx/*
ant -f package.xml
java -jar gnx.jar
#使用
java -jar gnx.jar all_subreads.bam.fasta > N50
cat N50

3.基因組組裝

3.1 使用Mecat2進行基因組組裝
  • 軟件介紹
Mecat2軟件介紹
  • 使用git安裝并編譯
git clone https://github.com/xiaochuanle/MECAT2.git 
cd MECAT2 
make 
  • 新建配置文件config_file.txt
vi config_file.txt
  • 填寫內(nèi)容如下:
PROJECT=test
RAWREADS= /local_data1/all_subreads.bam.fasta #從bam轉(zhuǎn)過來的fasta文件
GENOME_SIZE= 12251230  #根據(jù)《生信 | 基因組組裝實戰(zhàn)(三):Kmer評估基因組》來確定
THREADS=15   #線程數(shù)
MIN_READ_LENGTH=2000 
CNS_OVLP_OPTIONS="-kmer_size 13" 
CNS_PCAN_OPTIONS="-p 100000 -k 100" CNS_OPTIONS="" 
CNS_OUTPUT_COVERAGE=30  #根據(jù)菲沙基因老師的經(jīng)驗,30-45范圍較好,可以多次調(diào)整
TRIM_OVLP_OPTIONS="-skip_overhang" 
TRIM_PM4_OPTIONS="-p 100000 -k 100" 
TRIM_LCR_OPTIONS="" 
TRIM_SR_OPTIONS="" 
ASM_OVLP_OPTIONS="" 
FSA_OL_FILTER_OPTIONS="--max_overhang=-1 --min_identity=-1" 
FSA_ASSEMBLE_OPTIONS="" 
CLEANUP=0

\color{red}{注}:以上\color{red}{\#}前面的內(nèi)容根據(jù)自己的需求修改,其他默認即可

  • 保存配置后,運行程序\color{green}{mecat.pl}
MECAT2/Linux-amd64/bin/mecat.pl correct config_file.txt
MECAT2/Linux-amd64/bin/mecat.pl assemble config_file.txt
  • MECAT2運行結(jié)果
    【4-fsa】目錄下的【contigs.fasta】為結(jié)果文件


    MECAT2運行結(jié)果
3.2 使用Flye進行基因組組裝
  • 軟件簡介
Flye軟件簡介
  • 使用git安裝并編譯
git clone https://github.com/fenderglass/Flye
cd Flye
make
  • 使用方法
Flye/bin/flye \
--pacbio-raw 
/local_data1/all_subreads.bam.fasta \
--out-dir test \
--genome-size 12251230 \  #根據(jù)需要請修改
--threads 10
  • 結(jié)果文件
Flye結(jié)果文件
3.3 使用wtdbg2進行基因組組裝
  • 軟件簡介
wtdbg2軟件簡介
  • 使用git安裝并編譯
git clone https://github.com/ruanjue/wtdbg2 
cd wtdbg2
make
  • 軟件使用
#quick start with wtdbg2.pl 
./wtdbg2.pl -t 16 -x rs -g 12m -o dbg reads.fa 
# Step by step commandlines # assemble long reads 
./wtdbg2 -x rs -g 4.6m -i reads.fa.gz -t 16 -fo dbg 
# derive consensus 
./wtpoa-cns -t 16 -i dbg.ctg.lay.gz -fo dbg.raw.fa 
# polish consensus, not necessary if you want to polish the assemblies using other tools 
minimap2 -t16 -ax map-pb -r2k dbg.raw.fa reads.fa.gz | samtools sort -@4 >dbg.bam 
samtools view -F0x900 dbg.bam | ./wtpoa-cns -t 16 -d dbg.raw.fa -i - -fodbg.cns.fa 
# Addtional polishment using short reads 
bwa index dbg.cns.fa 
bwa mem -t 16 dbg.cns.fa sr.1.fa sr.2.fa | samtools sort -O SAM | ./wtpoa-cns -t 16 -x 
sam-sr -d dbg.cns.fa -i - -fo dbg.srp.fa
  • 結(jié)果文件
wtdbg2結(jié)果文件
3.4 使用Canu進行基因組組裝
Canu運行流程
  • 使用conda安裝
conda install -c bioconda canu -y
  • 軟件使用,來源不同的數(shù)據(jù)使用不同代碼
#For PacBio:
canu -p ecoli -d ecoli-pacbio genomeSize=4.8m -pacbio-raw pacbio.fastq
#For Nanopore:
canu -p ecoli -d ecoli-oxford genomeSize=4.8m -nanopore-raw oxford.fasta
#Assembling PacBio HiFi with HiCanu:
canu -p asm -d ecoli_hifi genomeSize=4.8m -pacbio-hifi ecoli.fastq
#Trio Binning Assembly:
canu -p asm -d ecoliTrio genomeSize=5m \
 -haplotype K12 K12.parental.fasta \
 -haplotype O157 O157.parental.fasta \
 -pacbio-raw F1.fasta

-p 指定輸出前綴
-d 指定輸出結(jié)果目錄
genomeSize 設置一個預估的基因組大小,便于讓Canu估計測序深度,單位是K,M,G
maxThreads 設置最大線程數(shù)
-pacbio-raw 直接測序得到的原始pacbio數(shù)據(jù)
-pacbio-corrected 經(jīng)過糾正的pacbio數(shù)據(jù)
-nanopore-raw 原始的nanopore數(shù)據(jù)
-nanopore-corrected 結(jié)果糾正的nanopore數(shù)據(jù)
rawErrorRate 設置兩個未糾錯read之間最大期望差異堿基數(shù)
correctedErrorRate 設置糾錯后read之間最大期望差異堿基數(shù)
minReadLength 設置最小使用的reads長度
minOverlapLength 設置Overlap的最小長度

3.5 使用Falcon進行基因組組裝
falcon軟件組裝原理
  • 使用conda安裝軟件
conda install -c conda-forge falcon -y
  • 軟件使用,和mecat2一樣,關鍵就是弄好配置文件。比較好的做法是去官網(wǎng)下載合適的配置文件,然后將其中的某些參數(shù)稍加修改即可。如我下載植物的fc_run_plant.cfg
wget https://pb-falcon.readthedocs.io/en/latest/_downloads/fc_run_plant.cfg
cat fc_run_plant.cfg
[General]
input_fofn = input.fofn
input_type = raw
stop_all_jobs_on_failure = False
length_cutoff = 5000
genome_size = 1400000000
seed_coverage = 30
length_cutoff_pr = 4000
sge_option_da = -pe smp 5 -q bigmem
sge_option_la = -pe smp 20 -q bigmem
sge_option_pda = -pe smp 6 -q bigmem 
sge_option_pla = -pe smp 16 -q bigmem
sge_option_fc = -pe smp 24 -q bigmem
sge_option_cns = -pe smp 12 -q bigmem
pa_concurrent_jobs = 96
cns_concurrent_jobs = 96
ovlp_concurrent_jobs = 96
pa_HPCdaligner_option =  -v -B128 -M32 -e.70 -l4800 -s100 -k18 -h480 -w8 
ovlp_HPCdaligner_option = -v -B128 -M32 -h1024 -e.96 -l2400 -s100 -k18
#下面兩行其中的參數(shù)在下面介紹
pa_DBsplit_option = -a -x500 -s400
ovlp_DBsplit_option = -s400
falcon_sense_option = --output_multi --min_idt 0.70 --min_cov 2 --max_n_read 200 --n_core 8 
falcon_sense_skip_contained = True
overlap_filtering_setting = --max_diff 100 --max_cov 100 --min_cov 2 --n_core 12

常規(guī)參數(shù):
input_fofn = input.fofn 指出所有輸入數(shù)據(jù),路徑+文件名
input_type = raw ( 或preads ) 標明序列類型,即是否已經(jīng)完成了錯誤修正
length_cutoff = 10000 用于錯誤修正的種子序列的最低長度
length_cutoff_pr = 10000 用于構(gòu)建重疊的預組裝種子序列的最低長度
b 如果基因組組分有偏好性(例如65% AT rich)應該設置b參數(shù)。
M 參數(shù)控制內(nèi)存, l默認是1000,低于這個長度的序列丌用比對
S 默認是100,輸出點也可以設置成500提高速度,也有1000
E 準確性默認是0.7一般的設置成0.75
B 參數(shù)決定一個job中包含的block之間比對的數(shù)目
T 參數(shù)是控制在一個block里一個kmer出現(xiàn)的最多次數(shù),這個參數(shù)有的設置8,12,16.這個值
越小速度越快。
k(kmer) 要小于32,線程數(shù)目T默認是4.

  • 保存配置文件后,直接執(zhí)行fc_run.py腳本即可
fc_run.py fc_run.cfg
  • 結(jié)果文件較多,具體在官網(wǎng)查看,組裝的結(jié)果文件在下面
falcon_job/
    ├── 0-rawreads/     # Raw read error correction directory
組裝報告   └── report/   # pre-assembly stats
    ├── 1-preads_ovl/   # Corrected read overlap detection
    ├── 2-asm-falcon/   # String Graph Assembly
結(jié)果文件   └── a_ctg_all.fa   # all associated contigs, including duplicates
結(jié)果文件   └── a_ctg.fa    # De-duplicated associated fasta file
    ├── mypwatcher/     # Job scheduler logs
    ├── scripts/
    └── sge_log/        # deprecated

寫在最后

  • 本文一共介紹了5款軟件,但以后肯定還會有更多更優(yōu)秀的軟件,但原理和用法都相差不大,我們總歸是要選擇一個作為我們后續(xù)的分析,如何選?
    \color{red}{1.contig\ N50長的}
    \color{red}{2.連續(xù)性好的}
    \color{red}{3.各項指標符合要求的等}
  • 組裝完成后,就要對組裝結(jié)果進行矯正,下一節(jié)介紹。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容