全基因組 - 人類基因組變異分析(PacBio) (3)-- pbmm2

一. 長讀段比對 (Long-Read Mapping)常用的比對軟件

長讀段比對算法與一代/二代測序數據的比對算法有很大的不同,因為長讀段通常更長、包含更多錯誤和變異,并且需要更復雜的比對策略。

PacBio三代測序數據有很多比對軟件可供選擇,例如:

LASThttps://github.com/mcfrith/last-genome-alignments

BlasRhttps://github.com/mchaisso/blasr
BLASR是第一個針對PacBio序列的比對工具,2012年發表在《BMC Bioinformatics》期刊上,由PacBio研究團隊開發,最新版本停在2019.4.11,目前Google引用次數為1170(截止2023.10.25)。

BWA-MEMhttps://github.com/lh3/bwa
BWA老牌比對軟件了。BWA-MEM 是一種新的比對算法,用于將測序 reads 或者組裝后 contigs 比對至大型參考基因組,例如人參考基因組。它該算法對測序錯誤有良好的穩定性,適用的reads 長度范圍較廣,從70bp至幾Mb。

GraphMaphttps://github.com/isovic/graphmap

MECAThttps://github.com/xiaochuanle/MECAT
中山大學研究團隊開發的新工具MECAT,集超快比對、校正、組裝于一體,可提高三代測序數據序列比對,校正和組裝的運算速度,降低計算資源的消耗。

minimap2https://github.com/lh3/minimap2
Minimaps2是李恒大神在2018年發表在Bioinformatics上的一款針對三代數據開發的比對工具。

NGMLR: https://github.com/philres/ngmlr
NextGenMap-LR(ngmlr)主要用于三代測序的長reads(PacBio 、Oxford Nanopore)與參考基因組的比對。

pbmm2: https://github.com/PacificBiosciences/pbmm2 等等。

現在較為常用的是pbmm2minimap2NGMLR,其中pbmm2PacBio官方基于minimap2進行優化的版本。

二. pbmm2的使用教程

在得到sample.CCS.bam文件后, 因為HiFi數據質量較高,一把不需要額外的質控步驟,就可以將HiFi數據和下載的參考基因組序列進行比對了。

1.參考基因組的獲取

分析前,除測序數據外,我們還需準備對應物種的參考基因組fasta文件。對此可以根據自己研究的需要,在NCBI、Ensembl、UCSC等常見數據庫中進行下載。

主流的基因注釋版本有三種:RefSeq/Ensembl/UCSC
Refseq=NCBI;Ensembl=Gencode
Ensemble注釋更全面,Refseq適合那些不那么復雜的注釋。

對于人類和小鼠來說,我們還可以從Gencode數據庫中進行下載。Gencode綜合HAVANA和Ensembl數據庫中的信息,通過實驗手段加以驗證,從而構建了一個高質量的注釋信息數據庫。Gencode的注釋來源于兩部分。分別是Ensembl-Havana團隊生成的手動基因注釋和Ensembl-genebuild的自動基因注釋。

gencode中標識HAVANA來源的,這表示它是人工注釋的。但是這些注釋也有可能是由于Havana手動注釋和Ensembl自動注釋合并的結果;
而如果標識的是ENSEMBL,則表明這條注釋是由的確是Ensembl自動注釋得到的。

以下載人類參考基因組為例

Gencodehttps://www.gencodegenes.org/human/

圖1. Gencode人類參考基因組下載

點擊 圖1 所示的 fasta 連接即可下載完整的人類參考基因組(GRCh38.p14)。

Ensembl: https://useast.ensembl.org/Homo_sapiens/Info/Index

圖2. Ensembl人類參考基因組下載

點擊 圖2 所示的 Download DNA sequence (FASTA) 連接進入下載頁面,進一步選擇Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz , 即可下載完整的人類參考基因組(GRCh38.p14)。

注釋

Ensembl提供的參考基因組有2種組裝形式和3種重復序列處理方式,分別是primary,toplevel,unmasked(dna),soft-masked(dna_sm),masked(dna_rm)。一般選擇dna.primarydna_sm.primary

Toplevel: 這樣的數據包含了所有的序列區域(比如染色體、非染色體以及用大量N填充的單倍型haplotypes或基因組補丁patches區域),比如:Homo_sapiens.GRCh37.dna.toplevel.fa.gz

Primary Assembly: 在上面toplevel的基礎上,排除了單倍型或基因組補丁區域。如果看到目錄中不存在這種類型的數據(比如這里果蠅就沒有,而人類的基因組數據就存在),那么就意味著基因組不包含單倍型或基因組補丁區域,其實也就是等同于Toplevel.

dna:原原本本的DNA序列。
dna_rm(hard_mask):利用RepeatMasker工具將重復區域和低復雜度區域標記成一串N,會造成信息的丟失。
dna_sm(soft_mask):所有重復區域和低復雜度區域替換為小寫的堿基

RefSeqhttps://www.ncbi.nlm.nih.gov/datasets/taxonomy/9606/

圖3. Refseq人類參考基因組下載

點擊 圖3 中的Download即可下載人類基因參考組(GRCh38.p14)。

UCSC genome browser: https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/

圖4. UCSC人類基因組下載

點擊 圖4hg38.fa.gz即可下載人類基因參考組(GRCh38.p14)。

2. pbmm2安裝

#使用conda安裝pbmm2
$ conda install -c bioconda pbmm2

#安裝版本
v1.13.0
圖5. pbmm2 conda安裝

3. pbmm2使用

  • 建立人類參考基因組索引

Index: index reference and store as .mmi file
Usage: pbmm2 index [options] <ref.fa|xml> <out.mmi>
--preset 比對模式默認為CCS, 如果為CCS - HiFi數據,則不用設置

#建立基因組文件夾
$ mkdir human_ref
#將參考基因組GRCh38.fa拷入human_ref 文件夾, 進入human_ref
$ cd  human_ref

#進入參考基因組所在文件夾,對參考序列進行索引
$ pbmm2 index GRCh38.fa GRCh38.mmi   #此過程在我們計算服務上比較快

#如果運行時間較長,使用 nohup 加 & 將程序不掛斷運行并放入后臺
$ nohup pbmm2 index GRCh38.fa GRCh38.mmi &

  • 數據與人類參考基因組進行比對

Usage: pbmm2 align [options] <ref.fa|xml|mmi> <in.bam|xml|fa|fq> [out.aligned.bam|xml]
除了PacBio默認的 bam文件, fastq / fasta 作為輸入文件也是可以的。

#比對參考序列,-j -J 如果在服務器空閑時可以不指定
$ pbmm2 align --preset CCS --sort -j 24 -J 4 \
 --log-level INFO --log-file pbmm2.log --sample sample_name \
human_ref/GRCh38.mmi sample.ccs.bam sample.align.bam 

# --log-level INFO,給出基本mapping統計結果和時間
# --sample 指定樣品名稱;-j 指定比對線程;-J 8 指定排序步驟線程,8為最大;--sort 輸出排序后的bam,--preset選擇參數集-默認

pbmm2 index 幫助文檔

pbmm2 index - Index reference and store as .mmi file

Usage:
  pbmm2 index [options] <ref.fa|xml> <out.mmi>

  ref.fa|xml                STR   Reference FASTA, ReferenceSet XML
  out.mmi                   STR   Output Reference Index

Parameter Set Option:
  --preset                  STR   Set alignment mode. See below for preset parameter details. Valid choices: (SUBREAD,
                                  CCS, ISOSEQ, UNROLLED). [CCS]

Parameter Override Options:
  -k                        INT   k-mer size (no larger than 28). [-1]
  -w                        INT   Minimizer window size. [-1]
  -u,--no-kmer-compression        Disable homopolymer-compressed k-mer (compression is active for SUBREAD & UNROLLED
                                  presets).

  -h,--help                       Show this help and exit.
  --version                       Show application version and exit.
  -j,--num-threads          INT   Number of threads to use, 0 means autodetection. [0]
  --log-level               STR   Set log level. Valid choices: (TRACE, DEBUG, INFO, WARN, FATAL). [WARN]
  --log-file                FILE  Log to a file, instead of stderr.

Alignment modes of --preset:
    SUBREAD     : -k 19 -w 10
    CCS or HiFi : -k 19 -w 10 -u
    ISOSEQ      : -k 15 -w 5  -u
    UNROLLED    : -k 15 -w 15

Copyright (C) 2004-2023     Pacific Biosciences of California, Inc.
This program comes with ABSOLUTELY NO WARRANTY; it is intended for
Research Use Only and not for use in diagnostic procedures.

pbmm2 align幫助文檔

pbmm2 align - Align PacBio reads to reference sequences

Usage:
  pbmm2 align [options] <ref.fa|xml|mmi> <in.bam|xml|fa|fq|gz|fofn> [out.aligned.bam|xml]

  ref.fa|xml|mmi             STR    Reference FASTA, ReferenceSet XML, or Reference Index
  in.bam|xml|fa|fq|gz|fofn   STR    Input BAM, DataSet XML, FASTA, or FASTQ
  out.aligned.bam|xml        STR    Output BAM or DataSet XML

Basic Options:
  --chunk-size               INT    Process N records per chunk. [100]

Sorting Options:
  --sort                            Generate sorted BAM file.
  -m,--sort-memory           STR    Memory per thread for sorting. [768M]
  -J,--sort-threads          INT    Number of threads used for sorting; 0 means 25% of -j, maximum 8. [0]

Parameter Set Options:
  --preset                   STR    Set alignment mode. See below for preset parameter details. Valid choices:
                                    (SUBREAD, CCS, HIFI, ISOSEQ, UNROLLED). [CCS]

General Parameter Override Options:
  -k                         INT    k-mer size (no larger than 28). [-1]
  -w                         INT    Minimizer window size. [-1]
  -u,--no-kmer-compression          Disable homopolymer-compressed k-mer (compression is active for SUBREAD & UNROLLED
                                    presets).
  -A                         INT    Matching score. [-1]
  -B                         INT    Mismatch penalty. [-1]
  -z                         INT    Z-drop score. [-1]
  -Z                         INT    Z-drop inversion score. [-1]
  -r                         INT    Bandwidth used in chaining and DP-based alignment. [-1]
  -g                         INT    Stop chain enlongation if there are no minimizers in N bp. [-1]

Gap Parameter Override Options (a k-long gap costs min{o+k*e,O+k*E}):
  -o,--gap-open-1            INT    Gap open penalty 1. [-1]
  -O,--gap-open-2            INT    Gap open penalty 2. [-1]
  -e,--gap-extend-1          INT    Gap extension penalty 1. [-1]
  -E,--gap-extend-2          INT    Gap extension penalty 2. [-1]

IsoSeq Parameter Override Options:
  -G                         INT    Max intron length (changes -r). [-1]
  -C                         INT    Cost for a non-canonical GT-AG splicing (effective in ISOSEQ preset). [-1]
  --no-splice-flank                 Do not prefer splice flanks GT-AG (effective in ISOSEQ preset).

Read Group Options:
  --sample                   STR    Sample name for all read groups. Defaults, in order of precedence: SM field in
                                    input read group, biosample name, well sample name, "UnnamedSample".
  --rg                       STR    Read group header line such as '@RG\tID:xyz\tSM:abc'. Only for FASTA/Q inputs.

Identity Filter Options (combined with AND):
  -y,--min-gap-comp-id-perc  FLOAT  Minimum gap-compressed sequence identity in percent. [70]

Output Options:
  -l,--min-length            INT    Minimum mapped read length in basepairs. [50]
  -N,--best-n                INT    Output at maximum N alignments for each read, 0 means no maximum. [0]
  --strip                           Remove all kinetic and extra QV tags. Output cannot be polished.
  --split-by-sample                 One output BAM per sample.
  --unmapped                        Include unmapped records in output.
  --bam-index                STR    Generate index for sorted BAM output. Valid choices: (NONE, BAI, CSI). [BAI]
  --short-sa-cigar                  Populate SA tag with short cigar representation.

Input Manipulation Options (mutually exclusive):
  --median-filter                   Pick one read per ZMW of median length.
  --zmw                             Process ZMW Reads, subreadset.xml input required (activates UNROLLED preset).
  --hqregion                        Process HQ region of each ZMW, subreadset.xml input required (activates UNROLLED
                                    preset).

Sequence Manipulation Options:
  --collapse-homopolymers           Collapse homopolymers in reads and reference.

  -h,--help                         Show this help and exit.
  --version                         Show application version and exit.
  -j,--num-threads           INT    Number of threads to use, 0 means autodetection. [0]
  --log-level                STR    Set log level. Valid choices: (TRACE, DEBUG, INFO, WARN, FATAL). [WARN]
  --log-file                 FILE   Log to a file, instead of stderr.

Alignment modes of --preset:
    SUBREAD     : -k 19 -w 19    -o 5 -O 56 -e 4 -E 1 -A 2 -B 5 -z 400 -Z 50  -r 2000   -g 5000
    CCS or HiFi : -k 19 -w 19 -u -o 6 -O 26 -e 2 -E 1 -A 1 -B 4 -z 400 -Z 50  -r 2000   -g 5000
    ISOSEQ      : -k 15 -w 5  -u -o 2 -O 32 -e 1 -E 0 -A 1 -B 2 -z 200 -Z 100 -r 200000 -g 2000 -C 5 -G 200000
    UNROLLED    : -k 15 -w 15    -o 2 -O 32 -e 1 -E 0 -A 1 -B 2 -z 200 -Z 100 -r 2000   -g 10000

Copyright (C) 2004-2023     Pacific Biosciences of California, Inc.
This program comes with ABSOLUTELY NO WARRANTY; it is intended for
Research Use Only and not for use in diagnostic procedures.

小技巧:

  1. 如果擔心比對結果不佳,需要輸出未比對的reads進行排查,可以加上--unmapped參數2。
  2. 由于pbmm2生成的bam文件MD tag格式有些特別,無法用于后續的sniffles進行SV檢測。所以推薦使用pbsv進行后續SV檢測2。

5. 公共數據演示:

(1) 從gencode數據庫下載人類參考基因組, 進行pbmm2索引。

PacBio推薦人類參考基因組(詳細參照李恒博客),所以采用推薦基因組進行后續分析。

李恒2017年年底博客
https://lh3.github.io/2017/11/13/which-human-reference-genome-to-use

推薦的人類參考基因組:GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.gz

#新建文件夾
$ mkdir Human_ref

#下載參考基因組 GRCh38
$ wget -c -t 0 ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/001/405/GCA_000001405.15_GRCh38/seqs_for_alignment_pipelines.ucsc_ids/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.gz

#對參考基因組進行解壓
$ gunzip  GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.gz

#對參考基因組從新命名
$ mv GCA_000001405.15_GRCh38_no_alt_analysis_set.fna GRCh38.fa

#pbmm2 index
$ nohup pbmm2 index GRCh38.fa GRCh38.mmi 

(2) 下載示例數據。

Example Datasets
圖6所示:下載示例人類基因組數據。
德系猶太人家系:HG002(子)、HG003(父)、HG004(母),屬于個人基因組計劃中的樣本。

HG002_1m84011_220902_175841_s1.hifi_reads.bam
HG003m84010_220919_235306_s2.hifi_reads.bam
HG004m84010_220919_232145_s1.hifi_reads.bam

圖6. 示例數據下載

(3) 示例數據與人類參考基因組進行比對。

#HG002_1
$ nohup pbmm2 align --preset CCS --sort -j 24 -J 4 \
 --log-level INFO --log-file pbmm2.HG002_1.log --sample HG002_1 \
Human_ref/GRCh38.mmi m84011_220902_175841_s1.hifi_reads.bam HG002_1.align.bam &

#HG003
$ nohup pbmm2 align --preset CCS --sort -j 24 -J 4 \
 --log-level INFO --log-file pbmm2.HG003.log --sample HG003 \
Human_ref/GRCh38.mmi m84010_220919_235306_s2.hifi_reads.bam HG003.align.bam &

#HG004
$ nohup pbmm2 align --preset CCS --sort -j 24 -J 4 \
 --log-level INFO --log-file pbmm2.HG004.log --sample HG004 \
Human_ref/GRCh38.mmi m84010_220919_232145_s1.hifi_reads.bam HG004.align.bam &

Reference:

  1. 重測序數據分析(短序列的比對算法SNP/indel 和CNV/SV calling 方法)

  2. 神燈寶典之PB三代重測序分析實錄(一)

  3. 你可能不知道的基因組注釋文件冷知識

  4. 超精華生信ID總結,想踏入生信大門的你-值得擁有

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容