用hifiasm組裝基因組

hifiasm大概是目前為止支持PacBio HiFi數(shù)據(jù)組裝的所有軟件中表現(xiàn)最優(yōu)異的軟件了。它不但能輸出primary assembly result,還能分別組裝出單倍體(haplotype)基因組的組裝結果。

今天的分享就從hifiasm的組裝開始,其他的組裝軟件之后也會介紹到。

可用資源

軟件安裝

hifiasm的安裝也非常簡單,conda一條命令就可以了

conda install hifiasm

運行hifiasm

純PacBio HiFi組裝

把命令寫到一個名為run_hifiasm.sh的腳本里

vim run_hifiasm.sh

只要填入最基本的

hifiasm \
-o test.hifisam \
-t 24 \
/path/to/PacBio/test1.hifi_reads.fastq.gz \
/path/to/PacBio/test2.hifi_reads.fastq.gz \
/path/to/PacBio/test3.hifi_reads.fastq.gz

用nohup掛在后臺運行就可以啦。

nohup bash run_hifiasm.sh &

輸出結果如下:

test.hifisam.ovlp.source.bin
test.hifisam.ovlp.reverse.bin
test.hifisam.ec.bin
test.hifisam.bp.r_utg.noseq.gfa
test.hifisam.bp.r_utg.lowQ.bed
test.hifisam.bp.r_utg.gfa 
test.hifisam.bp.p_utg.noseq.gfa
test.hifisam.bp.p_utg.lowQ.bed
test.hifisam.bp.p_utg.gfa
test.hifisam.bp.p_ctg.noseq.gfa
test.hifisam.bp.p_ctg.lowQ.bed
★  test.hifisam.bp.p_ctg.gfa
test.hifisam.bp.hap2.p_ctg.noseq.gfa
test.hifisam.bp.hap2.p_ctg.lowQ.bed
★  test.hifisam.bp.hap2.p_ctg.gfa
test.hifisam.bp.hap1.p_ctg.noseq.gfa
test.hifisam.bp.hap1.p_ctg.lowQ.bed
★  test.hifisam.bp.hap1.p_ctg.gfa

上面打了五角星的三個文件是后續(xù)重點關注的文件。根據(jù)
https://hifiasm.readthedocs.io/en/latest/interpreting-output.html的描述:

Hifiasm generates the following assembly graphs only with HiFi reads in default:
prefix.bp.p_ctg.gfa: assembly graph of primary contigs.
prefix.bp.hap1.p_ctg.gfa: partially phased contig graph of haplotype1.
prefix.bp.hap2.p_ctg.gfa: partially phased contig graph of haplotype2.

HiC data integrated Integrated

如果你有HiC數(shù)據(jù)(測基因組的話大概率會有HiC數(shù)據(jù)的吧?)可以嘗試基于HiC的證據(jù)的分型,primary的結果不會有什么變化,但是haplotype的結果會有提高。

hifiasm \
-o test.hifisam_hic \
-t 24 \
--h1 /path/to/HiC/1_R1.fastq.gz --h2 /path/to/HiC/1_R2.fastq.gz \
/path/to/PacBio/test1.hifi_reads.fastq.gz \
/path/to/PacBio/test2.hifi_reads.fastq.gz \
/path/to/PacBio/test3.hifi_reads.fastq.gz

格式轉(zhuǎn)換

用gfatools或者自己寫個腳本把gfa格式的文件轉(zhuǎn)換成fasta就得到最終的組裝結果啦。

如果寫腳本轉(zhuǎn)換

參考自:https://github.com/linsalrob/EdwardsLab/blob/master/bin/gfa2fasta.sh
(假設命名為gfa2fasta.sh

#!/usr/bin/env bash

if [ -z $1 ]; then 
    echo "Usage: $0 <gfa file>  >  <fasta file>"
    exit $E_BADARGS
fi

awk -v id=$1 '/^S/{print ">"id"_"$2"\n"$3}' $1

運行:

bash gfa2fasta.sh test.hifisam.bp.hap1.p_ctg.gfa > test.hifisam.bp.hap1.p_ctg.fasta

用gfatools轉(zhuǎn)換

先用conda安裝gfatools

conda install gfatools

接下來也寫一個如上的腳本方便使用(假設命名為gfa2fa.sh

#!/usr/bin/env bash

if [ -z $1 ]; then 
    echo "$0 <gfa file>"
    echo "It will generate the fasta file like ${1%.*}.fasta"
    exit $E_BADARGS
fi
gfatools gfa2fa ${1} > ${1%.*}.fasta

使用起來就很簡單啦:

bash gfa2fa.sh test.hifisam.bp.hap1.p_ctg.gfa

私貨時間

  1. 我曾經(jīng)嘗試過把多個PacBio HiFi的gz壓縮文件直接用cat給連接成一個文件然后去組裝,但是組裝結果和保持多個文件一起輸入給hifiasm的結果是不一樣的。cat到一起的結果的N50要略低于把三個文件分別輸給hifiasm的版本。我和老板冥思苦想了好一會兒沒想明白原因在哪兒,也就作罷了。所以建議如果有多個文件,就保持多個文件,不需要合并成一個。反正hifiasm是可以接受輸入多個文件的。
  2. 建議有HiC的情況下盡量加上HiC數(shù)據(jù),結果會更好一些。
  3. PacBio HiFi的組裝結果不需要再經(jīng)過其他的軟件polish,不像傳統(tǒng)的三代組裝軟件那樣流程冗長而繁瑣。

Hifiasm does not need polishing tools like pilon or racon, either.

引用自:(https://hifiasm.readthedocs.io/en/latest/index.html)

?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

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

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