天天看點

GATK 軟體分析流程

1. 準備

A) 使用 OSS 存儲

要在批量計算上運作 GATK,輸入、輸出檔案都需要儲存在 OSS。是以,需要先開通 OSS 并建立好 Bucket。

注意:建立 Bucket 的區域,需要和運作批量計算的 GATK 區域一緻。

B) 安裝 batchcompute-cli 指令行工具

pip install batchcompute-cli           

安裝完成後,還需要 配置 。

注意:目前最佳實踐中使用的 GATK 相關軟體版本資訊如下:

  GATK: 4.0.0.0

  picard: 2.13.2

  genomes-in-the-cloud: 2.3.0-1501082129

2. 快速運作

本示例中,運作 Broad Institute 提供的 GATK4 版本全基因分析流程,該流程分為兩步:

  第一步為 gatk4-data-processing 。

  第二步為 gatk4-germline-snps-indels 。

在配置好 bcs 工具後,執行如下指令:

bcs gen ./demo -t gatk

cd demo/gatk4-data-processing

sh main.sh # 運作gatk4-data-processing 流程

cd ../gatk4-germline-snps-indels

sh main.sh # 運作gatk4-germline-snps-indels 流程           

這樣您就在批量計算上運作了以上兩個 GATK4 流程。

3. 指令詳解

A) 生成示例

執行如下指令生成示例:

bcs gen ./demo -t gatk           

它将生成以下目錄結構:

demo

|-- Readme.md

|-- gatk4-data-processing

|   |-- main.sh

|   |-- src

|       |-- LICENSE

|       |-- README.md

|       |-- generic.batchcompute-papi.options.json

|       |-- processing-for-variant-discovery-gatk4.hg38.wgs.inputs.json

|       |-- processing-for-variant-discovery-gatk4.hg38.wgs.inputs.30x.json

|       |-- processing-for-variant-discovery-gatk4.wdl

|-- gatk4-germline-snps-indels

    |-- main.sh

    |-- src

        |-- LICENSE

        |-- README.md

        |-- generic.batchcompute-papi.options.json

        |-- haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.json

        |-- haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.30x.json

        |-- haplotypecaller-gvcf-gatk4.wdl           

  gatk4-data-processing 目錄中包括了運作 gatk4-data-processing 流程所需的所有配置和腳本。

  gatk4-germline-snps-indels 目錄中包括了運作 gatk4-germline-snps-indels 流程所需的所有配置和腳本。

  每個目錄下面的 main.sh 腳本封裝了使用 bcs 工具送出作業的指令。

  src 目錄下面包括了工作流實作代碼。

B) 運作 gatk4-data-processing 流程

進入 demo/gatk4-data-processing 目錄,運作 main.sh,該檔案内容如下:

#!/bin/bash



# bcs asub cromwell -h for more



bcs asub cromwell gatk-job\

   --config ClassicNetwork=false\

   --input_from_file_WDL src/processing-for-variant-discovery-gatk4.wdl\

   --input_from_file_WORKFLOW_INPUTS src/processing-for-variant-discovery-gatk4.hg38.wgs.inputs.json\

   --input_from_file_WORKFLOW_OPTIONS src/generic.batchcompute-papi.options.json\

   --input_WORKING_DIR oss://demo-bucket/cli/gatk4_worker_dir/\

   --output_OUTPUTS_DIR oss://demo-bucket/cli/gatk4_outputs/\

   -t ecs.sn1.large -d cloud_efficiency           

其中,部分參數描述為:

  input_from_file_WDL:WDL 流程描述檔案路徑。

  input_from_file_WORKFLOW_INPUTS:WDL 流程輸入檔案。

  input_from_file_WORKFLOW_OPTIONS:WDL 流程選項檔案。

  input_WORKING_DIR:OSS上的目錄,用來存儲 WDL 流程中各個步驟生成的檔案,bcs 會自動給您生成一個預設的路徑。

  output_OUTPUTS_DIR:OSS 上的目錄,用來存儲 WDL 流程結束後生成的 metadata 檔案,bcs 會自動給您生成一個預設的路徑。

其他參數,請參考 bcs asub -h 指令。

如果希望使用此流程來運作自己的資料,需要修改 src/processing-for-variant-discovery-gatk4.hg38.wgs.inputs.json 檔案中的 PreProcessingForVariantDiscovery_GATK4.flowcell_unmapped_bams_list 參數,指定存儲在 OSS 上的 ubam 檔案。

注意:該示例中的流程輸入檔案不是 FASTQ 格式,而是 unaligned BAM 檔案。

C) 運作 gatk4-germline-snps-indels 流程

該流程的運作與 gatk4-data-processing 流程類似,參考上述章節。

  如果希望使用此流程來運作自己的資料,需要修改 src/haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.json 檔案中的 HaplotypeCallerGvcf_GATK4.input_bam 參數,修改為 gatk4-data-processing 流程輸出的 bam 檔案路徑。

  将 HaplotypeCallerGvcf_GATK4.input_bam_index 參數修改為相應的索引檔案路徑。

4. 作業狀态查詢與日志

在送出作業後,如果看到以下資訊,說明送出成功

Job created: job-0000000059DC658400006822000001E3           

job-0000000059DC658400006822000001E3 即是當次送出作業的 ID。

檢視作業狀态:

bcs j   # 擷取作業清單

bcs j job-0000000059DC658400006822000001E3 # 檢視作業詳情           

檢視作業日志:

bcs log job-0000000059DC658400006822000001E3           

5. 驗證結果

檢視 OSS 空間中的輸出資料:

bcs o ls oss://demo-bucket/cli/gatk4_worker_dir/           

檢視 metadata 檔案:

bcs o ls oss://demo-bucket/cli/gatk4_outputs/           

6. 如何分析 30X 的全基因組資料

A) 生成配置檔案

執行上述步驟生成本示例時,會同時生成一個适用 30X 全基因組資料分析的配置:

  processing-for-variant-discovery-gatk4.hg38.wgs.inputs.30x.json

  haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.30x.json

B) 修改 processing-for-variant-discovery-gatk4 配置檔案

為分析 30X 樣本,需要将 processing-for-variant-discovery-gatk4.hg38.wgs.inputs.30x.json 檔案中的PreProcessingForVariantDiscovery_GATK4.flowcell_unmapped_bams_list 參數改為OSS 檔案路徑,該檔案包括了需要分析的 30X 樣本在 OSS 上的路徑清單。

注意,30X 資料樣本,格式為 unaligned BAM 檔案。

C)修改 gatk4-data-processing 流程檔案

找到 gatk4-data-processing 流程的 main.sh 檔案,将其中的 --input_from_file_WORKFLOW_INPUTS 參數,修改為 src/processing-for-variant-discovery-gatk4.hg38.wgs.inputs.30x.json,加上 --timeout 172800 參數,并送出作業。

D) 修改 haplotypecaller-gvcf-gatk4 配置檔案

将 haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.30x.json 中的 HaplotypeCallerGvcf_GATK4.input_bam 參數修改為gatk4-data-processing 流程輸出的 bam 檔案路徑。

将 HaplotypeCallerGvcf_GATK4.input_bam_index 參數修改為相應的索引檔案路徑。

E) 修改 gatk4-germline-snps-indels 流程檔案

找到 gatk4-germline-snps-indels 流程的 main.sh,将其中的 --input_from_file_WORKFLOW_INPUTS 參數修改為 src/haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.30x.json,加上 --timeout 172800 參數,并最後送出作業。

本文作者:阿裡雲批量計算團隊

文章轉自阿裡雲基因行業公衆号,歡迎大家掃碼關注

GATK 軟體分析流程