Skip to content

Commit

Permalink
Fix linting problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
mberacochea committed Apr 12, 2024
1 parent f72f2b8 commit a26cd89
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 76 deletions.
9 changes: 6 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ If you're not used to this workflow with git, you can start with some [docs from

## Tests

You can optionally test your changes by running the pipeline locally. Then it is recommended to use the `debug` profile to
receive warnings about process selectors and other debug info. Example: `nextflow run . -profile debug,test,docker --outdir <OUTDIR>`.
You have the option to test your changes locally by running the pipeline. For receiving warnings about process selectors and other `debug` information, it is recommended to use the debug profile. Execute all the tests with the following command:

```bash
nf-test test --profile debug,test,docker --verbose
```

When you create a pull request with changes, [GitHub Actions](https://github.com/features/actions) will run automatic tests.
Typically, pull-requests are only fully reviewed when these tests are passing, though of course we can help out before then.
Expand Down Expand Up @@ -82,7 +85,7 @@ Once there, use `nf-core schema build` to add to `nextflow_schema.json`.

Sensible defaults for process resource requirements (CPUs / memory / time) for a process should be defined in `conf/base.config`. These should generally be specified generic with `withLabel:` selectors so they can be shared across multiple processes/steps of the pipeline. A nf-core standard set of labels that should be followed where possible can be seen in the [nf-core pipeline template](https://github.com/nf-core/tools/blob/master/nf_core/pipeline-template/conf/base.config), which has the default process as a single core-process, and then different levels of multi-core configurations for increasingly large memory requirements defined with standardised labels.

The process resources can be passed on to the tool dynamically within the process with the `${task.cpu}` and `${task.memory}` variables in the `script:` block.
The process resources can be passed on to the tool dynamically within the process with the `${task.cpus}` and `${task.memory}` variables in the `script:` block.

### Naming schemes

Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Learn more about contributing: [CONTRIBUTING.md](https://github.com/ebi-metageno
- [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] If you've added a new tool - have you followed the pipeline conventions in the [contribution docs](https://github.com/ebi-metagenomics/shallowmapping/tree/master/.github/CONTRIBUTING.md)
- [ ] Make sure your code lints (`nf-core lint`).
- [ ] Ensure the test suite passes (`nextflow run . -profile test,docker --outdir <OUTDIR>`).
- [ ] Ensure the test suite passes (`nf-test test main.nf.test -profile test,docker`).
- [ ] Check for unexpected warnings in debug mode (`nextflow run . -profile debug,test,docker --outdir <OUTDIR>`).
- [ ] Usage Documentation in `docs/usage.md` is updated.
- [ ] Output Documentation in `docs/output.md` is updated.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# NOTE - this doesn't currently work if the PR is coming from a fork, due to limitations in GitHub actions secrets
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v2
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2
with:
message: |
## This PR is against the `master` branch :x:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: 3.11
cache: "pip"
Expand All @@ -32,12 +32,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out pipeline code
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Install Nextflow
uses: nf-core/setup-nextflow@v1

- uses: actions/setup-python@v5
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
python-version: "3.11"
architecture: "x64"
Expand All @@ -60,7 +60,7 @@ jobs:

- name: Upload linting log file artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
with:
name: linting-logs
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linting_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download lint results
uses: dawidd6/action-download-artifact@v3
uses: dawidd6/action-download-artifact@f6b0bace624032e30a85a8fd9c1a7f8f611f5737 # v3
with:
workflow: linting.yml
workflow_conclusion: completed
Expand All @@ -21,7 +21,7 @@ jobs:
run: echo "pr_number=$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT

- name: Post PR comment
uses: marocchino/sticky-pull-request-comment@v2
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.pr_number.outputs.pr_number }}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.nextflow*
work/
data/
results/
.nf-test/
.nf-test.log
.DS_Store
testing/
testing*
Expand Down
63 changes: 38 additions & 25 deletions .nf-core.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
lint:
files_exist:
- CODE_OF_CONDUCT.md
- assets/nf-core-shallowmapping_logo_light.png
- docs/
- pyproject.toml
- .gitignore
- .github/ISSUE_TEMPLATE/config.yml
- .github/workflows/*
- .github/CONTRIBUTING.md
- .github/PULL_REQUEST_TEMPLATE.md
- conf/igenomes.config
- conf/igenomes.config
- conf/test.config
- conf/test_full.config
- CODE_OF_CONDUCT.md
- assets/nf-core-shallowmapping_logo_light.png
- docs/
- docs/output.md
- docs/README.md
- docs/README.md
- docs/usage.md
- docs/images/nf-core-shallowmapping_logo_dark.png
- docs/images/nf-core-shallowmapping_logo_light.png
- pyproject.toml
- .gitignore
- .github/ISSUE_TEMPLATE/config.yml
- .github/workflows/*
- .github/CONTRIBUTING.md
- .github/PULL_REQUEST_TEMPLATE.md
- conf/igenomes.config
- conf/igenomes.config
- conf/test.config
- conf/test_full.config
files_unchanged:
- CODE_OF_CONDUCT.md
- assets/nf-core-shallowmapping_logo_light.png
- .github/ISSUE_TEMPLATE/bug_report.yml
- CODE_OF_CONDUCT.md
- assets/nf-core-shallowmapping_logo_light.png
- .github/ISSUE_TEMPLATE/bug_report.yml
- .github/CONTRIBUTING.md does not match the template
- .github/PULL_REQUEST_TEMPLATE.md does not match the template
- .github/workflows/branch.yml does not match the template
- .github/workflows/linting_comment.yml does not match the template
- .github/workflows/linting.yml does not match the template
- .gitignore does not match the template
- pyproject.toml does not match the template
multiqc_config:
- report_comment
- report_comment
nextflow_config:
- manifest.name
- manifest.homePage
- process.cpus
- process.memory
- process.time
- custom_config
- manifest.name
- manifest.homePage
- process.cpus
- process.memory
- process.time
- custom_config
repository_type: pipeline
template:
prefix: ebi-metagenomics
skip:
- igenomes
- nf_core_configs
- igenomes
- nf_core_configs
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

## Introduction

**ebi-metagenomics/shallowmapping** is a bioinformatics pipeline that generates taxonomic and functional profiles for low-yield (shallow shotgun: < 10 M reads) short raw-reads using [`MGnify biome-specific genome catalogues`](https://www.ebi.ac.uk/metagenomics/browse/genomes) as a reference.
**ebi-metagenomics/shallowmapping** is a bioinformatics pipeline that generates taxonomic and functional profiles for low-yield (shallow shotgun: < 10 M reads) short raw-reads using [`MGnify biome-specific genome catalogues`](https://www.ebi.ac.uk/metagenomics/browse/genomes) as a reference.

At the moment, the biome selection is limited to the precomputed databases available to downloading (chicken-gut-v1-0-1 and mouse-gut-v1-0). Other databases can be build for any of the [`MGnify genome catalogues`](https://www.ebi.ac.uk/metagenomics/browse/genomes) under request by opening an issue in this repo.

The main sections of the pipeline includes the following steps:

1. Raw-reads quality control ([`fastp`](https://github.com/OpenGene/fastp))
2. HQ reads decontamination versus human, phyX, and host ([`bwa-mem2`](https://github.com/bwa-mem2/bwa-mem2))
3. QC report of decontaminated reads ([`FastQC`](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/))
Expand All @@ -22,7 +23,6 @@ The final output includes a species relative abundance table, Pfam and KEGG Orth
<img src="images/workflow.png" width="90%"/>
</p>


## Install and dependencies

This workflow was built using [Nextflow](https://www.nextflow.io/) and follows the [nf-core guidelines](https://nf-co.re/docs/contributing/guidelines). It uses Singularity containers making installation trivial and results highly reproducible. To run the pipeline in your system you need:
Expand All @@ -36,12 +36,11 @@ Clone the Shallow-mapping pipeline github repo:
git clone https://github.com/EBI-Metagenomics/shallowmapping.git
```


### Required reference databases

The first time you run the pipeline you need to put available indexed databases for the decontamination step, MGnify genomes catalogue tables, and some external tables for DRAM visuals generation. MGnify host most of the databases and setting up can be done in a single step by providing the location for decontamination and MGnify databases where the new files will be added. The directories have to already exists. Please provide full paths.

Consider that decontamination reference genomes require ~15-20G of storage.
Consider that decontamination reference genomes require ~15-20G of storage.
MGnify catalogue genomes db occupy ~1G.

```bash
Expand All @@ -55,7 +54,6 @@ bash bin/setup_script.sh \

Running the pipeline using bwamem2 is optional. If you want to run the pipeline with this option set the `--download_bwa true`. Consider that this database will occupy >15G of storage in your system.


### Usage

Prepare a samplesheet with your input data that looks as follows:
Expand Down Expand Up @@ -85,17 +83,16 @@ At the moment, the biome selection is limited to the precomputed databases avail

The central location for the databases can be set in the config file.


Optional arguments includes:

```bash
--run_bwa <true or false> default = `false` # To generate results using bwamem2 besides sourmash
--core_mode <true or false> default = `false` # To use core functions instead of pangenome functions
```

Use `--core_mode true` for large catalogues like the mouse-gut to avoid over-prediction due to an extremely large number of accessory genes in the pangenome.
Nextflow option `-profile` can be use to select a suitable config for your computational resources.
Nextflow option `-resume` can be use to re-run the pipeline from the last successfully finished step.

Nextflow option `-resume` can be use to re-run the pipeline from the last successfully finished step.

## Credits

Expand All @@ -104,10 +101,9 @@ ebi-metagenomics/shallowmapping pipeline was originally written by @Ales-ibt.
We thank the following people for their extensive assistance in the development of this pipeline:
@mberacochea, @ebi-jlu8


## Citations

If you use ebi-metagenomics/shallowmapping for your analysis, please cite it using the following doi: [10.5281/zenodo.XXXXXX](https://doi.org/10.5281/zenodo.XXXXXX)
If you use ebi-metagenomics/shallowmapping for your analysis, please cite it using the following doi: [10.5281/zenodo.XXXXXX](https://doi.org/10.5281/zenodo.XXXXXX)

This pipeline uses code and infrastructure developed and maintained by the [nf-core](https://nf-co.re) community, reused here under the [MIT license](https://github.com/nf-core/tools/blob/master/LICENSE).

Expand Down
3 changes: 2 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"sourmash/sketch": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
"installed_by": ["modules"]
"installed_by": ["modules"],
"patch": "modules/nf-core/sourmash/sketch/sourmash-sketch.diff"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions modules/nf-core/sourmash/sketch/sourmash-sketch.diff

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ params {
/*
* Biome options:
* chicken-gut-v1-0-1
* mouse-gut-v1-0
*
* mouse-gut-v1-0
*
*/

// MultiQC options
Expand Down Expand Up @@ -110,6 +110,9 @@ profiles {
memory = '1 GB'
}
}
test {
// TODO: add testing profile
}
}

// Set default registry for Apptainer, Docker, Podman and Singularity independent of -profile
Expand Down
26 changes: 5 additions & 21 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"type": "object",
"fa_icon": "fas fa-terminal",
"description": "Define where the pipeline should find input data and save output data.",
"required": [
"input"
],
"required": ["input"],
"properties": {
"input": {
"type": "string",
Expand Down Expand Up @@ -108,14 +106,7 @@
"description": "Method used to save pipeline results to output directory.",
"help_text": "The Nextflow `publishDir` option specifies which intermediate files should be saved to the output directory. This option tells the pipeline what method should be used to move these files. See [Nextflow docs](https://www.nextflow.io/docs/latest/process.html#publishdir) for details.",
"fa_icon": "fas fa-copy",
"enum": [
"symlink",
"rellink",
"link",
"copy",
"copyNoFollow",
"move"
],
"enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"],
"hidden": true
},
"email_on_fail": {
Expand Down Expand Up @@ -218,10 +209,7 @@
"biome": {
"type": "string",
"description": "This can be any of the MGnify catalogues for which shallow-mapping databases are currently available",
"enum": [
"chicken-gut-v1-0-1",
"mouse-gut-v1-0"
]
"enum": ["chicken-gut-v1-0-1", "mouse-gut-v1-0"]
},
"run_bwa": {
"type": "boolean",
Expand All @@ -247,9 +235,5 @@
"type": "string"
}
},
"required": [
"biome",
"shallow_dbs_path",
"decont_reference_paths"
]
}
"required": ["biome", "shallow_dbs_path", "decont_reference_paths"]
}
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
[tool.ruff]
line-length = 120
target-version = "py38"
select = ["I", "E1", "E4", "E7", "E9", "F", "UP", "N"]
cache-dir = "~/.cache/ruff"

[tool.ruff.isort]
[tool.ruff.lint]
select = ["I", "E1", "E4", "E7", "E9", "F", "UP", "N"]

[tool.ruff.lint.isort]
known-first-party = ["nf_core"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]

0 comments on commit a26cd89

Please sign in to comment.