8000 Dump pipeline parameters into a json file by JoseEspinosa · Pull Request #2425 · nf-core/tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Dump pipeline parameters into a json file #2425

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

Merged
merged 3 commits into from
Sep 23, 2023
Merged

Conversation

JoseEspinosa
Copy link
Member

Add to the template the snippet proposed on this comment to dump the pipeline parameters into a json file that can be use to re-run the pipeline with the same parameters using the -params-file Nextflow option.

Closes #747

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated

@JoseEspinosa
Copy link
Member Author

Should we also add a --dump_params parameters @ewels to make the creation of the file optional?
You may also come with a better name for the parameter 😓

@mashehu
Copy link
Contributor
mashehu commented Sep 20, 2023

what's the difference to nf-core create-params-file?

@codecov
Copy link
codecov bot commented Sep 20, 2023

Codecov Report

Merging #2425 (d1d9f60) into dev (6b20a81) will not change coverage.
Report is 20 commits behind head on dev.
The diff coverage is 20.83%.

@@           Coverage Diff           @@
##              dev    #2425   +/-   ##
=======================================
  Coverage   71.07%   71.07%           
=======================================
  Files          87       87           
  Lines        9431     9431           
=======================================
  Hits         6703     6703           
  Misses       2728     2728           
Files Changed Coverage Δ
nf_core/download.py 59.35% <20.83%> (ø)

@JoseEspinosa
Copy link
Member Author

what's the difference to nf-core create-params-file?

Here the idea is to keep all the parameters as they have been used for a given execution in a json file for provenance. This should allow running the pipeline again with the exact parameters regardless of whether the user has set these parameters or are the defaults in e.g. the nextflow.config and thus, guarantee full reproducibility of the results. We proposed this to be a Nextflow option as discussed here but in the meantime, we thought it was a good idea to add it to the template. Does it make sense to you?

Comment on lines 236 to 237
def jsonStr = ""
jsonStr = JsonOutput.toJson(params)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def jsonStr = ""
jsonStr = JsonOutput.toJson(params)
def jsonStr = JsonOutput.toJson(params)

output_d.mkdirs()
}

def output_pf = new File(output_d, "params.json")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that this will crash if the file already exists (eg. When resuming a pipeline). We should probably try to avoid this by checking if the file already exists, and/or incorporating a timestamp into the filename.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and it did not crashed but yes, probably better to be in the safe lane, now is updated

Copy link
Member
@mirpedrol mirpedrol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the documentation of the pipeline too, here.

@JoseEspinosa
Copy link
Member Author

I think I have addressed your comments @mirpedrol and @ewels. Do you think we have to create a parameter to control for it?

@mirpedrol
Copy link
Member

Looks OK to me to always generate this file, I wouldn't add a parameter.

@jfy133
Copy link
Member
jfy133 commented Sep 21, 2023

👀 👀 👀 so I know when to try adding to MultiQC ;)

Copy link
Member
@ewels ewels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ewels ewels merged commit 6483100 into nf-core:dev Sep 23, 2023
@ewels
Copy link
Member
ewels commented Sep 23, 2023

👀 👀 👀 so I know when to try adding to MultiQC ;)

@jfy133 its after MultiQC runs, so won't be possible as it stands. It's also all parameters, so very verbose.

@jfy133
Copy link
Member
jfy133 commented Sep 23, 2023

Sure, but presumably one could run the function before on complete, right?

For the verboseness I was expecting that, as a second step I was actually wondering if it would be possible to make a collapsible section in the MultiQC report 😬

1 similar comment
@jfy133
Copy link
Member
jfy133 commented Sep 23, 2023

Sure, but presumably one could run the function before on complete, right?

For the verboseness I was expecting that, as a second step I was actually wondering if it would be possible to make a collapsible section in the MultiQC report 😬

@JoseEspinosa JoseEspinosa deleted the dump_params branch September 26, 2023 07:27
@JoseEspinosa
Copy link
Member Author

@jfy133 yes I also thought about it, probably for the MultiQC report it will be an option to do something similar to what nf-core launch does when creating the params file only for the modified parameters.

@stevekm
Copy link
Contributor
stevekm commented Oct 5, 2023
 public static void dump_parameters(workflow, params) {

maybe a dumb question but why is workflow used as an input argument here? I do not see it referenced anywhere in the function

@stevekm
Copy link
Contributor
stevekm commented Oct 5, 2023

also I am wondering if this would still work if the outdir is an S3 bucket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0