From 5d1b1ba27b5f902fc77362f752f07e6dac401d94 Mon Sep 17 00:00:00 2001 From: Shihab Dider Date: Sat, 21 Oct 2023 09:22:37 -0400 Subject: [PATCH] feat: Add JaBbA workflow wiring Some parameters were removed since they are no longer present in the current jba executable. Others were modified. Did not add ASCAT since the default purity/ploidy caller is actually sequenza which is imported by default (the JaBbA docker container also has it installed). --- modules/local/jabba/main.nf | 97 ++++++++++++++++++++++++-------- nextflow.config | 42 ++++++++------ subworkflows/local/jabba/main.nf | 91 ++++++++++++++++++++++++++++++ workflows/heisenbio.nf | 77 ++++++++++++++++++++++++- 4 files changed, 262 insertions(+), 45 deletions(-) create mode 100644 subworkflows/local/jabba/main.nf diff --git a/modules/local/jabba/main.nf b/modules/local/jabba/main.nf index 14ef678..b6ab61f 100644 --- a/modules/local/jabba/main.nf +++ b/modules/local/jabba/main.nf @@ -8,33 +8,43 @@ process JABBA { input: tuple val(meta), path(cov_rds) - tuple val(meta), path(junctionFilePath) - val(field) - path(junctionUnfiltered) + tuple val(meta), path(junction) + path(j_supp) + path(blacklist_junctions) + val(geno) + val(indel) val(tfield) - path(cbs_nseg_rds) + val(iter) + val(rescue_window) + val(rescue_all) + val(nudgebalanced) + val(edgenudge) + val(strict) + val(allin) + val(field) path(cbs_seg_rds) - val(slack) + val(maxna) + path(blacklist_coverage) + path(cbs_nseg_rds) path(het_pileups_wgs) - val(purity) val(ploidy) - val(tilim) - val(epgap) + val(purity) val(pp_method) - val(maxna) - val(flags) - path(blacklist_coverage) - path(blacklist_junctions) - val(iter) - val(pair) - val(indel) val(cnsignif) + val(slack) + val(linear) + val(tilim) + val(epgap) + val(outdir) + val(name) + val(fix_thres) val(lp) val(ism) - val(treemem) - val(fix_thres) + val(filter_loose) val(gurobi) val(nonintegral) + val(verbose) + val(help) output: tuple val(meta), path("*.jabba.simple.rds") , emit: jabba_rds, optional: true @@ -53,12 +63,7 @@ process JABBA { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = '1.1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. - - // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 - // If the software is unable to output a version number on the command-line then it can be manually specified - // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf - // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) + def VERSION = '1.1' """ #!/bin/bash @@ -95,7 +100,46 @@ process JABBA { echo $jba set +x - export cmd="Rscript $jba \$@" + export cmd="Rscript $jba $cov_rds $junction \\ + --j.supp $j_supp \\ + --blacklist.junctions $blacklist_junctions \\ + --geno $geno \\ + --indel $indel \\ + --tfield $tfield \\ + --iterate $iter \\ + --rescue.window $rescue_window \\ + --rescue.all $rescue_all \\ + --nudgebalanced $nudgebalanced \\ + --edgenudge $edgenudge \\ + --strict $strict \\ + --allin $allin \\ + --field $field \\ + --seg $cbs_seg_rds \\ + --maxna $maxna \\ + --blacklist.coverage $blacklist_coverage \\ + --nseg $cbs_nseg_rds \\ + --hets $het_pileups_wgs \\ + --ploidy $ploidy \\ + --purity $purity \\ + --ppmethod $pp_method \\ + --cnsignif $cnsignif \\ + --slack $slack \\ + --linear $linear \\ + --tilim $tilim \\ + --epgap $epgap \\ + --outdir $outdir \\ + --name $name \\ + --cores $task.cpus \\ + --mem $task.mem \\ + --fix.thres $fix_thres \\ + --lp $lp \\ + --ism $ism \\ + --filter_loose $filter_loose \\ + --gurobi $gurobi \\ + --nonintegral $nonintegral \\ + --verbose $verbose \\ + --help $help \\ + " { echo "Running:" && echo "\$(echo $cmd)" && echo && eval $cmd; } cmdsig=\$? @@ -107,6 +151,11 @@ process JABBA { fi exit 0 + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + JaBbA: ${VERSION} + END_VERSIONS """ stub: diff --git a/nextflow.config b/nextflow.config index 6951d53..3c5a7d3 100644 --- a/nextflow.config +++ b/nextflow.config @@ -75,32 +75,38 @@ params { build_dryclean = "hg19" // JaBbA options - field = "ratio" - junctionUnfiltered = file("/dev/null") + blacklist_junctions = "/dev/null" + geno = "FALSE" + indel = "exclude" tfield = "tier" - cbs_nseg_rds = file("/dev/null") - cbs_seg_rds = file("/dev/null") - slack = 100 - het_pileups_wgs = file("/dev/null") - purity = "NA" + iter = 2 + rescue_window = 10000 + rescue_all = "TRUE" + nudgebalanced = "TRUE" + edgenudge = 0.1 + strict = "FALSE" + allin = "FALSE" + field = "foreground" + cbs_seg_rds = "/dev/null" + maxna = 0.9 + cbs_nseg_rds = "/dev/null" + het_pileups_wgs = "/dev/null" ploidy = "NA" - tilim = 6000 - epgap = 1e-8 + purity = "NA" pp_method = "ppgrid" - maxna = 0.8 - flags = "" - blacklist_coverage = file("/dev/null") - blacklist_junctions = file("/dev/null") - iter = 0 - pair = "tumor" - indel = "exclude" cnsignif = 0.00001 + slack = 100 + linear = "TRUE" + tilim = 7200 + epgap = 1e-8 + fix_thres = -1 lp = "TRUE" ism = "TRUE" - treemem = 16 - fix_thres = -1 + filter_loose = "FALSE" gurobi = "FALSE" nonintegral = "FALSE" + verbose = "TRUE" + help = "FALSE" // Variant Calling only_paired_variant_calling = false // if true, skips germline variant calling for normal-paired samples diff --git a/subworkflows/local/jabba/main.nf b/subworkflows/local/jabba/main.nf new file mode 100644 index 0000000..a707d2a --- /dev/null +++ b/subworkflows/local/jabba/main.nf @@ -0,0 +1,91 @@ +// +// JaBbA +// + +include { JABBA } from '../../../modules/local/jabba/main.nf' + +workflow COV_JUNC_JABBA { + + take: + cov_rds_jabba + junction_jabba + j_supp_jabba + blacklist_junctions_jabba + geno_jabba + indel_jabba + tfield_jabba + iter_jabba + rescue_window_jabba + rescue_all_jabba + nudgebalanced_jabba + edgenudge_jabba + strict_jabba + allin_jabba + field_jabba + cbs_seg_rds_jabba + maxna_jabba + blacklist_coverage_jabba + cbs_nseg_rds_jabba + het_pileups_wgs_jabba + ploidy_jabba + purity_jabba + pp_method_jabba + cnsignif_jabba + slack_jabba + linear_jabba + tilim_jabba + epgap_jabba + outdir_jabba + name_jabba + fix_thres_jabba + lp_jabba + ism_jabba + filter_loose_jabba + gurobi_jabba + nonintegral_jabba + verbose_jabba + help_jabba + + main: + versions = Channel.empty() + jabba_rds = Channel.empty() + jabba_gg = Channel.empty() + jabba_vcf = Channel.empty() + jabba_raw_rds = Channel.empty() + opti = Channel.empty() + jabba_seg = Channel.empty() + karyograph = Channel.empty() + + JABBA(cov_rds_jabba, junction_jabba, j_supp_jabba, + blacklist_junctions_jabba, geno_jabba, indel_jabba, tfield_jabba, + iter_jabba, rescue_window_jabba, rescue_all_jabba, nudgebalanced_jabba, + edgenudge_jabba, strict_jabba, allin_jabba, field_jabba, cbs_seg_rds_jabba, + maxna_jabba, blacklist_coverage_jabba, cbs_nseg_rds_jabba, + het_pileups_wgs_jabba, ploidy_jabba, purity_jabba, pp_method_jabba, + cnsignif_jabba, slack_jabba, linear_jabba, tilim_jabba, epgap_jabba, + outdir_jabba, name_jabba, fix_thres_jabba, lp_jabba, ism_jabba, + filter_loose_jabba, gurobi_jabba, nonintegral_jabba, verbose_jabba, + help_jabba) + + jabba_rds = JABBA.out.jabba_rds + jabba_gg = JABBA.out.jabba_gg + jabba_vcf = JABBA.out.jabba_vcf + jabba_raw_rds = JABBA.out.jabba_raw_rds + opti = JABBA.out.opti + jabba_seg = JABBA.out.jabba_seg + karyograph = JABBA.out.karyograph + + versions = JABBA.out.versions + + emit: + jabba_rds + jabba_gg + jabba_vcf + jabba_raw_rds + opti + jabba_seg + karyograph + + versions +} + diff --git a/workflows/heisenbio.nf b/workflows/heisenbio.nf index 80d9664..8955d12 100644 --- a/workflows/heisenbio.nf +++ b/workflows/heisenbio.nf @@ -49,6 +49,7 @@ def checkPathParamList = [ params.pon, params.pon_tbi, params.pon_dryclean + params.blacklist_coverage ] // only check if we are using the tools if (params.tools && params.tools.contains("snpeff")) checkPathParamList.add(params.snpeff_cache) @@ -167,7 +168,20 @@ input_sample = ch_from_samplesheet error("Samplesheet contains bam files but step is `$params.step`. Please check your samplesheet or adjust the step parameter.") } - # else if (vcf && cov) {} + // JaBbA + } else if (vcf && cov) { + meta = meta + [id: meta.sample, data_type: 'vcf'] + meta = meta + [id: meta.sample, data_type: 'cov'] + if (params.step == 'jabba') { + meta = [ meta - meta.subMap('lane'), vcf ] + meta = [ meta - meta.subMap('lane'), cov ] + return meta + } + else { + error("Samplesheet contains cov rds and vcf files but step is `$params.step`. Please check your samplesheet or adjust the step parameter.") + } + } + // annotation } else if (vcf) { meta = meta + [id: meta.sample, data_type: 'vcf', variantcaller: variantcaller ?: ''] @@ -230,7 +244,7 @@ simple_seq_db = params.simple_seq_db ? Channel.fromPath(params.simple_ blacklist_gridss = params.blacklist_gridss ? Channel.fromPath(params.blacklist_gridss).collect() : Channel.empty() // This is the mask for gridss SV calls pon_gridss = params.pon_gridss ? Channel.fromPath(params.pon_gridss).collect() : Channel.empty() //This is the pon directory for GRIDSS SOMATIC. (MUST CONTAIN .bed and .bedpe files) gcmapdir_frag = params.gcmapdir_frag ? Channel.fromPath(params.gcmapdir_frag).collect() : Channel.empty() // This is the GC/Mappability directory for fragCounter. (Must contain gc* & map* .rds files) -blacklist_cov_jab = params.blacklist_cov_jab ? Channel.fromPath(params.blacklist_cov_jab).collect() : Channel.empty() // JaBbA +blacklist_cov_jab = params.blacklist_coverage_jabba ? Channel.fromPath(params.blacklist_cov_jab).collect() : Channel.empty() // JaBbA pon_dryclean = params.pon_dryclean ? Channel.fromPath(params.pon_dryclean).collect() : Channel.empty() // This is the path to the PON for Dryclean. blacklist_path_dryclean = params.blacklist_path_dryclean ? Channel.fromPath(params.blacklist_path_dryclean).collect() : Channel.empty() // This is the path to the blacklist for Dryclean (optional). germline_file_dryclean = params.germline_file_dryclean ? Channel.fromPath(params.germline_file_dryclean).collect() : Channel.empty() // This is the path to the germline mask for dryclean (optional). @@ -261,6 +275,43 @@ human_dryclean = params.human_dryclean ?: Channel.empty field_dryclean = params.field_dryclean ?: Channel.empty() build_dryclean = params.build_dryclean ?: Channel.empty() +// JaBbA +j_supp_jabba = params.j_supp_jabba ?: Channel.empty() +blacklist_junctions_jabba = params.blacklist_junctions_jabba ?: Channel.empty() +geno_jabba = params.geno_jabba ?: Channel.empty() +indel_jabba = params.indel_jabba ?: Channel.empty() +tfield_jabba = params.tfield_jabba ?: Channel.empty() +iter_jabba = params.iter_jabba ?: Channel.empty() +rescue_window_jabba = params.rescue_window_jabba ?: Channel.empty() +rescue_all_jabba = params.rescue_all_jabba ?: Channel.empty() +nudgebalanced_jabba = params.nudgebalanced_jabba ?: Channel.empty() +edgenudge_jabba = params.edgenudge_jabba ?: Channel.empty() +strict_jabba = params.strict_jabba ?: Channel.empty() +allin_jabba = params.allin_jabba ?: Channel.empty() +field_jabba = params.field_jabba ?: Channel.empty() +cbs_seg_rds_jabba = params.cbs_seg_rds_jabba ?: Channel.empty() +maxna_jabba = params.maxna_jabba ?: Channel.empty() +blacklist_coverage_jabba = params.blacklist_coverage_jabba ?: Channel.empty() +cbs_nseg_rds_jabba = params.cbs_nseg_rds_jabba ?: Channel.empty() +het_pileups_wgs_jabba = params.het_pileups_wgs_jabba ?: Channel.empty() +ploidy_jabba = params.ploidy_jabba ?: Channel.empty() +purity_jabba = params.purity_jabba ?: Channel.empty() +pp_method_jabba = params.pp_method_jabba ?: Channel.empty() +cnsignif_jabba = params.cnsignif_jabba ?: Channel.empty() +slack_jabba = params.slack_jabba ?: Channel.empty() +linear_jabba = params.linear_jabba ?: Channel.empty() +tilim_jabba = params.tilim_jabba ?: Channel.empty() +epgap_jabba = params.epgap_jabba ?: Channel.empty() +outdir_jabba = params.outdir_jabba ?: Channel.empty() +name_jabba = params.name_jabba ?: Channel.empty() +fix_thres_jabba = params.fix_thres_jabba ?: Channel.empty() +lp_jabba = params.lp_jabba ?: Channel.empty() +ism_jabba = params.ism_jabba ?: Channel.empty() +filter_loose_jabba = params.filter_loose_jabba ?: Channel.empty() +gurobi_jabba = params.gurobi_jabba ?: Channel.empty() +nonintegral_jabba = params.nonintegral_jabba ?: Channel.empty() +verbose_jabba = params.verbose_jabba ?: Channel.empty() +help_jabba = params.help_jabba ?: Channel.empty() // Initialize files channels based on params, not defined within the params.genomes[params.genome] scope if (params.snpeff_cache && params.tools && params.tools.contains("snpeff")) { @@ -366,6 +417,7 @@ include { BAM_FRAGCOUNTER as NORMAL_FRAGCOUNTER } from '../subworkflows/l include { COV_DRYCLEAN as DRYCLEAN } from '../subworkflows/local/dryclean/main' +include { COV_VCF_JABBA as JABBA } from '../subworkflows/local/jabba/main' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RUN MAIN WORKFLOW @@ -893,7 +945,7 @@ workflow HEISENBIO { } // TODO: CHANNEL_SVCALLING_CREATE_CSV(vcf_from_sv_calling, params.tools, params.outdir) // Need to fix this!!!!! - + cram_coverage_calling = cram_sv_calling } @@ -959,6 +1011,25 @@ workflow HEISENBIO { dryclean_cov = Channel.empty().mix(DRYCLEAN.out.dryclean_cov) } } + + if (params.step in ['alignment', 'markduplicates', 'prepare_recalibration', 'recalibrate', 'sv_calling', 'coverage', 'jabba']) { + JABBA(dryclean_cov, vcf_from_sv_calling , field_jabba, tfield_jabba, + cbs_nseg_rds_jabba, cbs_seg_rds_jabba, slack_jabba, het_pileups_wgs_jabba, + purity_jabba, ploidy_jabba, tilim_jabba, epgap_jabba, pp_method_jabba, + maxna_jabba, blacklist_coverage_jabba, blacklist_junctions_jabba, + iter_jabba, indel_jabba, cnsignif_jabba, lp_jabba, ism_jabba, + fix_thres_jabba, filter_loose_jabba, gurobi_jabba) + + jabba_rds = Channel.empty().mix(JABBA.out.jabba_rds) + jabba_gg = Channel.empty().mix(JABBA.out.jabba_gg) + jabba_vcf = Channel.empty().mix(JABBA.out.jabba_vcf) + jabba_raw_rds = Channel.empty().mix(JABBA.out.jabba_raw_rds) + opti = Channel.empty().mix(JABBA.out.opti) + jabba_seg = Channel.empty().mix(JABBA.out.jabba_seg) + karyograph = Channel.empty().mix(JABBA.out.karyograph) + versions = versions.mix(JABBA.out.versions) + } + } }