Skip to content

Commit

Permalink
fix linting + reimplement only_call and only_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nvnieuwk committed Nov 5, 2024
1 parent 76a86a2 commit 6eaf981
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
4 changes: 2 additions & 2 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ process {
withName: "^.*VCF_FILTER_BCFTOOLS:FILTER_1\$" {
ext.prefix = { "${meta.id}.filtered1" }
ext.args = {
meta.caller == "vardict" ?
meta.caller == "vardict" ?
"-i 'QUAL >= 0${params.only_pass ? " && FILTER=\"PASS\"" : ""}' --output-type z":
meta.caller == "haplotypecaller" ?
"--output-type z --soft-filter 'GATKCutoffSNP' -e 'TYPE=\"snp\" && (MQRankSum < -12.5 || ReadPosRankSum < -8.0 || QD < 2.0 || FS > 60.0 || MQ < 30.0)' -m '+'":
Expand All @@ -378,7 +378,7 @@ process {
}

withName: "^.*VCF_FILTER_BCFTOOLS:FILTER_2\$" {
ext.args = {
ext.args = {
meta.caller == "vardict" ?
"--soft-filter 'LowFreqBias' --mode '+' -e 'FORMAT/AF[0:*] < 0.02 && FORMAT/VD[0] < 30 && INFO/SBF < 0.1 && INFO/NM >= 2.0' --output-type z" :
meta.caller == "haplotypecaller" ?
Expand Down
18 changes: 18 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,24 @@
"format": "path",
"fa_icon": "fas fa-folder"
},
"elfasta": {
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/plain",
"pattern": "^\\S+\\.elfasta$",
"description": "Path to the ELFASTA genome file. This is used when `elprep` is part of the callers and will be automatically generated when missing.",
"fa_icon": "far fa-file-code"
},
"elsites": {
"type": "string",
"format": "file-path",
"exists": true,
"mimetype": "text/plain",
"pattern": "^\\S+\\.elsites$",
"description": "Path to the elsites file. This is used when `elprep` is part of the callers.",
"fa_icon": "far fa-file-code"
},
"genomes_base": {
"type": "string",
"default": "/references/",
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/local/bam_call_elprep/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ workflow BAM_CALL_ELPREP {
false
)
ch_versions = ch_versions.mix(ELPREP_FILTER.out.versions.first())

VCF_CONCAT_BCFTOOLS(
ELPREP_FILTER.out.gvcf,
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ nextflow_workflow {
},
workflow.out.ready_bams.collect {
[ it[0], "${file(it[1]).name},readsMD5:${bam(it[1]).getReadsMD5()}", file(it[2]).name ]
},
},
workflow.out.ready_beds,
workflow.out.reports
).match("default - WGS") }
Expand Down Expand Up @@ -93,7 +93,7 @@ nextflow_workflow {
},
workflow.out.ready_bams.collect {
[ it[0], "${file(it[1]).name},readsMD5:${bam(it[1]).getReadsMD5()}", file(it[2]).name ]
},
},
workflow.out.ready_beds,
workflow.out.reports
).match("default - WES common ROI") }
Expand Down Expand Up @@ -140,7 +140,7 @@ nextflow_workflow {
},
workflow.out.ready_bams.collect {
[ it[0], "${file(it[1]).name},readsMD5:${bam(it[1]).getReadsMD5()}", file(it[2]).name ]
},
},
workflow.out.ready_beds,
workflow.out.reports
).match("default - WES") }
Expand Down
12 changes: 8 additions & 4 deletions workflows/germline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ workflow GERMLINE {
//
// Run sample preparation
//

def create_bam_files = callers.intersect(GlobalVariables.bamCallers).size() > 0 // Only create BAM files when needed
CRAM_PREPARE_SAMTOOLS_BEDTOOLS(
ch_input.cram.filter { meta, _cram, _crai ->
Expand Down Expand Up @@ -491,10 +491,11 @@ workflow GERMLINE {
ch_calls = ch_calls.mix(BAM_CALL_VARDICTJAVA.out.vcfs)
}

// TODO reimplement --only_call and --only_merge
// Stop pipeline execution when only calls should happen
def ch_gvcfs_final = ch_gvcfs_ready.filter { !only_call }

GVCF_JOINT_GENOTYPE_GATK4(
ch_gvcfs_ready,
ch_gvcfs_final,
ch_fasta_ready,
ch_fai_ready,
ch_dict_ready,
Expand All @@ -506,7 +507,10 @@ workflow GERMLINE {
ch_versions = ch_versions.mix(GVCF_JOINT_GENOTYPE_GATK4.out.versions)
ch_calls = ch_calls.mix(GVCF_JOINT_GENOTYPE_GATK4.out.vcfs)

def ch_called_variants = ch_calls
// Stop pipeline execution when only the merge should happen
def ch_calls_final = ch_calls.filter { !only_merge }

def ch_called_variants = ch_calls_final
.map { meta, vcf, tbi ->
def new_meta = meta - meta.subMap(["type", "vardict_min_af"])
[ new_meta, vcf, tbi ]
Expand Down

0 comments on commit 6eaf981

Please sign in to comment.