From 52ca8f152836904803c499cdcd6d0726cfc0d28b Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sat, 23 Sep 2023 16:24:57 -0500 Subject: [PATCH] refactor: Replace in-workflow HAPLINK processes with imported modules --- main.nf | 55 ++----------------------------------------------- nextflow.config | 8 +++++++ 2 files changed, 10 insertions(+), 53 deletions(-) diff --git a/main.nf b/main.nf index d6449ed..f6fbf59 100755 --- a/main.nf +++ b/main.nf @@ -1,6 +1,8 @@ #!/usr/bin/env nextflow include { EFETCH } from './modules/efetch' +include { HAPLINK_HAPLOTYPES as HAPLINK_ML_HAPLOTYPES } from './modules/haplink/haplotypes' +include { HAPLINK_HAPLOTYPES as HAPLINK_RAW_HAPLOTYPES } from './modules/haplink/haplotypes' include { HAPLINK_VARIANTS } from './modules/haplink/variants' include { MINIMAP2 } from './modules/minimap2' include { NANOFILT } form './modules/nanofilt' @@ -73,59 +75,6 @@ workflow { ) } -process HAPLINK_RAW_HAPLOTYPES { - cpus 2 - memory '12.GB' - - input: - tuple val(prefix), path(bam), path(bai), path(vcf) - path reference - - output: - tuple val(prefix), path("*.yaml") - - publishDir "results/raw-haplotypes", mode: 'copy' - - script: - """ - export JULIA_NUM_THREADS=${task.cpus} - haplink haplotypes \\ - "${reference}" \\ - "${vcf}" \\ - "${bam}" \\ - --frequency 0.01 \\ - > "${prefix}.yaml" - """ -} - -process HAPLINK_ML_HAPLOTYPES { - cpus 8 - memory '12.GB' - - input: - tuple val(prefix), path(bam), path(bai), path(vcf) - path reference - - output: - tuple val(prefix), path("*.yaml") - - publishDir "results/ml-haplotypes", mode: 'copy' - - script: - """ - export JULIA_NUM_THREADS=${task.cpus} - haplink haplotypes \\ - "${reference}" \\ - "${vcf}" \\ - "${bam}" \\ - --simulated-reads \\ - --overlap-min 20 \\ - --overlap-max 8000 \\ - --frequency 0.01 \\ - > "${prefix}.yaml" - """ -} - process HAPLINK_SEQUENCES { cpus 1 memory '6.GB' diff --git a/nextflow.config b/nextflow.config index 84597cb..fce47a2 100644 --- a/nextflow.config +++ b/nextflow.config @@ -1,6 +1,14 @@ process { errorStrategy = 'finish' time = '7d' + + withName: 'HAPLINK_ML_HAPLOTYPES' { + ext.ml_args = """ + --simulated-reads \\ + --overlap-min 20 \\ + --overlap-max 8000 \\ + """ + } } singularity.enabled = true