diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 8affd23bfe..56dcd9b0b6 100755 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -267,14 +267,15 @@ def validate_wf_name_prompt(ctx, opts, value): @click.option("--no-git", is_flag=True, default=False, help="Do not initialise pipeline as new git repository") @click.option("-f", "--force", is_flag=True, default=False, help="Overwrite output directory if it already exists") @click.option("-o", "--outdir", type=str, help="Output directory for new pipeline (default: pipeline name)") -def create(name, description, author, version, no_git, force, outdir): +@click.option("-p", "--prefix", type=str, default="nf-core", help="Pipeline prefix organisation (default: nf-core)") +def create(name, description, author, version, no_git, force, outdir, prefix): """ Create a new pipeline using the nf-core template. Uses the nf-core template to make a skeleton Nextflow pipeline with all required files, boilerplate code and bfest-practices. """ - create_obj = nf_core.create.PipelineCreate(name, description, author, version, no_git, force, outdir) + create_obj = nf_core.create.PipelineCreate(name, description, author, prefix, version, no_git, force, outdir) create_obj.init_pipeline() diff --git a/nf_core/create.py b/nf_core/create.py index 3fa3baeda0..5b867774b1 100644 --- a/nf_core/create.py +++ b/nf_core/create.py @@ -34,11 +34,12 @@ class PipelineCreate(object): outdir (str): Path to the local output directory. """ - def __init__(self, name, description, author, version="1.0dev", no_git=False, force=False, outdir=None): - self.short_name = name.lower().replace(r"/\s+/", "-").replace("nf-core/", "").replace("/", "-") - self.name = f"nf-core/{self.short_name}" + def __init__(self, name, description, author, prefix="nf-core", version="1.0dev", no_git=False, force=False, outdir=None): + self.short_name = name.lower().replace(r"/\s+/", "-").replace(f"{prefix}/", "").replace("/", "-") + self.name = f"{prefix}/{self.short_name}" self.name_noslash = self.name.replace("/", "-") - self.name_docker = self.name.replace("nf-core", "nfcore") + self.prefix_nodash = prefix.replace("-","") + self.name_docker = self.name.replace(prefix, self.prefix_nodash) self.logo_light = f"{self.name}_logo_light.png" self.logo_dark = f"{self.name}_logo_dark.png" self.description = description @@ -47,6 +48,7 @@ def __init__(self, name, description, author, version="1.0dev", no_git=False, fo self.no_git = no_git self.force = force self.outdir = outdir + self.branded = prefix == "nf-core" if not self.outdir: self.outdir = os.path.join(os.getcwd(), self.name_noslash) diff --git a/nf_core/pipeline-template/lib/NfcoreTemplate.groovy b/nf_core/pipeline-template/lib/NfcoreTemplate.groovy index 2fc0a9b9b6..2894a6dd23 100755 --- a/nf_core/pipeline-template/lib/NfcoreTemplate.groovy +++ b/nf_core/pipeline-template/lib/NfcoreTemplate.groovy @@ -244,12 +244,12 @@ class NfcoreTemplate { Map colors = logColours(monochrome_logs) String.format( """\n - ${dashedLine(monochrome_logs)} + ${dashedLine(monochrome_logs)}{% if branded %} ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} - ${colors.green}`._,._,\'${colors.reset} + ${colors.green}`._,._,\'${colors.reset}{% endif %} ${colors.purple} ${workflow.manifest.name} v${workflow.manifest.version}${colors.reset} ${dashedLine(monochrome_logs)} """.stripIndent() diff --git a/nf_core/pipeline-template/main.nf b/nf_core/pipeline-template/main.nf index 104784f8ea..7b26f18c5f 100644 --- a/nf_core/pipeline-template/main.nf +++ b/nf_core/pipeline-template/main.nf @@ -4,8 +4,10 @@ {{ name }} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Github : https://github.com/{{ name }} +{% if branded -%} Website: https://nf-co.re/{{ short_name }} Slack : https://nfcore.slack.com/channels/{{ short_name }} +{% endif -%} ---------------------------------------------------------------------------------------- */ @@ -38,7 +40,7 @@ include { {{ short_name|upper }} } from './workflows/{{ short_name }}' // // WORKFLOW: Run main {{ name }} analysis pipeline // -workflow NFCORE_{{ short_name|upper }} { +workflow {{ prefix_nodash|upper }}_{{ short_name|upper }} { {{ short_name|upper }} () } @@ -53,7 +55,7 @@ workflow NFCORE_{{ short_name|upper }} { // See: https://github.com/nf-core/rnaseq/issues/619 // workflow { - NFCORE_{{ short_name|upper }} () + {{ prefix_nodash|upper }}_{{ short_name|upper }} () } /*