Skip to content

Commit

Permalink
support remote paths in NfCoreTemplate:dump_parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
fbdtemme committed Oct 9, 2023
1 parent 9ab896c commit ce457a2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions nf_core/pipeline-template/lib/NfcoreTemplate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import org.yaml.snakeyaml.Yaml
import groovy.json.JsonOutput
import nextflow.extension.FilesEx

class NfcoreTemplate {

Expand Down Expand Up @@ -227,15 +228,15 @@ class NfcoreTemplate {
// Dump pipeline parameters in a json file
//
public static void dump_parameters(workflow, params) {
def output_d = new File("${params.outdir}/pipeline_info/")
if (!output_d.exists()) {
output_d.mkdirs()
}

def timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss')
def output_pf = new File(output_d, "params_${timestamp}.json")
def filename = "params_${timestamp}.json"
def temp_pf = new File(workflow.launchDir.toString(), ".${filename}")
def jsonStr = JsonOutput.toJson(params)
output_pf.text = JsonOutput.prettyPrint(jsonStr)
temp_pf.text = JsonOutput.prettyPrint(jsonStr)

def destination = "${params.outdir}/pipeline_info/params_${timestamp}.json"
FilesEx.copyTo(temp_pf.toPath(), destination)
temp_pf.delete()
}

//
Expand Down

0 comments on commit ce457a2

Please sign in to comment.