HealthOmics 워크플로에 대한 워크플로 정의 작성 - AWS HealthOmics

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

HealthOmics 워크플로에 대한 워크플로 정의 작성

HealthOmics는 WDL, Nextflow 또는 CWL로 작성된 워크플로 정의를 지원합니다. 이러한 워크플로 언어에 대한 자세한 내용은 WDL, Nextflow 또는 CWL 사양을 참조하세요.

HealthOmics는 세 가지 워크플로 정의 언어에 대한 버전 관리를 지원합니다. 자세한 내용은 HealthOmics 워크플로 정의 언어에 대한 버전 지원 단원을 참조하십시오.

WDL에서 워크플로 작성

다음 표는 WDL의 입력이 일치하는 기본 유형 또는 복잡한 JSON 유형에 매핑되는 방법을 보여줍니다. 유형 강제는 제한되며 가능한 경우 항상 유형이 명시적이어야 합니다.

프리미티브 유형
WDL 유형 JSON 유형 WDL 예 JSON 키 및 값의 예 Notes
Boolean boolean Boolean b "b": true 값은 소문자여야 하며 따옴표가 없어야 합니다.
Int integer Int i "i": 7 따옴표가 없어야 합니다.
Float number Float f "f": 42.2 따옴표가 없어야 합니다.
String string String s "s": "characters" URI인 JSON 문자열은 가져올 WDL 파일에 매핑되어야 합니다.
File string File f "f": "s3://amzn-s3-demo-bucket1/path/to/file" 워크플로에 제공된 IAM 역할에 이러한 객체에 대한 읽기 액세스 권한이 있는 한 Amazon S3 및 HealthOmics 스토리지 URIs를 가져옵니다. 다른 URI 체계는 지원되지 않습니다(예: file://, https://ftp://). URI는 객체를 지정해야 합니다. 디렉터리일 수 없습니다. 즉, 로 끝날 수 없습니다/.
Directory string Directory d "d": "s3://bucket/path/" Directory 유형은 WDL 1.0 또는 1.1에 포함되지 않으므로 WDL 파일의 헤더version development에를 추가해야 합니다. URI는 Amazon S3 URI여야 하며 접두사가 '/'로 끝나야 합니다. 디렉터리의 모든 콘텐츠는 단일 다운로드로 워크플로에 재귀적으로 복사됩니다. 에는 워크플로와 관련된 파일만 포함되어야 Directory 합니다.

WDL의 복잡한 유형은 기본 유형으로 구성된 데이터 구조입니다. 목록과 같은 데이터 구조는 배열로 변환됩니다.

복잡한 유형
WDL 유형 JSON 유형 WDL 예 JSON 키 및 값의 예 Notes
Array array Array[Int] nums “nums": [1, 2, 3] 배열의 멤버는 WDL 배열 유형의 형식을 따라야 합니다.
Pair object Pair[String, Int] str_to_i “str_to_i": {"left": "0", "right": 1} 페어의 각 값은 일치하는 WDL 유형의 JSON 형식을 사용해야 합니다.
Map object Map[Int, String] int_to_string "int_to_string": { 2: "hello", 1: "goodbye" } 맵의 각 항목은 일치하는 WDL 유형의 JSON 형식을 사용해야 합니다.
Struct object
struct SampleBamAndIndex { String sample_name File bam File bam_index } SampleBamAndIndex b_and_i
"b_and_i": { "sample_name": "NA12878", "bam": "s3://amzn-s3-demo-bucket1/NA12878.bam", "bam_index": "s3://amzn-s3-demo-bucket1/NA12878.bam.bai" }
구조체 멤버의 이름은 JSON 객체 키의 이름과 정확히 일치해야 합니다. 각 값은 일치하는 WDL 유형의 JSON 형식을 사용해야 합니다.
Object N/A 해당 사항 없음 N/A WDL Object 유형은 오래된 유형이므로 Struct 모든 경우에 로 교체해야 합니다.

HealthOmics 워크플로 엔진은 정규화된 입력 파라미터 또는 이름 공백 입력 파라미터를 지원하지 않습니다. 정규화된 파라미터 처리 및 WDL 파라미터에 대한 매핑은 WDL 언어로 지정되지 않으며 모호할 수 있습니다. 이러한 이유로 모범 사례는 최상위(기본) 워크플로 정의 파일의 모든 입력 파라미터를 선언하고 표준 WDL 메커니즘을 사용하여 하위 워크플로 호출로 전달하는 것입니다.

Nextflow에서 워크플로 작성

HealthOmics는 Nextflow DSL1 및 DSL2를 지원합니다. 자세한 내용은 Nextflow 버전 지원을 참조하세요.

Nextflow DSL2는 Groovy 프로그래밍 언어를 기반으로 하므로 파라미터는 동적이며 Groovy와 동일한 규칙을 사용하여 강제 유형을 지정할 수 있습니다. 입력 JSON에서 제공하는 파라미터와 값은 워크플로의 파라미터(params) 맵에서 사용할 수 있습니다.

참고

HealthOmics는 Nextflow 버전 v23.10(v22.04는 아님)에서 nf-schemanf-validation 플러그인을 지원합니다.

다음 정보는 Nextflow v23.10 워크플로에서 이러한 플러그인을 사용하는 것과 관련이 있습니다.

  • HealthOmics는 nf-schema@2.3.0 및 nf-validation@1.1.1 플러그인을 사전 설치합니다. HealthOmics는 nextflow.config 파일에서 지정한 다른 플러그인 버전을 무시합니다.

  • 워크플로 실행 중에는 추가 플러그인을 검색할 수 없습니다.

  • Nextflow v24.04 이상에서는 nf-validation 플러그인의 이름이 로 변경됩니다nf-schema. 자세한 내용은 Nextflow GitHub 리포지토리의 nf-schema를 참조하세요.

Amazon S3 또는 HealthOmics URI를 사용하여 Nextflow 파일 또는 경로 객체를 구성하는 경우 읽기 액세스 권한이 부여되는 한 워크플로에서 일치하는 객체를 사용할 수 있습니다. Amazon S3 URIs. 예시는 Amazon S3 입력 파라미터 형식 섹션을 참조하세요.

HealthOmics는 Amazon S3 URIs 또는 HealthOmics 스토리지 URIs에서 glob 패턴 사용을 지원합니다. 워크플로 정의에서 Glob 패턴을 사용하여 path 또는 file 채널을 생성합니다.

Nextflow에 작성된 워크플로의 경우 publishDir 명령을 정의하여 작업 콘텐츠를 출력 Amazon S3 버킷으로 내보냅니다. 다음 예제와 같이 publishDir 값을 로 설정합니다/mnt/workflow/pubdir. Amazon S3로 파일을 내보내려면 파일이이 디렉터리에 있어야 합니다.

nextflow.enable.dsl=2 workflow { CramToBamTask(params.ref_fasta, params.ref_fasta_index, params.ref_dict, params.input_cram, params.sample_name) ValidateSamFile(CramToBamTask.out.outputBam) } process CramToBamTask { container "<account>.dkr.ecr.us-west-2.amazonaws.com/genomes-in-the-cloud" publishDir "/mnt/workflow/pubdir" input: path ref_fasta path ref_fasta_index path ref_dict path input_cram val sample_name output: path "${sample_name}.bam", emit: outputBam path "${sample_name}.bai", emit: outputBai script: """ set -eo pipefail samtools view -h -T $ref_fasta $input_cram | samtools view -b -o ${sample_name}.bam - samtools index -b ${sample_name}.bam mv ${sample_name}.bam.bai ${sample_name}.bai """ } process ValidateSamFile { container "<account>.dkr.ecr.us-west-2.amazonaws.com/genomes-in-the-cloud" publishDir "/mnt/workflow/pubdir" input: file input_bam output: path "validation_report" script: """ java -Xmx3G -jar /usr/gitc/picard.jar \ ValidateSamFile \ INPUT=${input_bam} \ OUTPUT=validation_report \ MODE=SUMMARY \ IS_BISULFITE_SEQUENCED=false """ }

CWL에서 워크플로 작성

공통 워크플로 언어 또는 CWL로 작성된 워크플로는 WDL 및 Nextflow로 작성된 워크플로와 유사한 기능을 제공합니다. Amazon S3 또는 HealthOmics 스토리지 URIs 입력 파라미터로 사용할 수 있습니다.

하위 워크플로의 secondaryFile에서 입력을 정의하는 경우 기본 워크플로에 동일한 정의를 추가합니다.

HealthOmics 워크플로는 작업 프로세스를 지원하지 않습니다. CWL 워크플로의 운영 프로세스에 대한 자세한 내용은 CWL 설명서를 참조하세요.

HealthOmics를 사용하도록 기존 CWL 워크플로 정의 파일을 변환하려면 다음을 변경합니다.

  • 모든 Docker 컨테이너 URIs Amazon ECR URIs.

  • 모든 워크플로 파일이 기본 워크플로에서 입력으로 선언되고 모든 변수가 명시적으로 정의되었는지 확인합니다.

  • 모든 JavaScript 코드가 엄격한 모드 수신 거부인지 확인합니다.

사용되는 각 컨테이너에 대해 CWL 워크플로를 정의해야 합니다. 고정 Amazon ECR URI로 dockerPull 항목을 하드코딩하는 것은 권장되지 않습니다.

다음은 CWL로 작성된 워크플로의 예입니다.

cwlVersion: v1.2 class: Workflow inputs: in_file: type: File secondaryFiles: [.fai] out_filename: string docker_image: string outputs: copied_file: type: File outputSource: copy_step/copied_file steps: copy_step: in: in_file: in_file out_filename: out_filename docker_image: docker_image out: [copied_file] run: copy.cwl

다음 파일은 copy.cwl 작업을 정의합니다.

cwlVersion: v1.2 class: CommandLineTool baseCommand: cp inputs: in_file: type: File secondaryFiles: [.fai] inputBinding: position: 1 out_filename: type: string inputBinding: position: 2 docker_image: type: string outputs: copied_file: type: File outputBinding: glob: $(inputs.out_filename) requirements: InlineJavascriptRequirement: {} DockerRequirement: dockerPull: "$(inputs.docker_image)"

다음은 GPU 요구 사항이 있는 CWL로 작성된 워크플로의 예입니다.

cwlVersion: v1.2 class: CommandLineTool baseCommand: ["/bin/bash", "docm_haplotypeCaller.sh"] $namespaces: cwltool: http://commonwl.org/cwltool# requirements: cwltool:CUDARequirement: cudaDeviceCountMin: 1 cudaComputeCapability: "nvidia-tesla-t4" cudaVersionMin: "1.0" InlineJavascriptRequirement: {} InitialWorkDirRequirement: listing: - entryname: 'docm_haplotypeCaller.sh' entry: | nvidia-smi --query-gpu=gpu_name,gpu_bus_id,vbios_version --format=csv inputs: [] outputs: []

워크플로 정의 예

다음 예제에서는 WDL, Nextflow 및 CWL에서 동일한 워크플로 정의를 보여줍니다.

WDL
version 1.1 task my_task { runtime { ... } inputs { File input_file String name Int threshold } command <<< my_tool --name ~{name} --threshold ~{threshold} ~{input_file} >>> output { File results = "results.txt" } } workflow my_workflow { inputs { File input_file String name Int threshold = 50 } call my_task { input: input_file = input_file, name = name, threshold = threshold } outputs { File results = my_task.results } }
Nextflow
nextflow.enable.dsl = 2 params.input_file = null params.name = null params.threshold = 50 process my_task { // <directives> input: path input_file val name val threshold output: path 'results.txt', emit: results script: """ my_tool --name ${name} --threshold ${threshold} ${input_file} """ } workflow MY_WORKFLOW { my_task( params.input_file, params.name, params.threshold ) } workflow { MY_WORKFLOW() }
CWL
cwlVersion: v1.2 class: Workflow requirements: InlineJavascriptRequirement: {} inputs: input_file: File name: string threshold: int outputs: result: type: ... outputSource: ... steps: my_task: run: class: CommandLineTool baseCommand: my_tool requirements: ... inputs: name: type: string inputBinding: prefix: "--name" threshold: type: int inputBinding: prefix: "--threshold" input_file: type: File inputBinding: {} outputs: results: type: File outputBinding: glob: results.txt

WDL 워크플로 정의 예제

다음 예제에서는 WDLBAM에서에서 로 변환CRAM하기 위한 프라이빗 워크플로 정의를 보여줍니다. BAM 워크플로CRAM에 대한는 두 가지 작업을 정의하고 genomes-in-the-cloud 컨테이너의 도구를 사용합니다.이 작업은 예제에 나와 있으며 공개적으로 사용할 수 있습니다.

다음 예제에서는 Amazon ECR 컨테이너를 파라미터로 포함하는 방법을 보여줍니다. 이렇게 하면 HealthOmics가 실행을 시작하기 전에 컨테이너에 대한 액세스 권한을 확인할 수 있습니다.

{ ... "gotc_docker":"<account_id>.dkr.ecr.<region>.amazonaws.com/genomes-in-the-cloud:2.4.7-1603303710" }

다음 예제에서는 파일이 Amazon S3 버킷에 있을 때 실행에 사용할 파일을 지정하는 방법을 보여줍니다.

{ "input_cram": "s3://amzn-s3-demo-bucket1/inputs/NA12878.cram", "ref_dict": "s3://amzn-s3-demo-bucket1/inputs/Homo_sapiens_assembly38.dict", "ref_fasta": "s3://amzn-s3-demo-bucket1/inputs/Homo_sapiens_assembly38.fasta", "ref_fasta_index": "s3://amzn-s3-demo-bucket1/inputs/Homo_sapiens_assembly38.fasta.fai", "sample_name": "NA12878" }

시퀀스 스토어에서 파일을 지정하려면 다음 예제와 같이 시퀀스 스토어의 URI를 사용하여를 지정합니다.

{ "input_cram": "omics://429915189008.storage.us-west-2.amazonaws.com/111122223333/readSet/4500843795/source1", "ref_dict": "s3://amzn-s3-demo-bucket1/inputs/Homo_sapiens_assembly38.dict", "ref_fasta": "s3://amzn-s3-demo-bucket1/inputs/Homo_sapiens_assembly38.fasta", "ref_fasta_index": "s3://amzn-s3-demo-bucket1/inputs/Homo_sapiens_assembly38.fasta.fai", "sample_name": "NA12878" }

그런 다음 다음과 같이 WDL에서 워크플로를 정의할 수 있습니다.

version 1.0 workflow CramToBamFlow { input { File ref_fasta File ref_fasta_index File ref_dict File input_cram String sample_name String gotc_docker = "<account>.dkr.ecr.us-west-2.amazonaws.com/genomes-in-the- cloud:latest" } #Converts CRAM to SAM to BAM and makes BAI. call CramToBamTask{ input: ref_fasta = ref_fasta, ref_fasta_index = ref_fasta_index, ref_dict = ref_dict, input_cram = input_cram, sample_name = sample_name, docker_image = gotc_docker, } #Validates Bam. call ValidateSamFile{ input: input_bam = CramToBamTask.outputBam, docker_image = gotc_docker, } #Outputs Bam, Bai, and validation report to the FireCloud data model. output { File outputBam = CramToBamTask.outputBam File outputBai = CramToBamTask.outputBai File validation_report = ValidateSamFile.report } } #Task definitions. task CramToBamTask { input { # Command parameters File ref_fasta File ref_fasta_index File ref_dict File input_cram String sample_name # Runtime parameters String docker_image } #Calls samtools view to do the conversion. command { set -eo pipefail samtools view -h -T ~{ref_fasta} ~{input_cram} | samtools view -b -o ~{sample_name}.bam - samtools index -b ~{sample_name}.bam mv ~{sample_name}.bam.bai ~{sample_name}.bai } #Runtime attributes: runtime { docker: docker_image } #Outputs a BAM and BAI with the same sample name output { File outputBam = "~{sample_name}.bam" File outputBai = "~{sample_name}.bai" } } #Validates BAM output to ensure it wasn't corrupted during the file conversion. task ValidateSamFile { input { File input_bam Int machine_mem_size = 4 String docker_image } String output_name = basename(input_bam, ".bam") + ".validation_report" Int command_mem_size = machine_mem_size - 1 command { java -Xmx~{command_mem_size}G -jar /usr/gitc/picard.jar \ ValidateSamFile \ INPUT=~{input_bam} \ OUTPUT=~{output_name} \ MODE=SUMMARY \ IS_BISULFITE_SEQUENCED=false } runtime { docker: docker_image } #A text file is generated that lists errors or warnings that apply. output { File report = "~{output_name}" } }