Skip to content
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

nf-core download: customise config to include path to singularity image #464

Closed
ewels opened this issue Nov 26, 2019 · 6 comments · Fixed by #832
Closed

nf-core download: customise config to include path to singularity image #464

ewels opened this issue Nov 26, 2019 · 6 comments · Fixed by #832
Labels
command line tools Anything to do with the cli interfaces download nf-core download

Comments

@ewels
Copy link
Member

ewels commented Nov 26, 2019

We can run nf-core download <pipeline> --singularity to fetch the pipeline files and singularity image.

The code nicely edits the pipeline nextflow.config file so that the custom configs path is relative to the pipeline code for the institutional configs. However, this is not done for the singularity path, so the user still has to use -with-singularity to specify the location for these images.
It would be nice if the tool could edit the configs somehow so that the singularity image is automatically found with just -profile singularity.

Could potentially do this with process.container, or maybe be more clever & generic by setting the singularity cache directory path or something?

@ewels ewels added the command line tools Anything to do with the cli interfaces label Nov 26, 2019
@maxulysse
Copy link
Member

We could maybe play with singularity.cacheDir.
By default they are in work/singularity
We can change that, or download the singularity images there.

Who is using nf-core download to get singularity images?

@ewels
Copy link
Member Author

ewels commented Nov 26, 2019

We will hopefully use it for irma soon :)

@maxulysse
Copy link
Member

maxulysse commented Nov 27, 2019

Yes, but then we don't really need to download the singularity images with nf-core download, but we still would want to set up the path.

EDIT: nevermind, it should be in the confis

@ewels
Copy link
Member Author

ewels commented Jun 29, 2020

Just need to update this function to also edit process.container I guess? Or something similar..

tools/nf_core/download.py

Lines 226 to 243 in ebf6309

def wf_use_local_configs(self):
"""Edit the downloaded nextflow.config file to use the local config files
"""
nfconfig_fn = os.path.join(self.outdir, 'workflow', 'nextflow.config')
find_str = 'https://raw.githubusercontent.com/nf-core/configs/${params.custom_config_version}'
repl_str = '../configs/'
logging.debug("Editing params.custom_config_base in {}".format(nfconfig_fn))
# Load the nextflow.config file into memory
with open(nfconfig_fn, 'r') as nfconfig_fh:
nfconfig = nfconfig_fh.read()
# Replace the target string
nfconfig = nfconfig.replace(find_str, repl_str)
# Write the file out again
with open(nfconfig_fn, 'w') as nfconfig_fh:
nfconfig_fh.write(nfconfig)

@ewels
Copy link
Member Author

ewels commented Feb 1, 2021

Ok, after a bit of testing trial and error, this little gem seems to do the job:

singularity.cacheDir = "${projectDir}/../singularity-images/"

I think we're on to a winner 🎉

@ewels ewels linked a pull request Feb 1, 2021 that will close this issue
8 tasks
@ewels
Copy link
Member Author

ewels commented Feb 17, 2021

Implemented in the upcoming v1.13 release of tools. See #832.

@ewels ewels closed this as completed Feb 17, 2021
@edmundmiller edmundmiller added the download nf-core download label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command line tools Anything to do with the cli interfaces download nf-core download
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants