使用二代數據或三代數據得到contig后,下一步就是將contig提升到染色體水平。對于二倍體物種而言,目前3D-DNA應該是組裝效果最好的一個軟件。
一:工作流程
使用3D-DNA做基因組組裝的整體流程如下圖,分別為組裝,Juicer分析Hi-C數據,3D-DNA進行scaffolding,使用JBAT對組裝結果進行手工糾正,最終得到準染色體水平的基因組。
二: 軟件安裝
在安裝之前,確保服務器上有了下面這些依賴軟件工具
- LastZ(僅在雜合基因組的二倍體模式下使用)
- Java >= 1.7
- GNU Awk >= 4.02
- GNU coreutils sort > 8.11
- Python >= 2.7
- scipy, numpy, matplotlib
- GNU Parallel >=20150322 (不必要,但是強力推薦)
- bwa
我們需要安裝兩個軟件,一個是3D-DNA,另一個是juicer。
CPU版本的juicer安裝
mkdir ~/soft
git clone https://github.com/theaidenlab/juicer.git
cd juicer
ln -s CPU scripts
cd scripts/common
wget https://hicfiles.tc4ga.com/public/juicer/juicer_tools.1.9.9_jcuda.0.8.jar
ln -s juicer_tools.1.9.9_jcuda.0.8.jar juicer_tools.jar
然后用~/soft/juicer/scripts/juicer.sh -h檢查是否有幫助信息輸出。
3D-DNA安裝
cd ~/soft
git clone https://github.com/theaidenlab/3d-dna.git
用sh ~/soft/3d-dna/run-asm-pipeline.sh -h查看是否有幫助文檔輸出。
參數詳解
以CPU版本的為例,juicer.sh的參數如下
Usage: juicer.sh [-g genomeID] [-d topDir] [-s site] [-a about] [-R end]
[-S stage] [-p chrom.sizes path] [-y restriction site file]
[-z reference genome file] [-D Juicer scripts directory]
[-b ligation] [-t threads] [-r] [-h] [-f] [-j]
參數說明:
- -g: 定義一個物種名
- -s: 酶切類型, HindIII(AAGCTAGCTT), MboI(GATCGATC) , DpnII(GATCGATC), NcoI(CCATGCATGG)
- -z : 參考基因組文件
- -y: 限制性酶切位點可能出現位置文件
- -p: 染色體大小文件
- -C: 將原來的文件進行拆分,必須是4的倍數,默認是90000000, 即22.5M reads
- -S: 和任務重運行有關,從中途的某一步開始,"merge", "dedup", "final", "postproc" 或 "early"
- -d: juicer的目錄 我們安裝在/soft/,所以設置為/soft/juicer
- -D: juicer scripts的目錄,我們安裝在/soft/,所以設置為/soft/juicer/CPU
- -a: 實驗的描述說明,可以不用設置
- -t: 線程數
如果你的基因組不是復雜基因組,比如說高雜合,高重復序列,或者Hi-C數據測太少,那么3d-dna的流程更加簡單, run-asm-pipeline.sh -h只有四個參數需要改:
- -i|--input: 過濾長度低于給定閾值的contig/scaffold, 默認是15000
- -r|--round: 基因組中misjoin的糾錯輪數,默認是2,當基因組比較準確時,設置為0,然后在JABT中調整會更好
- -m|--mode: 是否調用merge模塊,當且僅當在雜合度比較高的情況下使用,也就是組裝的單倍型基因組明顯偏大
- -s|--stage: 從polish, split, seal, merge 或finalize 的某一個階段開始
但是,一旦基因組復雜起來,那么需要調整的參數就非常多了, run-asm-pipeline.sh --help會輸出更多的信息,你需要根據當前結果去確定每個階段的參數應該如何調整。
最終的輸出文件最關鍵的是下面三類:
- .fasta: 以FINAL標記的是最終結果
- .hic: 各個階段都會有輸出結果,用于在JABT中展示
- .assembly: 各個階段都會有輸出,一共兩列,存放contig的組裝順序
三:分析流程
準備兩個數據:
- reference:存放一個genome.fa, 為組裝的contigs。
- fastq: 存放HiC二代雙端測序結果,read_R1_fastq.gz, read_R2_fastq.gz
有了這兩個數據就可以開始了。
1. 準備一個新的基因組
第一步:為基因組建索引
bwa index genome.fa
第二步: 根據基因組構建創建可能的酶切位點文件
python /data1/spider/ytbiosoft/soft/juicer/misc/generate_site_positions.py DpnII genome genome.fa
第三步: 運行如下命令, 獲取每條contig的長度
awk 'BEGIN{OFS="\t"}{print $1, $NF}' genome_DpnII.txt > genome.chrom.sizes
2.運行juicer
保證當前目錄下有fastq和reference文件夾,然后運行如下命令,一定要設置-z,-p,-y這三個參數
bash /data1/spider/ytbiosoft/soft/juicer/scripts/juicer.sh -g Arg_aqu -d /data1/spider/ytbiosoft/soft/juicer -D /data1/spider/ytbiosoft/soft/juicer/CPU -z /data1/spider/ytbiosoft/test/hic_aqu/reference/genome.fa -y /data1/spider/ytbiosoft/test/hic_aqu/reference/genome_DpnII.txt -p /data1/spider/ytbiosoft/test/hic_aqu/reference/genome.chrom.size -s DpnII -t 36
輸出的結果文件都在aligned目錄下,其中"merged_nodups.txt"就是下一步3D-DNA的輸入文件之一。
3. 運行3d-dna
3d-dna的運行也沒有多少參數可以調整,如果對組裝基因組質量的信心高,就用-r 0, 否則用默認的-r 2就行了。
~/soft/3d-dna/run-asm-pipeline.sh -r 2 reference/genome.fa aligned/merged_nodups.txt &> 3d.log &
然后在Juicer-Tools中對結果進行可視化,對可能的錯誤進行糾正。
最后輸出文件中,包含FINAL就是我們需要的結果。
4.使用juicerbox進行手工糾錯
關于juicerbox的用法,可以看hoptop的https://www.bilibili.com/video/av65134634
最常見的幾種組裝錯誤:
- misjoin: 切割
- translocations: 移動
- inversions: 翻轉
- chromosome boundaries: 確定染色體的邊界
這些錯誤的判斷依賴于經驗,所以只能靠自己多試試了。
最后輸出genome.review.assembly用于下一步的分析
5. 再次運行3d-dna
根據JABT手工糾正的結果, genome.review.assembly, 使用run-asm-pipeline-post-review.sh重新組裝基因組。
~/soft/3d-dna/run-asm-pipeline-post-review.sh \
-r genome.review.assembly genome.fa aligned/merged_nodups.txt &> 3d.log &
最后
假如你不小心設置了錯誤的-p參數,也不是特別的要緊,因為之后在最后階段(final) 才會遇到了下面這個報錯。
Could not find chromosome sizes file for: reference/genome.chrom.size
***! Can't find inter.hic in aligned/inter_30.hic
***! Error! Either inter.hic or inter_30.hic were not created
Either inter.hic or inter_30.hic were not created. Check aligned for results
即便遇到了這個報錯也不要緊,因為inter.hic 和 inter_30.hic在3d-dna流程中用不到,所以不需要解決。
如果需要解決的話,有兩個解決方案,一種重新運行命令,只不過多加一個參數-S final, 就會跳過之前的比對,合并和去重步驟,直接到后面STATISTICS環節。但是這樣依舊會有一些不必要的計算工作,所以另一種方法就是運行原腳本必要的代碼
juiceDir=~/soft/juicer
outputdir=aligned
genomePath=reference/genome.chrom.size
site_file=reference/genome_DpnII.txt
ligation=GATCGATC
# output is inter.hic
${juiceDir}/scripts/common/juicer_tools pre -f $site_file -s $outputdir/inter.txt -g $outputdir/inter_hists.m -q 1 $outputdir/merged_nodups.txt $outputdir/inter.hic $genomePath
# output is inter_30.txt
${juiceDir}/scripts/common/statistics.pl -s $site_file -l $ligation -o $outputdir/inter_30.txt -q 30 $outputdir/merged_nodups.txt
# output is inter_30.hic
${juiceDir}/scripts/common/juicer_tools pre -f $site_file -s $outputdir/inter_30.txt -g $outputdir/inter_30_hists.m -q 30 $outputdir/merged_nodups.txt $outputdir/inter_30.hic $genomePath
參考
http://www.lxweimin.com/p/0969e1001d3b
https://github.com/theaidenlab/3d-dna
https://github.com/aidenlab/juicer