Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chewbbaca batch input #3

Merged
merged 5 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/bwa/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ process bwa_index {

script:
"""
bwa index ${reference}
bwa index ${reference} ${reference.baseName}/${reference}
"""
}

Expand Down
56 changes: 36 additions & 20 deletions modules/chewbbaca/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"""
}

Expand Down
2 changes: 0 additions & 2 deletions modules/cmd/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ process save_analysis_metadata {
mode: params.publishDirMode,
overwrite: params.publishDirOverwrite

input:

output:
path(output)

Expand Down