Skip to content

Commit

Permalink
Allows for other org prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
robsyme committed May 5, 2022
1 parent e0d00d3 commit 3ec4ca2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
10 changes: 6 additions & 4 deletions nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/lib/NfcoreTemplate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions nf_core/pipeline-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
----------------------------------------------------------------------------------------
*/

Expand Down Expand Up @@ -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 }} ()
}

Expand All @@ -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 }} ()
}

/*
Expand Down

0 comments on commit 3ec4ca2

Please sign in to comment.