-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove lib directory and replace with atomic subworkflows #213
Conversation
|
include { PIPELINE_INITIALISATION } from './subworkflows/local/nf_core_fetchngs_utils' | ||
include { PIPELINE_COMPLETION } from './subworkflows/local/nf_core_fetchngs_utils' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include statements should be near the top in one consistent place (i.e. like other programming languages).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll fix it later
======================================================================================== | ||
*/ | ||
|
||
workflow NEXTFLOW_PIPELINE_UTILS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better name than auxiliary 👍
def dumpParametersToJSON(output_directory) { | ||
def output_d = new File("${output_directory}/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 jsonStr = JsonOutput.toJson(params) | ||
output_pf.text = JsonOutput.prettyPrint(jsonStr) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about parameterising the output path directly rather than trying to create a new file with a fixed name:
!! UNTESTED !!
def dumpParametersToJSON(output_directory) { | |
def output_d = new File("${output_directory}/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 jsonStr = JsonOutput.toJson(params) | |
output_pf.text = JsonOutput.prettyPrint(jsonStr) | |
} | |
def dumpParametersToJSON(output) { | |
def output_pf = new File(output) | |
def output_d = output.getParent() | |
if (!output_d.exists()) { | |
output_d.mkdirs() | |
} | |
def timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') | |
def jsonStr = JsonOutput.toJson(params) | |
output_pf.text = JsonOutput.prettyPrint(jsonStr) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would then need to use
def outfile = ${output_directory}/pipeline_info/params_${timestamp}.json
dumpParametersToJSON(outfile)
NEXTFLOW_PIPELINE_UTILS ( | ||
params.version, | ||
true, | ||
params.outdir, | ||
workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1 | ||
) | ||
|
||
// | ||
// Validate parameters and generate parameter summary to stdout | ||
// | ||
def pre_help_text = nfCoreLogo(getWorkflowVersion()) | ||
def post_help_text = '\n' + workflowCitation() + '\n' + dashedLine() | ||
def String workflow_command = "nextflow run ${workflow.manifest.name} -profile <docker/singularity/.../institute> --input ids.csv --outdir <OUTDIR>" | ||
NF_VALIDATION_PLUGIN_UTILS ( | ||
params.help, | ||
workflow_command, | ||
pre_help_text, | ||
post_help_text, | ||
params.validate_params | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like there's a lot going on here, it's difficult for my small brain to follow. Can we simplify the interface at all?
workflow.onComplete { | ||
if (email || email_on_fail) { | ||
completionEmail(summary_params) | ||
} | ||
|
||
completionSummary() | ||
|
||
if (hook_url) { | ||
imNotification(summary_params) | ||
} | ||
|
||
if (input_type == 'sra') { | ||
sraCurateSamplesheetWarn() | ||
} else if (input_type == 'synapse') { | ||
synapseCurateSamplesheetWarn() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A controversial take, but we could move this to nextflow.config...(see the note at the end): https://www.nextflow.io/docs/edge/metadata.html#decoupling-metadata
include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../../../modules/nf-core/custom/dumpsoftwareversions' | ||
include { NEXTFLOW_PIPELINE_UTILS; getWorkflowVersion } from '../nextflow_pipeline_utils' | ||
include { NF_VALIDATION_PLUGIN_UTILS } from '../nf_validation_plugin_utils' | ||
include { NF_CORE_PIPELINE_UTILS; workflowCitation; nfCoreLogo; dashedLine; completionEmail; completionSummary; imNotification } from '../nf_core_pipeline_utils' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like the mixing of functions and subworkflows in the same include statement. Since NF_CORE_PIPELINE_UTILS just runs the check Conda function, why not import that directly and use it? Simpler, easier to understand. We can always wrap it back up later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreeing with @adamrtalbot on that, I'd rather we have each on a single line
workflow NF_CORE_PIPELINE_UTILS { | ||
|
||
main: | ||
checkConfigProvided() | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit superfluous.
No description provided.