Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
georgiesamaha authored May 23, 2024
0 parents commit 465896a
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Execute template to populate repository

on:
push:
workflow_dispatch:

jobs:
setup-repo:
if: ${{ github.repository != 'Sydney-Informatics-Hub/template-nf' }}
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}

- name: Install cookiecutter
run: pip3 install cookiecutter

- uses: actions/github-script@v4
id: fetch-repo-and-user-details
with:
script: |
const query = `query($owner:String!, $name:String!) {
repository(owner:$owner, name:$name) {
name
description
owner {
login
... on User {
name
}
... on Organization {
name
}
}
}
}`;
const variables = {
owner: context.repo.owner,
name: context.repo.repo
}
const result = await github.graphql(query, variables)
return result
- name: Build out template
env:
INFO: ${{ steps.fetch-repo-and-user-details.outputs.result }}
run: |
export REPO_NAME=$(echo $INFO | jq -r '.repository.name')
# Run cookiecutter
pushd /tmp
cookiecutter gh:Sydney-Informatics-Hub/Nextflow_DSL2_template --no-input \
app_name=$REPO_NAME \
description="$(echo $INFO | jq -r .repository.description)" \
github_username="$(echo $INFO | jq -r .repository.owner.login)" \
author_name="$(echo $INFO | jq -r .repository.owner.name)"
popd
# Delete the .github directory and README, they're not needed anymore
rm -rf .github/
rm -rf Images/
rm -rf README.md
shopt -s dotglob
# Move template content to root, ensure hidden and README are replaced
rsync -a /tmp/$REPO_NAME/ .
- name: Force push changes to main
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Build skeleton template"
push_options: "--force"
Binary file added Images/01_usetemplate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/02_newrepo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/03_action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/04_template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# template-nf

This is a Nextflow workflow template generator.

## **Why use this template?**

[Nextflow](https://www.nextflow.io/) is open source and scalable workflow management software, developed for bioinformatics. It enables the development and execution of integrated, reproducible workflows consisting of multiple processes, various environment management systems, scripting languages, and software packages.

Given Nextflow's extensive capabilities, there are many ways to structure your workflows. We developed this template to aid beginners in learning how to develop best practice Nextflow workflows. Here, we've prioritised modularity, portability, and flexibility.

## **Who is this template for?**

The DSL2 workflow template is suitable for:

* Nextflow newcomers looking for a low barrier to entry, structured starting point, and guidance.
* Custom workflow developers looking for a simple scaffold which can be extended and modified as needed.
* Collaborative teams looking for a standard and consistent workflow code base structure.
* Scalable workflow developers looking for a scalable and reproducible solution for their data analysis and processing needs.

It is not suitable for:

* Those wishing to create and contribute to public nf-core workflows, as it is not nf-core compatible.
* Those creating simple or single-task workflows with only a few tasks and minimal complexity.
* Those with no previous command-line and bash experience.

## **How to use the template?**

Once you create a new repository using this template, a GitHub Action workflow will automatically be deployed. This workflow will populate your new repository with the skeleton template directory. To create a new repository:

1. On this page, select the 'Use this template' button, and select the green 'Create new repository' button:

![](./Images/01_usetemplate.png)

2. You'll be taken to a new page where you can configure your new repository. Ensure the 'Include all branches' box is unticked, give your workflow a name, a description (optional), and select whether it should be public or private. Then hit the green 'Create repository' button:

![](./Images/02_newrepo.png)

3. You'll be taken to your new repository page. It will appear like nothing has happened, take note of the brown dot on the top of the code tab/section on this page. This indicates that the GitHub Action is working, if you select it you can observe its progress as it repopulates your repository with the template. It may take a few seconds to run:

![](./Images/03_action.png)

4. Once this brown dot is replaced by a green tick the Action has successfully completed and your repository will be populated with the Nextflow template code base. You may need to refresh your page to observe these changes:

![](./Images/04_template.png)

5. Once your repository has been populated with the template code base, you can open it on your CLI environment and develop your workflow. For example:

```
git clone https://github.com/georgiesamaha/myWorkflow-nf.git
```

### [User guide](https://sydney-informatics-hub.github.io/Nextflow_DSL2_template_guide/)

Please see our [documentation](https://sydney-informatics-hub.github.io/Nextflow_DSL2_template_guide/) for instructions on how to use the template code base to build your workflow.

### Install Nextflow

Depending on the system you're working on there are a few options for installing and running Nextflow including software management tools like bioconda and Singularity. See [here](https://www.nextflow.io/docs/latest/getstarted.html#installation) for installation instructions. Once you have installed Nextflow, you can configure it to run on your system if needed.

## **Additional resources**

* [Workflow documentation guidelines](https://github.com/AustralianBioCommons/doc_guidelines)

## **Acknowledgements**

The work presented here was developed by the Sydney Informatics Hub, a Core Research Facility of the University of Sydney and the Australian BioCommons 'Bring Your Own Data' Platforms Project which is enabled by NCRIS via ARDC and Bioplatforms Australia.

0 comments on commit 465896a

Please sign in to comment.