Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ lint:
- docs/images/nf-core-sarek_logo_dark.png
- docs/images/nf-core-sarek_logo_light.png
- lib/NfcoreTemplate.groovy
- lib/NfcoreSchema.groovy
template_strings: False
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#941](https://github.com/nf-core/sarek/pull/941) - Fix json validation for `tools`, `skip_tools` and `use_gatk_spark` [#892](https://github.com/nf-core/sarek/issues/892)
- [#954](https://github.com/nf-core/sarek/pull/954) - Fix missing annotation keys with snpeff and ensemblvep for `hg19`
- [#957](https://github.com/nf-core/sarek/pull/957) - Add `failOnDuplicate` and `failOnMismatch` options to all `join()` operator where it was possible
- [#982](https://github.com/nf-core/sarek/pull/982) - Remove usage of exit statements, using `Nextflow.error` instead

### Deprecated

Expand Down
3 changes: 2 additions & 1 deletion lib/NfcoreSchema.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file holds several functions used to perform JSON parameter validation, help and summary rendering for the nf-core pipeline template.
//

import nextflow.Nextflow
import org.everit.json.schema.Schema
import org.everit.json.schema.loader.SchemaLoader
import org.everit.json.schema.ValidationException
Expand Down Expand Up @@ -177,7 +178,7 @@ class NfcoreSchema {
}

if (has_error) {
System.exit(1)
Nextflow.error('Exiting!')
}
}

Expand Down
25 changes: 12 additions & 13 deletions lib/WorkflowSarek.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file holds several functions specific to the workflow/sarek.nf in the nf-core/sarek pipeline
//

import nextflow.Nextflow
import groovy.text.SimpleTemplateEngine

class WorkflowSarek {
Expand All @@ -14,8 +15,7 @@ class WorkflowSarek {


if (!params.fasta) {
log.error "Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file."
System.exit(1)
Nextflow.error("Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file.")
}
}

Expand Down Expand Up @@ -66,39 +66,38 @@ class WorkflowSarek {
//
private static void genomeExistsError(params, log) {
if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) {
log.error "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" Genome '${params.genome}' not found in any config files provided to the pipeline.\n" +
" Currently, the available genome keys are:\n" +
" ${params.genomes.keySet().join(", ")}\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
System.exit(1)
Nextflow.error(error_string)
}
}

public static String retrieveInput(params, log){
if (!params.build_only_index) {
switch (params.step) {
case 'mapping': log.warn "Can't start with step $params.step without samplesheet"
System.exit(1);
case 'mapping': Nextflow.error("Can't start with step $params.step without samplesheet")
break
case 'markduplicates': log.warn "Using file ${params.outdir}/csv/mapped.csv"
case 'markduplicates': log.warn("Using file ${params.outdir}/csv/mapped.csv")
params.putIfAbsent("input","${params.outdir}/csv/mapped.csv");
break
case 'prepare_recalibration': log.warn "Using file ${params.outdir}/csv/markduplicates_no_table.csv"
case 'prepare_recalibration': log.warn("Using file ${params.outdir}/csv/markduplicates_no_table.csv")
params.putIfAbsent("input", "${params.outdir}/csv/markduplicates_no_table.csv");
break
case 'recalibrate': log.warn "Using file ${params.outdir}/csv/markduplicates.csv"
case 'recalibrate': log.warn("Using file ${params.outdir}/csv/markduplicates.csv")
params.putIfAbsent("input", "${params.outdir}/csv/markduplicates.csv");
break
case 'variant_calling': log.warn "Using file ${params.outdir}/csv/recalibrated.csv"
case 'variant_calling': log.warn("Using file ${params.outdir}/csv/recalibrated.csv")
params.putIfAbsent("input", "${params.outdir}/csv/recalibrated.csv");
break
// case 'controlfreec': csv_file = file("${params.outdir}/variant_calling/csv/control-freec_mpileup.csv", checkIfExists: true); break
case 'annotate': log.warn "Using file ${params.outdir}/csv/variantcalled.csv"
case 'annotate': log.warn("Using file ${params.outdir}/csv/variantcalled.csv")
params.putIfAbsent("input","${params.outdir}/csv/variantcalled.csv");
break
default: log.warn "Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'"
exit 1, "Unknown step $params.step"
default: log.warn("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'")
Nextflow.error("Unknown step $params.step")
}
}
}
Expand Down
Loading