当前位置:主页 > 查看内容

GATK支持 - 批量计算

发布时间:2021-09-19 00:00| 位朋友查看

简介:GATK 软件分析流程由阿里云和 Broad Institute 合作提供。Broad Institute 提供的 GATK 流程最佳实践用 工作流定义语言(WDL) 编写,通过批量计算集成的 Cromwell 工作流引擎解析执行。用户将为作业运行时实际消耗的计算和存储资源付费,不需要支付资源之外……

GATK 软件分析流程由阿里云和 Broad Institute 合作提供。Broad Institute 提供的 GATK 流程最佳实践用 工作流定义语言(WDL) 编写,通过批量计算集成的 Cromwell 工作流引擎解析执行。用户将为作业运行时实际消耗的计算和存储资源付费,不需要支付资源之外的附加费用。

Broad Institute GATK 网站和论坛为 GATK 工具和 WDL 提供了更完整的背景信息,文档和支持。

如果需要执行用 WDL 编写的通用工作流程,请参考 cromwell 工作流引擎和 WDL 支持的 APP

1. 准备

A) 使用 OSS 存储

要在批量计算上运行 GATK,输入、输出文件都需要保存在 OSS。所以,需要先开通 OSS 并创建好 Bucket。

注意:创建 Bucket 的区域,需要和运行批量计算的 GATK 区域一致。

B) 安装 batchcompute-cli 命令行工具

  1. 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 版本全基因分析流程,该流程分为两步:

在配置好 bcs 工具后,执行如下命令:

  1. bcs gen ./demo -t gatk
  2. cd demo/gatk4-data-processing
  3. sh main.sh # 运行gatk4-data-processing 流程
  4. cd ../gatk4-germline-snps-indels
  5. sh main.sh # 运行gatk4-germline-snps-indels 流程

这样您就在批量计算上运行了以上两个 GATK4 流程。

3. 命令详解

A) 生成示例

执行如下命令生成示例:

  1. bcs gen ./demo -t gatk

它将生成以下目录结构:

  1. demo
  2. |-- Readme.md
  3. |-- gatk4-data-processing
  4. | |-- main.sh
  5. | |-- src
  6. | |-- LICENSE
  7. | |-- README.md
  8. | |-- generic.batchcompute-papi.options.json
  9. | |-- processing-for-variant-discovery-gatk4.hg38.wgs.inputs.json
  10. | |-- processing-for-variant-discovery-gatk4.hg38.wgs.inputs.30x.json
  11. | |-- processing-for-variant-discovery-gatk4.wdl
  12. |-- gatk4-germline-snps-indels
  13. |-- main.sh
  14. |-- src
  15. |-- LICENSE
  16. |-- README.md
  17. |-- generic.batchcompute-papi.options.json
  18. |-- haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.json
  19. |-- haplotypecaller-gvcf-gatk4.hg38.wgs.inputs.30x.json
  20. |-- 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,该文件内容如下:

  1. #!/bin/bash
  2. # bcs asub cromwell -h for more
  3. bcs asub cromwell gatk-job\
  4. --config ClassicNetwork=false\
  5. --input_from_file_WDL src/processing-for-variant-discovery-gatk4.wdl\
  6. --input_from_file_WORKFLOW_INPUTS src/processing-for-variant-discovery-gatk4.hg38.wgs.inputs.json\
  7. --input_from_file_WORKFLOW_OPTIONS src/generic.batchcompute-papi.options.json\
  8. --input_WORKING_DIR oss://demo-bucket/cli/gatk4_worker_dir/\
  9. --output_OUTPUTS_DIR oss://demo-bucket/cli/gatk4_outputs/\
  10. -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. 作业状态查询与日志

在提交作业后,如果看到以下信息,说明提交成功

  1. Job created: job-0000000059DC658400006822000001E3

job-0000000059DC658400006822000001E3 即是当次提交作业的 ID。

查看作业状态:

  1. bcs j # 获取作业列表
  2. bcs j job-0000000059DC658400006822000001E3 # 查看作业详情

查看作业日志:

  1. bcs log job-0000000059DC658400006822000001E3

5. 验证结果

查看 OSS 空间中的输出数据:

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

查看 metadata 文件:

  1. 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 参数,并最后提交作业。

如遇到 QuotaExhausted 错误,请通过工单调整 Quota。


本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:SGE集群1.1版本 - 批量计算 下一篇:没有了

推荐图文


随机推荐