diff --git a/docker/bcftools/Dockerfile b/docker/bcftools/Dockerfile new file mode 100644 index 00000000..016a0235 --- /dev/null +++ b/docker/bcftools/Dockerfile @@ -0,0 +1,36 @@ +# use the ubuntu base image +FROM ubuntu:20.04 + +LABEL maintainer="Tim Sanders " + +RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ + curl \ + autoconf \ + build-essential \ + cmake \ + g++ \ + gfortran \ + libcurl4-gnutls-dev \ + hdf5-tools \ + libboost-date-time-dev \ + libboost-program-options-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-iostreams-dev \ + libbz2-dev \ + libhdf5-dev \ + libncurses-dev \ + liblzma-dev \ + zlib1g-dev + +ADD https://github.com/samtools/bcftools/releases/download/1.11/bcftools-1.11.tar.bz2 / +RUN tar -jxf bcftools-1.11.tar.bz2 \ + && rm bcftools-1.11.tar.bz2 + +WORKDIR bcftools-1.11 + +RUN ./configure --prefix=/app/bcftools-1.11 \ + && make \ + && make install + +ENV PATH /app/bcftools-1.11/bin:$PATH \ No newline at end of file diff --git a/docker/delly/Dockerfile b/docker/delly/Dockerfile new file mode 100644 index 00000000..5b0c724f --- /dev/null +++ b/docker/delly/Dockerfile @@ -0,0 +1,54 @@ +# use the ubuntu base image +FROM ubuntu:20.04 + +LABEL maintainer="Tim Sanders " + +# install required packages +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + autoconf \ + build-essential \ + cmake \ + g++ \ + gfortran \ + git \ + libcurl4-gnutls-dev \ + hdf5-tools \ + libboost-date-time-dev \ + libboost-program-options-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-iostreams-dev \ + libbz2-dev \ + libhdf5-dev \ + libncurses-dev \ + liblzma-dev \ + zlib1g-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# set environment +ENV BOOST_ROOT /usr + +# install delly +RUN cd /opt \ + && git clone --recursive https://github.com/dellytools/delly.git --branch v0.8.6 \ + && cd /opt/delly/ \ + && make STATIC=1 all \ + && make install + + +# Multi-stage build +FROM alpine:3.13 +RUN mkdir -p /opt/delly/bin +WORKDIR /opt/delly/bin +COPY --from=0 /opt/delly/bin/delly . + +RUN apk add --update bash && rm -rf /var/cache/apk/* + +# Workdir +WORKDIR /root/ + +# Add Delly to PATH +ENV PATH="/opt/delly/bin:${PATH}" + +CMD ["/bin/sh"] diff --git a/docker/rtgtools/Dockerfile b/docker/rtgtools/Dockerfile new file mode 100644 index 00000000..c01f90e4 --- /dev/null +++ b/docker/rtgtools/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:20.04 + +LABEL maintainer="Tim Sanders " + +RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \ + unzip + +ADD https://github.com/RealTimeGenomics/rtg-tools/releases/download/3.11/rtg-tools-3.11-linux-x64.zip / + +# RTG Tools requires you answer whether or not you want to enable automatic usage reporting (via 'rtg help') +# so this line passes "n" to that prompt after extraction +RUN unzip rtg-tools-3.11-linux-x64.zip \ + && rm rtg-tools-3.11-linux-x64.zip \ + && echo "n" | /rtg-tools-3.11/rtg help + +WORKDIR rtg-tools-3.11 + +ENV PATH="/rtg-tools-3.11:${PATH}" \ No newline at end of file diff --git a/docker/sha512/Dockerfile b/docker/sha512/Dockerfile new file mode 100644 index 00000000..7afffa3d --- /dev/null +++ b/docker/sha512/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.12 as builder + +LABEL maintainer="Tim Sanders " + +RUN apk add --update bash && rm -rf /var/cache/apk/* diff --git a/docker/tool_name/Dockerfile b/docker/tool_name/Dockerfile deleted file mode 100644 index f390e397..00000000 --- a/docker/tool_name/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM base-image - -LABEL maintainer="Author Name " diff --git a/docker/vcftools/Dockerfile b/docker/vcftools/Dockerfile new file mode 100644 index 00000000..85d47157 --- /dev/null +++ b/docker/vcftools/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.12 as builder + +LABEL maintainer="Tim Sanders " + +RUN apk --no-cache add alpine-sdk perl zlib-dev curl +RUN set -ex \ + && curl -L -O https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz \ + && tar zxf vcftools-0.1.16.tar.gz \ + && rm vcftools-0.1.16.tar.gz \ + && cd vcftools-0.1.16 \ + && ./configure --prefix=/app/vcftools-0.1.16 \ + && make \ + && make install + +FROM alpine:3.12 +ENV PATH /app/vcftools-0.1.16/bin:$PATH +ENV PERL5LIB /app/vcftools-0.1.16/share/perl5/site_perl:$PERL5LIB +RUN apk add --no-cache libstdc++ perl zlib +RUN apk add --update bash && rm -rf /var/cache/apk/* +COPY --from=builder /app/ /app/ \ No newline at end of file diff --git a/pipeline/call-gSV.nf b/pipeline/call-gSV.nf new file mode 100644 index 00000000..a9088a5d --- /dev/null +++ b/pipeline/call-gSV.nf @@ -0,0 +1,100 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl=2 + + +log.info """\ +====================================== +C A L L - G S V N F P I P E L I N E +====================================== +Boutros Lab + + +Current Configuration: +- input: + input_csv: ${params.input_csv} + reference_fasta: ${params.reference_fasta} + reference_fasta_index: ${params.reference_fasta_index} + reference_prefix: ${params.reference_prefix} + exclusion_file: ${params.exclusion_file} + +- output: + output_dir: ${params.output_dir} + output_log_dir: ${params.output_log_dir} + temp_dir: ${params.temp_dir} + +- options: + save_intermediate_files: ${params.save_intermediate_files} + run_qc: ${params.run_qc} + map_qual: ${params.map_qual} + +- tools: + delly: ${params.delly_version} + bcftools: ${params.bcftools_version} + vcftools: ${params.vcftools_version} + rtgtools: ${params.rtgtools_version} + validation tool: ${params.validate_version} + sha512: ${params.sha512_version} + +------------------------------------ +Starting workflow... +------------------------------------ +""" +.stripIndent() + +include { validate_file } from './modules/validation' +include { delly_call_sv } from './modules/delly' +include { bcftools_vcf } from './modules/bcftools' +include { rtgtools_vcfstats } from './modules/rtgtools' +include { vcftools_validator } from './modules/vcftools' +include { generate_sha512 } from './modules/sha512' + +input_bam_ch = Channel + .fromPath(params.input_csv, checkIfExists:true) + .splitCsv(header:true) + .map{ row -> tuple( + row.patient, + row.sample, + row.input_bam, + "${row.input_bam}.bai" + ) + } + +if (!params.reference_fasta) { + // error out - must provide a reference FASTA file + error "***Error: You must specify a reference FASTA file***" +} + +if (!params.exclusion_file) { + // error out - must provide exclusion file + error "*** Error: You must provide an exclusion file***" +} + +if (params.reference_fasta_index) { + reference_fasta_index = params.reference_fasta_index +} +else { + reference_fasta_index = "${params.reference_fasta}.fai" +} + +// Create channel for validation +validation_channel = Channel + .fromPath(params.input_csv, checkIfExists:true) + .splitCsv(header:true) + .map{ row -> [ + row.input_bam, + params.reference_fasta + ] + } + .flatten() + +workflow { + validate_file(validation_channel) + delly_call_sv(input_bam_ch, params.reference_fasta, reference_fasta_index, params.exclusion_file) + bcftools_vcf(delly_call_sv.out.bcf_sv_file, delly_call_sv.out.bam_sample_name) + if (params.run_qc) { + rtgtools_vcfstats(bcftools_vcf.out.vcf_sv_file, delly_call_sv.out.bam_sample_name) + vcftools_validator(bcftools_vcf.out.vcf_sv_file, delly_call_sv.out.bam_sample_name) + } + generate_sha512(delly_call_sv.out.bcf_sv_file.mix(bcftools_vcf.out.vcf_sv_file)) +} diff --git a/pipeline/config/execute.config b/pipeline/config/execute.config new file mode 100644 index 00000000..a64252a0 --- /dev/null +++ b/pipeline/config/execute.config @@ -0,0 +1,10 @@ +process { + withName: validate_file { + cpus = 1 + memory = 1.GB + } + withName: delly_call_sv { + cpus = 63 + memory = 940.GB + } +} \ No newline at end of file diff --git a/pipeline/config/lowmem.config b/pipeline/config/lowmem.config new file mode 100644 index 00000000..c2706fbb --- /dev/null +++ b/pipeline/config/lowmem.config @@ -0,0 +1,10 @@ +process { + withName: validate_file { + cpus = 1 + memory = 1.GB + } + withName: delly_call_sv { + cpus = 1 + memory = 3.GB + } +} \ No newline at end of file diff --git a/pipeline/config/methods.config b/pipeline/config/methods.config new file mode 100644 index 00000000..c7ef8792 --- /dev/null +++ b/pipeline/config/methods.config @@ -0,0 +1,111 @@ +class log_output_dir { + static def check_permissions(path) { + def filePath = new File(path) + + if (filePath.exists()) { + if (filePath.canWrite()) { + return + } + throw new Exception("${path} is not writable") + } + + // Attempts to create directory if the path does not exist + if (!filePath.mkdirs()) { + throw new Exception("${path} does not exist and could not create") + } + } +} + +methods { + set_log_output_dir = { + + def patient + def sample + + // assumes that patient and samples name are in the pipeline.config + def reader = new FileReader(params.input_csv) + reader.splitEachLine(',') { parts -> [patient = parts[0], sample = parts[1]] } + + def date = new Date().format('yyyyMMdd-HHmmss') + if (params.sge_scheduler) { + params.avere_prefix = '/data/data' + } else { + params.avere_prefix = '/hot/data' + } + + if (params.blcds_registered_dataset == true) { + if ("${params.dataset_id.length()}" != 11) { + throw new Exception("Dataset id must be eleven characters long") + } + def disease = "${params.dataset_id.substring(0,4)}" + params.output_log_dir = "${params.avere_prefix}/$disease/${params.dataset_id}/${patient}/${sample}/DNA/WGS/aligned/${params.reference_prefix}/log/call-gSV/$date" + params.disease = "${disease}" + } else { + params.output_log_dir = "${params.output_dir}/$date/log/" + params.disease = null + } + params.patient = "${patient}" + params.sample = "${sample}" + params.date = "${date}" + } + + // Process specific scope + set_process = { + // Monitor process jobs with local (not slurm) executor + process.executor = "local" + } + + // Location of Nextflow temp directories + set_env = { + workDir = params.temp_dir + NXF_WORK = params.temp_dir + NXF_TEMP = params.temp_dir + NXF_HOME = params.temp_dir + } + + // Pipeline monitoring and metric files + set_timeline = { + timeline.enabled = true + timeline.file = "${params.output_log_dir}/timeline.html" + } + set_trace = { + trace.enabled = true + trace.file = "${params.output_log_dir}/trace.txt" + } + set_report = { + report.enabled = true + report.file = "${params.output_log_dir}/report.html" + } + + // Set up env, timeline, trace, and report above. + setup = { + methods.set_log_output_dir() + log_output_dir.check_permissions(params.output_log_dir) + methods.set_process() + methods.set_env() + methods.set_timeline() + methods.set_trace() + methods.set_report() + } +} + + +methods.setup() + +params { + // Pipeline tool versions + delly_version = '0.8.6' + bcftools_version = '1.11' + vcftools_version = '0.1.16' + rtgtools_version = '3.11' + validate_version = '1.0.0' + sha512_version = '0.1' +} + +// Enable docker +docker { + enabled = true + sudo = params.sge_scheduler // Set to true if run on SGE + runOptions = "-u \$(id -u):\$(id -g)" + runOptions = "\$(for i in `id --real --groups`; do echo -n \"--group-add=\$i \"; done)" +} \ No newline at end of file diff --git a/pipeline/config/midmem.config b/pipeline/config/midmem.config new file mode 100644 index 00000000..52ed74bd --- /dev/null +++ b/pipeline/config/midmem.config @@ -0,0 +1,10 @@ +process { + withName: validate_file { + cpus = 1 + memory = 1.GB + } + withName: delly_call_sv { + cpus = 71 + memory = 130.GB + } +} \ No newline at end of file diff --git a/pipeline/config/nextflow.config b/pipeline/config/nextflow.config new file mode 100644 index 00000000..39c89210 --- /dev/null +++ b/pipeline/config/nextflow.config @@ -0,0 +1,44 @@ +import nextflow.util.SysHelper + +manifest { + mainScript = 'call-gSV.nf' + nextflowVersion = '>=20.07.1' + author = 'Tim Sanders & Yael Berkovich' + homePage = 'https://github.com/uclahs-cds/pipeline-call-gSV' + description = 'A pipeline to call structural variants utilizing Delly' + version = '1.0.0' +} + +params { + + dataset_id = '' + blcds_registered_dataset = false + sge_scheduler = false + + input_csv = 'path/to/input.csv' + reference_fasta = '/path/to/genome.fa' + reference_fasta_index = '/path/to/genome.fa.fai' + reference_prefix = 'GRCh38-BI-20160721' // See https://confluence.mednet.ucla.edu/display/BOUTROSLAB/Data+storage+directory+structure+design#Datastoragedirectorystructuredesign-8.Referencegenome + exclusion_file = '/path/to/exclusion.tsv' + map_qual = 20 // min. paired-end (PE) mapping quality for Delly + run_qc = true + save_intermediate_files = true + output_dir = '/path/to/outputs' + temp_dir = '/path/to/temp' //e.g. /scratch + +} + +includeConfig "${projectDir}/config/methods.config" + +def node_cpus = SysHelper.getAvailCpus() +def node_mem = SysHelper.getAvailMemory().toString() + +if (node_cpus == 2 && (node_mem == '3 GB' || node_mem == '3.9 GB')) { + includeConfig "${projectDir}/config/lowmem.config" +} else if (node_cpus == 72 && (node_mem == '136.8 GB' || node_mem == '141.7 GB')) { + includeConfig "${projectDir}/config/midmem.config" +} else if (node_cpus == 64 && (node_mem == '950 GB' || node_mem == '1007.9 GB')) { + includeConfig "${projectDir}/config/execute.config" +} else { + throw new Exception('ERROR: System resources not as expected, unable to assign resources.') +} \ No newline at end of file diff --git a/pipeline/config/single-node/pipeline-name-single-node.config b/pipeline/config/single-node/call-gSV-single-node.config similarity index 98% rename from pipeline/config/single-node/pipeline-name-single-node.config rename to pipeline/config/single-node/call-gSV-single-node.config index 5274bd92..59d7f620 100644 --- a/pipeline/config/single-node/pipeline-name-single-node.config +++ b/pipeline/config/single-node/call-gSV-single-node.config @@ -1,7 +1,7 @@ // EXECUTION SETTINGS AND GLOBAL DEFAULTS // External config files import -includeConfig 'path/to/another.config +includeConfig 'path/to/another.config' // Inputs/parameters of the pipeline params { diff --git a/pipeline/inputs/call-gSV-inputs.csv b/pipeline/inputs/call-gSV-inputs.csv new file mode 100644 index 00000000..f7df4b57 --- /dev/null +++ b/pipeline/inputs/call-gSV-inputs.csv @@ -0,0 +1,2 @@ +patient,sample,input_bam +patient-name,sample-name,/path/to/sample.bam \ No newline at end of file diff --git a/pipeline/inputs/pipeline-name-inputs.csv b/pipeline/inputs/pipeline-name-inputs.csv deleted file mode 100644 index a237dcfc..00000000 --- a/pipeline/inputs/pipeline-name-inputs.csv +++ /dev/null @@ -1,2 +0,0 @@ -index,row_1_name,row_2_name_file_extension -1,variable_name,/path/to/file \ No newline at end of file diff --git a/pipeline/modules/bcftools.nf b/pipeline/modules/bcftools.nf new file mode 100644 index 00000000..512fc742 --- /dev/null +++ b/pipeline/modules/bcftools.nf @@ -0,0 +1,41 @@ +#!/usr/bin/env nextflow + +def docker_image_bcftools = "blcdsdockerregistry/call-gsv:bcftools-${params.bcftools_version}" + +log.info """\ +------------------------------------ + B C F T O O L S +------------------------------------ +Docker Images: +- docker_image_bcftools: ${docker_image_bcftools} +""" + +process bcftools_vcf { + container docker_image_bcftools + + publishDir params.output_dir, + pattern: "*.vcf", + mode: "copy", + saveAs: { "bcftools-${params.bcftools_version}/${file(it).getName()}" } + + publishDir params.output_log_dir, + pattern: ".command.*", + mode: "copy", + saveAs: { "bcftools_vcf/log${file(it).getName()}" } + + input: + path bcf_sv_file + val bam_sample_name + + output: + path "DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}.vcf", emit: vcf_sv_file + path ".command.*" + + """ + set -euo pipefail + bcftools \ + view \ + $bcf_sv_file \ + --output DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}.vcf + """ +} \ No newline at end of file diff --git a/pipeline/modules/delly.nf b/pipeline/modules/delly.nf new file mode 100644 index 00000000..405693f1 --- /dev/null +++ b/pipeline/modules/delly.nf @@ -0,0 +1,50 @@ +#!/usr/bin/env nextflow + +def docker_image_delly = "blcdsdockerregistry/call-gsv:delly-${params.delly_version}" + +log.info """\ +------------------------------------ + D E L L Y +------------------------------------ +Docker Images: +- docker_image_delly: ${docker_image_delly} +""" + +process delly_call_sv { + container docker_image_delly + + publishDir params.output_dir, + enabled: params.save_intermediate_files, + pattern: "*.bcf*", + mode: "copy", + saveAs: { "delly-${params.delly_version}/${file(it).getName()}" } + + publishDir params.output_log_dir, + pattern: ".command.*", + mode: "copy", + saveAs: { "delly_call_sv/log${file(it).getName()}" } + + input: + tuple val(patient), val(bam_sample_name), path(input_bam), path(input_bam_bai) + path(reference_fasta) + path(reference_fasta_fai) + path(exclusion_file) + + + output: + path "DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}.bcf", emit: bcf_sv_file + path "DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}.bcf.csi" + path ".command.*" + val bam_sample_name, emit: bam_sample_name + + """ + set -euo pipefail + delly \ + call \ + --exclude $exclusion_file \ + --genome $reference_fasta \ + --outfile DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}.bcf \ + --map-qual ${params.map_qual} \ + $input_bam + """ +} \ No newline at end of file diff --git a/pipeline/modules/rtgtools.nf b/pipeline/modules/rtgtools.nf new file mode 100644 index 00000000..f9dd8f6b --- /dev/null +++ b/pipeline/modules/rtgtools.nf @@ -0,0 +1,39 @@ +#!/usr/bin/env nextflow + +def docker_image_rtgtools = "blcdsdockerregistry/call-gsv:rtgtools-${params.rtgtools_version}" + +log.info """\ +------------------------------------ + R T G T O O L S +------------------------------------ +Docker Images: +- docker_image_rtgtools: ${docker_image_rtgtools} +""" + +process rtgtools_vcfstats { + container docker_image_rtgtools + + publishDir params.output_dir, + pattern: "*_stats.txt", + mode: "copy", + saveAs: { "rtgtools-${params.rtgtools_version}/${file(it).getName()}" } + + publishDir params.output_log_dir, + pattern: ".command.*", + mode: "copy", + saveAs: { "rtgtools_vcfstats/log${file(it).getName()}" } + + input: + path vcf_sv_file + val bam_sample_name + + output: + path "DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}_stats.txt" + path ".command.*" + + """ + set -euo pipefail + + rtg vcfstats $vcf_sv_file > DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}_stats.txt + """ +} \ No newline at end of file diff --git a/pipeline/modules/sha512.nf b/pipeline/modules/sha512.nf new file mode 100644 index 00000000..ca1592bd --- /dev/null +++ b/pipeline/modules/sha512.nf @@ -0,0 +1,43 @@ +#!/usr/bin/env nextflow + +def docker_image_sha512 = "blcdsdockerregistry/call-gsv:sha512-${params.sha512_version}" + +log.info """\ +------------------------------------ + S H A - 5 1 2 +------------------------------------ +Docker Images: +- docker_image_sha512: ${docker_image_sha512} +""" + +process generate_sha512 { + container docker_image_sha512 + + publishDir params.output_dir, + pattern: "*.vcf.sha512", + mode: "copy", + saveAs: { "bcftools-${params.bcftools_version}/${file(it).getName()}" } + + publishDir params.output_dir, + pattern: "*.bcf.sha512", + mode: "copy", + saveAs: { "delly-${params.delly_version}/${file(it).getName()}" } + + publishDir params.output_log_dir, + pattern: ".command.*", + mode: "copy", + saveAs: { "generate_sha512/log${file(it).getName()}" } + + input: + path input_checksum_file + + output: + path "${input_checksum_file}.sha512" + path ".command.*" + + """ + set -euo pipefail + + sha512sum $input_checksum_file > ${input_checksum_file}.sha512 + """ +} \ No newline at end of file diff --git a/pipeline/modules/validation.nf b/pipeline/modules/validation.nf new file mode 100644 index 00000000..6967fd0a --- /dev/null +++ b/pipeline/modules/validation.nf @@ -0,0 +1,23 @@ +#!/usr/bin/env nextflow + +def docker_image_validation = "blcdsdockerregistry/validate:${params.validate_version}" + +log.info """\ +------------------------------------ + V A L I D A T I O N +------------------------------------ +Docker Images: +- docker_image_validation: ${docker_image_validation} +""" + +process validate_file { + container docker_image_validation + + input: + path(file_to_validate) + + """ + set -euo pipefail + python -m validate -t file-input ${file_to_validate} + """ +} \ No newline at end of file diff --git a/pipeline/modules/vcftools.nf b/pipeline/modules/vcftools.nf new file mode 100644 index 00000000..928d6ba6 --- /dev/null +++ b/pipeline/modules/vcftools.nf @@ -0,0 +1,39 @@ +#!/usr/bin/env nextflow + +def docker_image_vcftools = "blcdsdockerregistry/vcftools:${params.vcftools_version}" + +log.info """\ +------------------------------------ + V C F T O O L S +------------------------------------ +Docker Images: +- docker_image_vcftools: ${docker_image_vcftools} +""" + +process vcftools_validator { + container docker_image_vcftools + + publishDir params.output_dir, + pattern: "*_validation.txt", + mode: "copy", + saveAs: { "vcftools-${params.vcftools_version}/${file(it).getName()}" } + + publishDir params.output_log_dir, + pattern: ".command.*", + mode: "copy", + saveAs: { "vcftools_validator/log${file(it).getName()}" } + + input: + path vcf_sv_file + val bam_sample_name + + output: + path "DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}_validation.txt" + path ".command.*" + + """ + set -euo pipefail + + vcf-validator -d -u $vcf_sv_file > DELLY-${params.delly_version}_${params.dataset_id}_${bam_sample_name}_validation.txt; + """ +} \ No newline at end of file diff --git a/pipeline/pipeline-name.nf b/pipeline/pipeline-name.nf deleted file mode 100644 index 40566a68..00000000 --- a/pipeline/pipeline-name.nf +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env nextflow - -// Docker images here... -def docker_image_name = "docker image" - -// Log info here -log.info """\ - ====================================== - T E M P L A T E - N F P I P E L I N E - ====================================== - Boutros Lab - - Current Configuration: - - input - input a: ${params.variable_name} - ... - - - output: - output a: ${params.output_path} - ... - - - options: - option a: ${params.option_name} - ... - - Tools Used: - tool a: ${docker_image_name} - - ------------------------------------ - Starting workflow... - ------------------------------------ - """ - .stripIndent() - -// Channels here -// Decription of input channel -Channel - .fromPath(params.input_csv) - .ifEmpty { error "Cannot find input csv: ${params.input_csv}" } - .splitCsv(header:true) - .map { row -> - return tuple(row.row_1_name, - row.row_2_name_file_extension - ) - } - .set { input_ch_input_csv } - -// Decription of input channel -Channel - .fromPath(params.variable_name) - .ifEmpty { error "Cannot find: ${params.variable_name}" } - .set { input_ch_variable_name } - -// process here -// Decription of process -process tool_name_command_name { - container docker_image_name - - publishDir params.output_dir, enabled: true, mode: 'copy' - - label "resource_allocation_tool_name_command_name" - - // Additional directives here - - input: - tuple(val(row_1_name), - path(row_2_name_file_extension), - ) from input_ch_input_csv - val(variable_name) from input_ch_variable_name - - output: - file("${variable_name}.command_name.file_extension") into output_ch_tool_name_command_name - - script: - """ - # make sure to specify pipefail to make sure process correctly fails on error - set -euo pipefail - - # the script should ideally only have call to a tool - # to make the command more human readable: - # - seperate components of the call out on different lines - # - when possible by explict with command options, spelling out their long names - tool_name \ - command_name \ - --option_1_long_name ${row_1_name} \ - --input ${row_2_name_file_extension} \ - --output ${variable_name}.command_name.file_extension - """ -}