|
36 | 36 | pipelines_launch, |
37 | 37 | pipelines_lint, |
38 | 38 | pipelines_list, |
| 39 | + pipelines_rocrate, |
39 | 40 | pipelines_schema_build, |
40 | 41 | pipelines_schema_docs, |
41 | 42 | pipelines_schema_lint, |
|
86 | 87 | }, |
87 | 88 | { |
88 | 89 | "name": "For developers", |
89 | | - "commands": ["create", "lint", "bump-version", "sync", "schema", "create-logo"], |
| 90 | + "commands": ["create", "lint", "bump-version", "sync", "schema", "rocrate", "create-logo"], |
90 | 91 | }, |
91 | 92 | ], |
92 | 93 | "nf-core modules": [ |
@@ -570,6 +571,44 @@ def command_pipelines_list(ctx, keywords, sort, json, show_archived): |
570 | 571 | pipelines_list(ctx, keywords, sort, json, show_archived) |
571 | 572 |
|
572 | 573 |
|
| 574 | +# nf-core pipelines rocrate |
| 575 | +@pipelines.command("rocrate") |
| 576 | +@click.argument( |
| 577 | + "pipeline_dir", |
| 578 | + type=click.Path(exists=True), |
| 579 | + default=Path.cwd(), |
| 580 | + required=True, |
| 581 | + metavar="<pipeline directory>", |
| 582 | +) |
| 583 | +@click.option( |
| 584 | + "-j", |
| 585 | + "--json_path", |
| 586 | + default=Path.cwd(), |
| 587 | + type=str, |
| 588 | + help="Path to save RO Crate metadata json file to", |
| 589 | +) |
| 590 | +@click.option("-z", "--zip_path", type=str, help="Path to save RO Crate zip file to") |
| 591 | +@click.option( |
| 592 | + "-pv", |
| 593 | + "--pipeline_version", |
| 594 | + type=str, |
| 595 | + help="Version of pipeline to use for RO Crate", |
| 596 | + default="", |
| 597 | +) |
| 598 | +@click.pass_context |
| 599 | +def rocrate( |
| 600 | + ctx, |
| 601 | + pipeline_dir: str, |
| 602 | + json_path: str, |
| 603 | + zip_path: str, |
| 604 | + pipeline_version: str, |
| 605 | +): |
| 606 | + """ |
| 607 | + Make an Research Object Crate |
| 608 | + """ |
| 609 | + pipelines_rocrate(ctx, pipeline_dir, json_path, zip_path, pipeline_version) |
| 610 | + |
| 611 | + |
573 | 612 | # nf-core pipelines sync |
574 | 613 | @pipelines.command("sync") |
575 | 614 | @click.pass_context |
@@ -1024,7 +1063,7 @@ def command_modules_update( |
1024 | 1063 | default=".", |
1025 | 1064 | help=r"Pipeline directory. [dim]\[default: current working directory][/]", |
1026 | 1065 | ) |
1027 | | -@click.option("-r", "--remove", is_flag=True, default=False) |
| 1066 | +@click.option("-r", "--remove", is_flag=True, default=False, help="Remove an existent patch file and regenerate it.") |
1028 | 1067 | def command_modules_patch(ctx, tool, directory, remove): |
1029 | 1068 | """ |
1030 | 1069 | Create a patch file for minor changes in a module |
@@ -1567,6 +1606,43 @@ def command_subworkflows_install(ctx, subworkflow, directory, prompt, force, sha |
1567 | 1606 | subworkflows_install(ctx, subworkflow, directory, prompt, force, sha) |
1568 | 1607 |
|
1569 | 1608 |
|
| 1609 | +# nf-core subworkflows patch |
| 1610 | +@subworkflows.command("patch") |
| 1611 | +@click.pass_context |
| 1612 | +@click.argument("tool", type=str, required=False, metavar="<tool> or <tool/subtool>") |
| 1613 | +@click.option( |
| 1614 | + "-d", |
| 1615 | + "--dir", |
| 1616 | + type=click.Path(exists=True), |
| 1617 | + default=".", |
| 1618 | + help=r"Pipeline directory. [dim]\[default: current working directory][/]", |
| 1619 | +) |
| 1620 | +@click.option("-r", "--remove", is_flag=True, default=False, help="Remove an existent patch file and regenerate it.") |
| 1621 | +def subworkflows_patch(ctx, tool, dir, remove): |
| 1622 | + """ |
| 1623 | + Create a patch file for minor changes in a subworkflow |
| 1624 | +
|
| 1625 | + Checks if a subworkflow has been modified locally and creates a patch file |
| 1626 | + describing how the module has changed from the remote version |
| 1627 | + """ |
| 1628 | + from nf_core.subworkflows import SubworkflowPatch |
| 1629 | + |
| 1630 | + try: |
| 1631 | + subworkflow_patch = SubworkflowPatch( |
| 1632 | + dir, |
| 1633 | + ctx.obj["modules_repo_url"], |
| 1634 | + ctx.obj["modules_repo_branch"], |
| 1635 | + ctx.obj["modules_repo_no_pull"], |
| 1636 | + ) |
| 1637 | + if remove: |
| 1638 | + subworkflow_patch.remove(tool) |
| 1639 | + else: |
| 1640 | + subworkflow_patch.patch(tool) |
| 1641 | + except (UserWarning, LookupError) as e: |
| 1642 | + log.error(e) |
| 1643 | + sys.exit(1) |
| 1644 | + |
| 1645 | + |
1570 | 1646 | # nf-core subworkflows remove |
1571 | 1647 | @subworkflows.command("remove") |
1572 | 1648 | @click.pass_context |
@@ -1721,7 +1797,7 @@ def command_schema_validate(pipeline, params): |
1721 | 1797 | @click.option( |
1722 | 1798 | "--url", |
1723 | 1799 | type=str, |
1724 | | - default="https://nf-co.re/pipeline_schema_builder", |
| 1800 | + default="https://oldsite.nf-co.re/pipeline_schema_builder", |
1725 | 1801 | help="Customise the builder URL (for development work)", |
1726 | 1802 | ) |
1727 | 1803 | def command_schema_build(directory, no_prompts, web_only, url): |
|
0 commit comments