diff --git a/modules/bwa/main.nf b/modules/bwa/main.nf index 881573c..0b0a726 100644 --- a/modules/bwa/main.nf +++ b/modules/bwa/main.nf @@ -23,7 +23,7 @@ process bwa_index { script: """ - bwa index ${reference} + bwa index ${reference} ${reference.baseName}/${reference} """ } diff --git a/modules/chewbbaca/main.nf b/modules/chewbbaca/main.nf index 5551146..b4d0169 100644 --- a/modules/chewbbaca/main.nf +++ b/modules/chewbbaca/main.nf @@ -13,60 +13,76 @@ params = initParams(params) process chewbbaca_allelecall { label "process_medium" - tag "${sampleName}" + tag "${workflow.runName}" publishDir "${params.publishDir}", mode: params.publishDirMode, overwrite: params.publishDirOverwrite input: - tuple val(sampleName), path(input) + val sampleName + path batchInput path schemaDir path trainingFile output: - tuple val(sampleName), path('output_dir/*/results_alleles.tsv') + val sampleName, emit: sampleName + path 'output_dir/results_alleles.tsv', emit: calls //tuple val(sampleName), path("${missingLoci}"), emit: missing script: - output = "${sampleName}.vcf" missingLoci = "chewbbaca.missingloci" trainingFile = trainingFile ? "--ptf ${trainingFile}" : "" - flockfile = file(params.localTempDir + '/chewbbaca.lock') - flocking = flockfile.exists() ? "flock -e $flockfile \\" : "" """ - echo ${input} > batch_input.list - ${flocking} - chewBBACA.py AlleleCall \\ - -i batch_input.list \\ - ${params.args.join(' ')} \\ - --cpu ${task.cpus} \\ - --output-directory output_dir \\ - ${trainingFile} \\ - --schema-directory ${schemaDir} + chewie AlleleCall \\ + -i ${batchInput} \\ + ${params.args.join(' ')} \\ + --cpu ${task.cpus} \\ + --output-directory output_dir \\ + ${trainingFile} \\ + --schema-directory ${schemaDir} #bash parse_missing_loci.sh batch_input.list 'output_dir/*/results_alleles.tsv' ${missingLoci} """ } +process chewbbaca_create_batch_list { + label "process_low" + publishDir params.publishDir, + mode: params.publishDirMode, + overwrite: params.publishDirOverwrite + + input: + path maskedAssembly + + output: + path "batch_input.list" + + script: + output = "batch_input.list" + """ + realpath $maskedAssembly > $output + """ +} + process chewbbaca_split_results { label "process_low" - tag "${assembly.simpleName}" + tag "${sampleName}" publishDir "${params.publishDir}", mode: params.publishDirMode, overwrite: params.publishDirOverwrite input: + each sampleName path input output: - path("${output}") + tuple val(sampleName), path("${output}") script: - id = "${input.simpleName}" - output = "${id}.chewbbaca" + output = "${sampleName}.chewbbaca" """ head -1 ${input} > ${output} - grep ${id} ${input} >> ${output} + grep ${sampleName} ${input} >> ${output} """ } diff --git a/modules/cmd/main.nf b/modules/cmd/main.nf index 086abf9..1c93da7 100644 --- a/modules/cmd/main.nf +++ b/modules/cmd/main.nf @@ -156,8 +156,6 @@ process save_analysis_metadata { mode: params.publishDirMode, overwrite: params.publishDirOverwrite - input: - output: path(output)