Skip to content

Commit

Permalink
Merge pull request #1062 from maxulysse/restart
Browse files Browse the repository at this point in the history
FIX: automatic restart from step
  • Loading branch information
maxulysse authored Jun 2, 2023
2 parents 2848c6d + 0a7b08d commit 933bddb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Bierikjávrre is one of the largest lake in Sarek.
- [#1050](https://github.com/nf-core/sarek/pull/1050) - Disable GATK VCF filters when joint calling to fix [#1025](https://github.com/nf-core/sarek/issues/1025)
- [#1055](https://github.com/nf-core/sarek/pull/1055) - Fix pattern for fasta file in the json schema
- [#1058](https://github.com/nf-core/sarek/pull/1058) - Fix container declaration for VCFTOOLS as it has been updated in the registry
- [#1062](https://github.com/nf-core/sarek/pull/1062) - Fix automatic restart from steps

### Removed

Expand Down
1 change: 0 additions & 1 deletion lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class WorkflowMain {
// Check input has been provided
if (!params.input && !params.build_only_index) {
log.warn "No samplesheet specified, attempting to restart from csv files present in ${params.outdir}"
WorkflowSarek.retrieveInput(params, log)
}
}
//
Expand Down
25 changes: 14 additions & 11 deletions lib/WorkflowSarek.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,32 @@ class WorkflowSarek {
}

public static String retrieveInput(params, log){
if (!params.build_only_index) {
def input = ''
if (params.input) input = params.input
else {
switch (params.step) {
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")
params.putIfAbsent("input","${params.outdir}/csv/mapped.csv");
case 'markduplicates': log.warn("Using file ${params.outdir}/csv/mapped.csv");
input = params.outdir + "/csv/mapped.csv"
break
case 'prepare_recalibration': log.warn("Using file ${params.outdir}/csv/markduplicates_no_table.csv")
params.putIfAbsent("input", "${params.outdir}/csv/markduplicates_no_table.csv");
case 'prepare_recalibration': log.warn("Using file ${params.outdir}/csv/markduplicates_no_table.csv");
input = params.outdir + "/csv/markduplicates_no_table.csv"
break
case 'recalibrate': log.warn("Using file ${params.outdir}/csv/markduplicates.csv")
params.putIfAbsent("input", "${params.outdir}/csv/markduplicates.csv");
case 'recalibrate': log.warn("Using file ${params.outdir}/csv/markduplicates.csv");
input = params.outdir + "/csv/markduplicates.csv"
break
case 'variant_calling': log.warn("Using file ${params.outdir}/csv/recalibrated.csv")
params.putIfAbsent("input", "${params.outdir}/csv/recalibrated.csv");
case 'variant_calling': log.warn("Using file ${params.outdir}/csv/recalibrated.csv");
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")
params.putIfAbsent("input","${params.outdir}/csv/variantcalled.csv");
case 'annotate': log.warn("Using file ${params.outdir}/csv/variantcalled.csv");
input = params.outdir + "/csv/variantcalled.csv"
break
default: log.warn("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'")
Nextflow.error("Unknown step $params.step")
}
}
return input
}
}
2 changes: 1 addition & 1 deletion workflows/sarek.nf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def checkPathParamList = [
for (param in checkPathParamList) if (param) file(param, checkIfExists: true)

// Set input, can either be from --input or from automatic retrieval in WorkflowSarek.groovy
input_sample = params.build_only_index ? Channel.empty() : extract_csv(file(params.input, checkIfExists: true))
input_sample = params.build_only_index ? Channel.empty() : extract_csv(file(WorkflowSarek.retrieveInput(params, log), checkIfExists: true))

// Fails when wrongfull extension for intervals file
if (params.wes && !params.step == 'annotate') {
Expand Down

0 comments on commit 933bddb

Please sign in to comment.