From 68b06dd5ece908e09d6355fc7d1c1fcccaa17c4a Mon Sep 17 00:00:00 2001 From: Jorrit Boekel Date: Mon, 22 Oct 2018 16:25:39 +0200 Subject: [PATCH] initial template build from nf-core/tools, version 1.2 --- .gitattributes | 1 + .github/CONTRIBUTING.md | 45 +++ .github/ISSUE_TEMPLATE/bug_report.md | 31 ++ .github/ISSUE_TEMPLATE/feature_request.md | 16 + .github/PULL_REQUEST_TEMPLATE.md | 15 + .gitignore | 6 + .travis.yml | 36 ++ CHANGELOG.md | 4 + CODE_OF_CONDUCT.md | 46 +++ Dockerfile | 6 + LICENSE | 19 + README.md | 25 ++ Singularity | 17 + assets/email_template.html | 52 +++ assets/email_template.txt | 51 +++ assets/sendmail_template.txt | 11 + .../scrape_software_versions.cpython-36.pyc | Bin 0 -> 1303 bytes bin/markdown_to_html.r | 51 +++ bin/scrape_software_versions.py | 38 ++ conf/awsbatch.config | 13 + conf/base.config | 39 ++ conf/igenomes.config | 146 ++++++++ conf/multiqc_config.yaml | 7 + conf/test.config | 20 + docs/README.md | 11 + docs/configuration/adding_your_own.md | 86 +++++ docs/configuration/reference_genomes.md | 49 +++ docs/installation.md | 115 ++++++ docs/output.md | 40 ++ docs/troubleshooting.md | 28 ++ docs/usage.md | 239 ++++++++++++ environment.yml | 8 + main.nf | 347 ++++++++++++++++++ nextflow.config | 118 ++++++ 34 files changed, 1736 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 Singularity create mode 100644 assets/email_template.html create mode 100644 assets/email_template.txt create mode 100644 assets/sendmail_template.txt create mode 100644 bin/__pycache__/scrape_software_versions.cpython-36.pyc create mode 100755 bin/markdown_to_html.r create mode 100755 bin/scrape_software_versions.py create mode 100644 conf/awsbatch.config create mode 100644 conf/base.config create mode 100644 conf/igenomes.config create mode 100644 conf/multiqc_config.yaml create mode 100644 conf/test.config create mode 100644 docs/README.md create mode 100644 docs/configuration/adding_your_own.md create mode 100644 docs/configuration/reference_genomes.md create mode 100644 docs/installation.md create mode 100644 docs/output.md create mode 100644 docs/troubleshooting.md create mode 100644 docs/usage.md create mode 100644 environment.yml create mode 100644 main.nf create mode 100644 nextflow.config diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7fe5500 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.config linguist-language=nextflow diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..be83b3a --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,45 @@ +# nf-core/lehtio-quant-proteomics: Contributing Guidelines + +Hi there! Many thanks for taking an interest in improving nf-core/lehtio-quant-proteomics. + +We try to manage the required tasks for nf-core/lehtio-quant-proteomics using GitHub issues, you probably came to this page when creating one. Please use the pre-filled template to save time. + +However, don't be put off by this template - other more general issues and suggestions are welcome! Contributions to the code are even more welcome ;) + +> If you need help using or modifying nf-core/lehtio-quant-proteomics then the best place to go is the Gitter chatroom where you can ask us questions directly: https://gitter.im/nf-core/Lobby + +## Contribution workflow +If you'd like to write some code for nf-core/lehtio-quant-proteomics, the standard workflow +is as follows: + +1. Check that there isn't already an issue about your idea in the + [nf-core/lehtio-quant-proteomics issues](https://github.com/nf-core/lehtio-quant-proteomics/issues) to avoid + duplicating work. + * If there isn't one already, please create one so that others know you're working on this +2. Fork the [nf-core/lehtio-quant-proteomics repository](https://github.com/nf-core/lehtio-quant-proteomics) to your GitHub account +3. Make the necessary changes / additions within your forked repository +4. Submit a Pull Request against the `dev` branch and wait for the code to be reviewed and merged. + +If you're not used to this workflow with git, you can start with some [basic docs from GitHub](https://help.github.com/articles/fork-a-repo/) or even their [excellent interactive tutorial](https://try.github.io/). + + +## Tests +When you create a pull request with changes, [Travis CI](https://travis-ci.org/) 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. + +There are typically two types of tests that run: + +### Lint Tests +The nf-core has a [set of guidelines](http://nf-co.re/developer_docs) which all pipelines must adhere to. +To enforce these and ensure that all pipelines stay in sync, we have developed a helper tool which runs checks on the pipeline code. This is in the [nf-core/tools repository](https://github.com/nf-core/tools) and once installed can be run locally with the `nf-core lint ` command. + +If any failures or warnings are encountered, please follow the listed URL for more documentation. + +### Pipeline Tests +Each nf-core pipeline should be set up with a minimal set of test-data. +Travis CI then runs the pipeline on this data to ensure that it exists successfully. +If there are any failures then the automated tests fail. +These tests are run both with the latest available version of Nextflow and also the minimum required version that is stated in the pipeline code. + +## Getting help +For further information/help, please consult the [nf-core/lehtio-quant-proteomics documentation](https://github.com/nf-core/lehtio-quant-proteomics#documentation) and don't hesitate to get in touch on [Gitter](https://gitter.im/nf-core/Lobby) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..3c4566d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +Hi there! + +Thanks for telling us about a problem with the pipeline. Please delete this text and anything that's not relevant from the template below: + +#### Describe the bug +A clear and concise description of what the bug is. + +#### Steps to reproduce +Steps to reproduce the behaviour: +1. Command line: `nextflow run ...` +2. See error: _Please provide your error message_ + +#### Expected behaviour +A clear and concise description of what you expected to happen. + +#### System: + - Hardware: [e.g. HPC, Desktop, Cloud...] + - Executor: [e.g. slurm, local, awsbatch...] + - OS: [e.g. CentOS Linux, macOS, Linux Mint...] + - Version [e.g. 7, 10.13.6, 18.3...] + +#### Nextflow Installation: + - Version: [e.g. 0.31.0] + +#### Container engine: + - Engine: [e.g. Conda, Docker or Singularity] + - version: [e.g. 1.0.0] + - Image tag: [e.g. nfcore/lehtio-quant-proteomics:1.0.0] + +#### Additional context +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..1f025b7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,16 @@ +Hi there! + +Thanks for suggesting a new feature for the pipeline! Please delete this text and anything that's not relevant from the template below: + +#### Is your feature request related to a problem? Please describe. +A clear and concise description of what the problem is. +Ex. I'm always frustrated when [...] + +#### Describe the solution you'd like +A clear and concise description of what you want to happen. + +#### Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. + +#### Additional context +Add any other context about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..4ed6c61 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +Many thanks to contributing to nf-core/lehtio-quant-proteomics! + +Please fill in the appropriate checklist below (delete whatever is not relevant). These are the most common things requested on pull requests (PRs). + +## PR checklist + - [ ] This comment contains a description of changes (with reason) + - [ ] If you've fixed a bug or added code that should be tested, add tests! + - [ ] If necessary, also make a PR on the [nf-core/lehtio-quant-proteomics branch on the nf-core/test-datasets repo]( https://github.com/nf-core/test-datasets/pull/new/nf-core/lehtio-quant-proteomics) + - [ ] Ensure the test suite passes (`nextflow run . -profile test,docker`). + - [ ] Make sure your code lints (`nf-core lint .`). + - [ ] Documentation in `docs` is updated + - [ ] `CHANGELOG.md` is updated + - [ ] `README.md` is updated + +**Learn more about contributing:** https://github.com/nf-core/lehtio-quant-proteomics/tree/master/.github/CONTRIBUTING.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46f69e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.nextflow* +work/ +data/ +results/ +.DS_Store +tests/test_data diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4525809 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +sudo: required +language: python +jdk: openjdk8 +services: docker +python: '3.6' +cache: pip +matrix: + fast_finish: true + +before_install: + # PRs to master are only ok if coming from dev branch + - '[ $TRAVIS_PULL_REQUEST = "false" ] || [ $TRAVIS_BRANCH != "master" ] || ([ $TRAVIS_PULL_REQUEST_SLUG = $TRAVIS_REPO_SLUG ] && [ $TRAVIS_PULL_REQUEST_BRANCH = "dev" ])' + # Pull the docker image first so the test doesn't wait for this + - docker pull nfcore/lehtio-quant-proteomics + # Fake the tag locally so that the pipeline runs properly + - docker tag nfcore/lehtio-quant-proteomics nfcore/lehtio-quant-proteomics:latest + +install: + # Install Nextflow + - mkdir /tmp/nextflow && cd /tmp/nextflow + - wget -qO- get.nextflow.io | bash + - sudo ln -s /tmp/nextflow/nextflow /usr/local/bin/nextflow + # Install nf-core/tools + - pip install nf-core + # Reset + - mkdir ${TRAVIS_BUILD_DIR}/tests && cd ${TRAVIS_BUILD_DIR}/tests + +env: + - NXF_VER='0.32.0' # Specify a minimum NF version that should be tested and work + - NXF_VER='' # Plus: get the latest NF version and check that it works + +script: + # Lint the pipeline code + - nf-core lint ${TRAVIS_BUILD_DIR} + # Run the pipeline with the test profile + - nextflow run ${TRAVIS_BUILD_DIR} -profile test,docker diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7553db5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# nf-core/lehtio-quant-proteomics: Changelog + +## v1.0dev - +Initial release of nf-core/lehtio-quant-proteomics, created with the [nf-core](http://nf-co.re/) template. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2109619 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team on the [Gitter channel](https://gitter.im/nf-core/Lobby). The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd088af --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM nfcore/base +LABEL description="Docker image containing all requirements for nf-core/lehtio-quant-proteomics pipeline" + +COPY environment.yml / +RUN conda env create -f /environment.yml && conda clean -a +ENV PATH /opt/conda/envs/nf-core-lehtio-quant-proteomics-1.0dev/bin:$PATH diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9cf1062 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..23c1279 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# nf-core/lehtio-quant-proteomics +**Quantitative shotgun MS proteomics as done in Lehtio lab** + +[![Build Status](https://travis-ci.org/nf-core/lehtio-quant-proteomics.svg?branch=master)](https://travis-ci.org/nf-core/lehtio-quant-proteomics) +[![Nextflow](https://img.shields.io/badge/nextflow-%E2%89%A50.32.0-brightgreen.svg)](https://www.nextflow.io/) + +[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg)](http://bioconda.github.io/) +[![Docker](https://img.shields.io/docker/automated/nfcore/lehtio-quant-proteomics.svg)](https://hub.docker.com/r/nfcore/lehtio-quant-proteomics) +![Singularity Container available]( +https://img.shields.io/badge/singularity-available-7E4C74.svg) + +### Introduction +The pipeline is built using [Nextflow](https://www.nextflow.io), a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It comes with docker / singularity containers making installation trivial and results highly reproducible. + + +### Documentation +The nf-core/lehtio-quant-proteomics pipeline comes with documentation about the pipeline, found in the `docs/` directory: + +1. [Installation](docs/installation.md) +2. Pipeline configuration + * [Local installation](docs/configuration/local.md) + * [Adding your own system](docs/configuration/adding_your_own.md) +3. [Running the pipeline](docs/usage.md) +4. [Output and how to interpret the results](docs/output.md) +5. [Troubleshooting](docs/troubleshooting.md) diff --git a/Singularity b/Singularity new file mode 100644 index 0000000..c6e196e --- /dev/null +++ b/Singularity @@ -0,0 +1,17 @@ +From:nfcore/base +Bootstrap:docker + +%labels + DESCRIPTION Singularity image containing all requirements for the nf-core/lehtio-quant-proteomics pipeline + VERSION 1.0dev + +%environment + PATH=/opt/conda/envs/nf-core-lehtio-quant-proteomics-1.0dev/bin:$PATH + export PATH + +%files + environment.yml / + +%post + /opt/conda/bin/conda env create -f /environment.yml + /opt/conda/bin/conda clean -a diff --git a/assets/email_template.html b/assets/email_template.html new file mode 100644 index 0000000..830a142 --- /dev/null +++ b/assets/email_template.html @@ -0,0 +1,52 @@ + + + + + + + + + nf-core/lehtio-quant-proteomics Pipeline Report + + +
+ +

nf-core/lehtio-quant-proteomics v${version}

+

Run Name: $runName

+ +<% if (!success){ + out << """ +
+

nf-core/lehtio-quant-proteomics execution completed unsuccessfully!

+

The exit status of the task that caused the workflow execution to fail was: $exitStatus.

+

The full error message was:

+
${errorReport}
+
+ """ +} else { + out << """ +
+ nf-core/lehtio-quant-proteomics execution completed successfully! +
+ """ +} +%> + +

The workflow was completed at $dateComplete (duration: $duration)

+

The command used to launch the workflow was as follows:

+
$commandLine
+ +

Pipeline Configuration:

+ + + <% out << summary.collect{ k,v -> "" }.join("\n") %> + +
$k
$v
+ +

nf-core/lehtio-quant-proteomics

+

https://github.com/nf-core/lehtio-quant-proteomics

+ +
+ + + diff --git a/assets/email_template.txt b/assets/email_template.txt new file mode 100644 index 0000000..8b4be39 --- /dev/null +++ b/assets/email_template.txt @@ -0,0 +1,51 @@ +======================================== + nf-core/lehtio-quant-proteomics v${version} +======================================== +Run Name: $runName + +<% if (success){ + out << "## nf-core/lehtio-quant-proteomics execution completed successfully! ##" +} else { + out << """#################################################### +## nf-core/lehtio-quant-proteomics execution completed unsuccessfully! ## +#################################################### +The exit status of the task that caused the workflow execution to fail was: $exitStatus. +The full error message was: + +${errorReport} +""" +} %> + + +<% if (!success){ + out << """#################################################### +## nf-core/lehtio-quant-proteomics execution completed unsuccessfully! ## +#################################################### +The exit status of the task that caused the workflow execution to fail was: $exitStatus. +The full error message was: + +${errorReport} +""" +} else { + out << "## nf-core/lehtio-quant-proteomics execution completed successfully! ##" +} +%> + + + + +The workflow was completed at $dateComplete (duration: $duration) + +The command used to launch the workflow was as follows: + + $commandLine + + + +Pipeline Configuration: +----------------------- +<% out << summary.collect{ k,v -> " - $k: $v" }.join("\n") %> + +-- +nf-core/lehtio-quant-proteomics +https://github.com/nf-core/lehtio-quant-proteomics diff --git a/assets/sendmail_template.txt b/assets/sendmail_template.txt new file mode 100644 index 0000000..fd1cd73 --- /dev/null +++ b/assets/sendmail_template.txt @@ -0,0 +1,11 @@ +To: $email +Subject: $subject +Mime-Version: 1.0 +Content-Type: multipart/related;boundary="nfmimeboundary" + +--nfmimeboundary +Content-Type: text/html; charset=utf-8 + +$email_html + +--nfmimeboundary-- diff --git a/bin/__pycache__/scrape_software_versions.cpython-36.pyc b/bin/__pycache__/scrape_software_versions.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2db8a8db71fc8648a401b3baa168267995a7cf97 GIT binary patch literal 1303 zcmZ`&OONA35blm0PvRu=$UfM;AS)nwA|~-+rIncVMxb4BV_+D;A~VSHxGRY>9k-{u zlg(tvDL(*l=MQj2{1i^Ua@sp5#DTJtNGq}1ma9IO>s{4PS}pr;_4^NQm5{&4Tc?5e zGkn#*NEl(1lPL`-EpUZbrbb|t*x+VhGLuzD6=s!mkJS*@nT@pZs~J?mSd+kFO|V$Y zCnewC@`Eiu^vU89s*}Anc}af!`mz$#f;!kxXXG(i)1RLP4QNc7=%)qdWFO^6j|sHa zmEZslgwPsr{h9%(x)khi|Y0q)YStOeU!ghqE-+iAYh>_)0R6z+NV?K3ne3!z{^w zCn@yxLNBYwmlvOO3vmhyJ>=qbDQ?cgVWjj;Tz<8_Kz#nfnQxR^^Kd%jI@$hxxcxYB z<{%XYbxO6ax%}Yn&WVM%P9UCX4YHp`Q*c(Rymqz?mRlRw`QDd>$MY9U*H>ATI!fPi zc;1Nx7xMI@Ps{VHGdS};_q{@4@LuQA#7; z$m4EbLdK&Qj$Ow+aonEU#f*DO4E5_sLT_86a%}}=i^HO*_xMCh=VEK=e7EV&Tb5%9 zL$n-govBmL8zp)?yXwbc>b)yLbmrO_7dq6pSrKupr`)v}s8}XhF>RD#ir8|_F*jgN zq#Zd+9i3p?hf+)(JqBl2iX&z^o9RBfh;(%7{A4?Le8!!aM@l{KFy0#rnJh)BBig%?lG%(kLVq3BjI( z5iCIE2o&ys%BzWnsmkefPUpEPGDvf}$V~|m%WJ##=azy<#^by?jWjZAC?ul1I+9|R z<<;^U{6^#>j8l?-e(}ClI00`Wq)fCoPo#!)uDo;@3ke=iuDtA4k45^V|I|~MLobWs z>u3apN?7XbZcYyq#2wLqbNb(YhpAB5zwv72T_vf9!-+BocTEp>1@yDqyyi~@n{gNv l{ZS`KnzTu4hDD2~S+Qts^B8TqkLZw^v}06i7H!k}^glzYkF)>) literal 0 HcmV?d00001 diff --git a/bin/markdown_to_html.r b/bin/markdown_to_html.r new file mode 100755 index 0000000..abe1335 --- /dev/null +++ b/bin/markdown_to_html.r @@ -0,0 +1,51 @@ +#!/usr/bin/env Rscript + +# Command line argument processing +args = commandArgs(trailingOnly=TRUE) +if (length(args) < 2) { + stop("Usage: markdown_to_html.r ", call.=FALSE) +} +markdown_fn <- args[1] +output_fn <- args[2] + +# Load / install packages +if (!require("markdown")) { + install.packages("markdown", dependencies=TRUE, repos='http://cloud.r-project.org/') + library("markdown") +} + +base_css_fn <- getOption("markdown.HTML.stylesheet") +base_css <- readChar(base_css_fn, file.info(base_css_fn)$size) +custom_css <- paste(base_css, " +body { + padding: 3em; + margin-right: 350px; + max-width: 100%; +} +#toc { + position: fixed; + right: 20px; + width: 300px; + padding-top: 20px; + overflow: scroll; + height: calc(100% - 3em - 20px); +} +#toc_header { + font-size: 1.8em; + font-weight: bold; +} +#toc > ul { + padding-left: 0; + list-style-type: none; +} +#toc > ul ul { padding-left: 20px; } +#toc > ul > li > a { display: none; } +img { max-width: 800px; } +") + +markdownToHTML( + file = markdown_fn, + output = output_fn, + stylesheet = custom_css, + options = c('toc', 'base64_images', 'highlight_code') +) diff --git a/bin/scrape_software_versions.py b/bin/scrape_software_versions.py new file mode 100755 index 0000000..f26c2b5 --- /dev/null +++ b/bin/scrape_software_versions.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +from __future__ import print_function +from collections import OrderedDict +import re + +regexes = { + 'nf-core/lehtio-quant-proteomics': ['v_pipeline.txt', r"(\S+)"], + 'Nextflow': ['v_nextflow.txt', r"(\S+)"], + 'FastQC': ['v_fastqc.txt', r"FastQC v(\S+)"], + 'MultiQC': ['v_multiqc.txt', r"multiqc, version (\S+)"], +} +results = OrderedDict() +results['nf-core/lehtio-quant-proteomics'] = 'N/A' +results['Nextflow'] = 'N/A' +results['FastQC'] = 'N/A' +results['MultiQC'] = 'N/A' + +# Search each file using its regex +for k, v in regexes.items(): + with open(v[0]) as x: + versions = x.read() + match = re.search(v[1], versions) + if match: + results[k] = "v{}".format(match.group(1)) + +# Dump to YAML +print (''' +id: 'nf-core/lehtio-quant-proteomics-software-versions' +section_name: 'nf-core/lehtio-quant-proteomics Software Versions' +section_href: 'https://github.com/nf-core/lehtio-quant-proteomics' +plot_type: 'html' +description: 'are collected at run time from the software output.' +data: | +
+''') +for k,v in results.items(): + print("
{}
{}
".format(k,v)) +print ("
") diff --git a/conf/awsbatch.config b/conf/awsbatch.config new file mode 100644 index 0000000..79078c7 --- /dev/null +++ b/conf/awsbatch.config @@ -0,0 +1,13 @@ +/* + * ------------------------------------------------- + * Nextflow config file for AWS Batch + * ------------------------------------------------- + * Imported under the 'awsbatch' Nextflow profile in nextflow.config + * Uses docker for software depedencies automagically, so not specified here. + */ + +aws.region = params.awsregion +process.executor = 'awsbatch' +process.queue = params.awsqueue +executor.awscli = '/home/ec2-user/miniconda/bin/aws' +params.tracedir = './' diff --git a/conf/base.config b/conf/base.config new file mode 100644 index 0000000..fd3c4c7 --- /dev/null +++ b/conf/base.config @@ -0,0 +1,39 @@ +/* + * ------------------------------------------------- + * nf-core/lehtio-quant-proteomics Nextflow base config file + * ------------------------------------------------- + * A 'blank slate' config file, appropriate for general + * use on most high performace compute environments. + * Assumes that all software is installed and available + * on the PATH. Runs in `local` mode - all jobs will be + * run on the logged in environment. + */ + +process { + + container = params.container + + cpus = { check_max( 1 * task.attempt, 'cpus' ) } + memory = { check_max( 8.GB * task.attempt, 'memory' ) } + time = { check_max( 2.h * task.attempt, 'time' ) } + + errorStrategy = { task.exitStatus in [143,137] ? 'retry' : 'finish' } + maxRetries = 1 + maxErrors = '-1' + + // Process-specific resource requirements + withName: fastqc { + errorStrategy = { task.exitStatus in [143,137] ? 'retry' : 'ignore' } + } + withName: multiqc { + errorStrategy = { task.exitStatus in [143,137] ? 'retry' : 'ignore' } + } +} + +params { + // Defaults only, expecting to be overwritten + max_memory = 128.GB + max_cpus = 16 + max_time = 240.h + igenomes_base = 's3://ngi-igenomes/igenomes/' +} diff --git a/conf/igenomes.config b/conf/igenomes.config new file mode 100644 index 0000000..0815499 --- /dev/null +++ b/conf/igenomes.config @@ -0,0 +1,146 @@ +/* + * ------------------------------------------------- + * Nextflow config file for iGenomes paths + * ------------------------------------------------- + * Defines reference genomes, using iGenome paths + * Can be used by any config that customises the base + * path using $params.igenomes_base / --igenomes_base + */ + +params { + // illumina iGenomes reference file paths + genomes { + 'GRCh37' { + bed12 = "${params.igenomes_base}/Homo_sapiens/Ensembl/GRCh37/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Homo_sapiens/Ensembl/GRCh37/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Homo_sapiens/Ensembl/GRCh37/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Homo_sapiens/Ensembl/GRCh37/Sequence/STARIndex/" + } + 'GRCm38' { + bed12 = "${params.igenomes_base}/Mus_musculus/Ensembl/GRCm38/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Mus_musculus/Ensembl/GRCm38/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Mus_musculus/Ensembl/GRCm38/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Mus_musculus/Ensembl/GRCm38/Sequence/STARIndex/" + } + 'TAIR10' { + bed12 = "${params.igenomes_base}/Arabidopsis_thaliana/Ensembl/TAIR10/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Arabidopsis_thaliana/Ensembl/TAIR10/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Arabidopsis_thaliana/Ensembl/TAIR10/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Arabidopsis_thaliana/Ensembl/TAIR10/Sequence/STARIndex/" + } + 'EB2' { + bed12 = "${params.igenomes_base}/Bacillus_subtilis_168/Ensembl/EB2/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Bacillus_subtilis_168/Ensembl/EB2/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Bacillus_subtilis_168/Ensembl/EB2/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Bacillus_subtilis_168/Ensembl/EB2/Sequence/STARIndex/" + } + 'UMD3.1' { + bed12 = "${params.igenomes_base}/Bos_taurus/Ensembl/UMD3.1/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Bos_taurus/Ensembl/UMD3.1/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Bos_taurus/Ensembl/UMD3.1/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Bos_taurus/Ensembl/UMD3.1/Sequence/STARIndex/" + } + 'WBcel235' { + bed12 = "${params.igenomes_base}/Caenorhabditis_elegans/Ensembl/WBcel235/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Caenorhabditis_elegans/Ensembl/WBcel235/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Caenorhabditis_elegans/Ensembl/WBcel235/Sequence/STARIndex/" + } + 'CanFam3.1' { + bed12 = "${params.igenomes_base}/Canis_familiaris/Ensembl/CanFam3.1/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Canis_familiaris/Ensembl/CanFam3.1/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Canis_familiaris/Ensembl/CanFam3.1/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Canis_familiaris/Ensembl/CanFam3.1/Sequence/STARIndex/" + } + 'GRCz10' { + bed12 = "${params.igenomes_base}/Danio_rerio/Ensembl/GRCz10/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Danio_rerio/Ensembl/GRCz10/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Danio_rerio/Ensembl/GRCz10/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Danio_rerio/Ensembl/GRCz10/Sequence/STARIndex/" + } + 'BDGP6' { + bed12 = "${params.igenomes_base}/Drosophila_melanogaster/Ensembl/BDGP6/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Drosophila_melanogaster/Ensembl/BDGP6/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Drosophila_melanogaster/Ensembl/BDGP6/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Drosophila_melanogaster/Ensembl/BDGP6/Sequence/STARIndex/" + } + 'EquCab2' { + bed12 = "${params.igenomes_base}/Equus_caballus/Ensembl/EquCab2/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Equus_caballus/Ensembl/EquCab2/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Equus_caballus/Ensembl/EquCab2/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Equus_caballus/Ensembl/EquCab2/Sequence/STARIndex/" + } + 'EB1' { + bed12 = "${params.igenomes_base}/Escherichia_coli_K_12_DH10B/Ensembl/EB1/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Escherichia_coli_K_12_DH10B/Ensembl/EB1/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Escherichia_coli_K_12_DH10B/Ensembl/EB1/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Escherichia_coli_K_12_DH10B/Ensembl/EB1/Sequence/STARIndex/" + } + 'Galgal4' { + bed12 = "${params.igenomes_base}/Gallus_gallus/Ensembl/Galgal4/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Gallus_gallus/Ensembl/Galgal4/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Gallus_gallus/Ensembl/Galgal4/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Gallus_gallus/Ensembl/Galgal4/Sequence/STARIndex/" + } + 'Gm01' { + bed12 = "${params.igenomes_base}/Glycine_max/Ensembl/Gm01/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Glycine_max/Ensembl/Gm01/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Glycine_max/Ensembl/Gm01/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Glycine_max/Ensembl/Gm01/Sequence/STARIndex/" + } + 'Mmul_1' { + bed12 = "${params.igenomes_base}/Macaca_mulatta/Ensembl/Mmul_1/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Macaca_mulatta/Ensembl/Mmul_1/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Macaca_mulatta/Ensembl/Mmul_1/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Macaca_mulatta/Ensembl/Mmul_1/Sequence/STARIndex/" + } + 'IRGSP-1.0' { + bed12 = "${params.igenomes_base}/Oryza_sativa_japonica/Ensembl/IRGSP-1.0/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Oryza_sativa_japonica/Ensembl/IRGSP-1.0/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Oryza_sativa_japonica/Ensembl/IRGSP-1.0/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Oryza_sativa_japonica/Ensembl/IRGSP-1.0/Sequence/STARIndex/" + } + 'CHIMP2.1.4' { + bed12 = "${params.igenomes_base}/Pan_troglodytes/Ensembl/CHIMP2.1.4/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Pan_troglodytes/Ensembl/CHIMP2.1.4/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Pan_troglodytes/Ensembl/CHIMP2.1.4/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Pan_troglodytes/Ensembl/CHIMP2.1.4/Sequence/STARIndex/" + } + 'Rnor_6.0' { + bed12 = "${params.igenomes_base}/Rattus_norvegicus/Ensembl/Rnor_6.0/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Rattus_norvegicus/Ensembl/Rnor_6.0/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Rattus_norvegicus/Ensembl/Rnor_6.0/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Rattus_norvegicus/Ensembl/Rnor_6.0/Sequence/STARIndex/" + } + 'R64-1-1' { + bed12 = "${params.igenomes_base}/Saccharomyces_cerevisiae/Ensembl/R64-1-1/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Saccharomyces_cerevisiae/Ensembl/R64-1-1/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Saccharomyces_cerevisiae/Ensembl/R64-1-1/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Saccharomyces_cerevisiae/Ensembl/R64-1-1/Sequence/STARIndex/" + } + 'EF2' { + bed12 = "${params.igenomes_base}/Schizosaccharomyces_pombe/Ensembl/EF2/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Schizosaccharomyces_pombe/Ensembl/EF2/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Schizosaccharomyces_pombe/Ensembl/EF2/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Schizosaccharomyces_pombe/Ensembl/EF2/Sequence/STARIndex/" + } + 'Sbi1' { + bed12 = "${params.igenomes_base}/Sorghum_bicolor/Ensembl/Sbi1/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Sorghum_bicolor/Ensembl/Sbi1/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Sorghum_bicolor/Ensembl/Sbi1/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Sorghum_bicolor/Ensembl/Sbi1/Sequence/STARIndex/" + } + 'Sscrofa10.2' { + bed12 = "${params.igenomes_base}/Sus_scrofa/Ensembl/Sscrofa10.2/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Sus_scrofa/Ensembl/Sscrofa10.2/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Sus_scrofa/Ensembl/Sscrofa10.2/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Sus_scrofa/Ensembl/Sscrofa10.2/Sequence/STARIndex/" + } + 'AGPv3' { + bed12 = "${params.igenomes_base}/Zea_mays/Ensembl/AGPv3/Annotation/Genes/genes.bed" + fasta = "${params.igenomes_base}/Zea_mays/Ensembl/AGPv3/Sequence/WholeGenomeFasta/genome.fa" + gtf = "${params.igenomes_base}/Zea_mays/Ensembl/AGPv3/Annotation/Genes/genes.gtf" + star = "${params.igenomes_base}/Zea_mays/Ensembl/AGPv3/Sequence/STARIndex/" + } + } +} diff --git a/conf/multiqc_config.yaml b/conf/multiqc_config.yaml new file mode 100644 index 0000000..eced715 --- /dev/null +++ b/conf/multiqc_config.yaml @@ -0,0 +1,7 @@ +report_comment: > + This report has been generated by the nf-core/lehtio-quant-proteomics + analysis pipeline. For information about how to interpret these results, please see the + documentation. +report_section_order: + nf-core/lehtio-quant-proteomics-software-versions: + order: -1000 diff --git a/conf/test.config b/conf/test.config new file mode 100644 index 0000000..f8ebeb6 --- /dev/null +++ b/conf/test.config @@ -0,0 +1,20 @@ +/* + * ------------------------------------------------- + * Nextflow config file for running tests + * ------------------------------------------------- + * Defines bundled input files and everything required + * to run a fast and simple test. Use as follows: + * nextflow run nf-core/methylseq -profile test + */ + +params { + max_cpus = 2 + max_memory = 6.GB + max_time = 48.h + // Input data + singleEnd = false + readPaths = [ + ['Testdata', ['https://github.com/nf-core/test-datasets/raw/exoseq/testdata/Testdata_R1.tiny.fastq.gz', 'https://github.com/nf-core/test-datasets/raw/exoseq/testdata/Testdata_R2.tiny.fastq.gz']], + ['SRR389222', ['https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', 'https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub2.fastq.gz']] + ] +} diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..785eb4d --- /dev/null +++ b/docs/README.md @@ -0,0 +1,11 @@ +# nf-core/lehtio-quant-proteomics: Documentation + +The nf-core/lehtio-quant-proteomics documentation is split into the following files: + +1. [Installation](installation.md) +2. [Running the pipeline](usage.md) +3. Pipeline configuration + * [Adding your own system](configuration/adding_your_own.md) + * [Reference genomes](configuration/reference_genomes.md) +4. [Output and how to interpret the results](output.md) +5. [Troubleshooting](troubleshooting.md) diff --git a/docs/configuration/adding_your_own.md b/docs/configuration/adding_your_own.md new file mode 100644 index 0000000..18cfa10 --- /dev/null +++ b/docs/configuration/adding_your_own.md @@ -0,0 +1,86 @@ +# nf-core/lehtio-quant-proteomics: Configuration for other clusters + +It is entirely possible to run this pipeline on other clusters, though you will need to set up your own config file so that the pipeline knows how to work with your cluster. + +> If you think that there are other people using the pipeline who would benefit from your configuration (eg. other common cluster setups), please let us know. We can add a new configuration and profile which can used by specifying `-profile ` when running the pipeline. + +If you are the only person to be running this pipeline, you can create your config file as `~/.nextflow/config` and it will be applied every time you run Nextflow. Alternatively, save the file anywhere and reference it when running the pipeline with `-c path/to/config` (see the [Nextflow documentation](https://www.nextflow.io/docs/latest/config.html) for more). + +A basic configuration comes with the pipeline, which runs by default (the `standard` config profile - see [`conf/base.config`](../conf/base.config)). This means that you only need to configure the specifics for your system and overwrite any defaults that you want to change. + +## Cluster Environment +By default, pipeline uses the `local` Nextflow executor - in other words, all jobs are run in the login session. If you're using a simple server, this may be fine. If you're using a compute cluster, this is bad as all jobs will run on the head node. + +To specify your cluster environment, add the following line to your config file: + +```nextflow +process.executor = 'YOUR_SYSTEM_TYPE' +``` + +Many different cluster types are supported by Nextflow. For more information, please see the [Nextflow documentation](https://www.nextflow.io/docs/latest/executor.html). + +Note that you may need to specify cluster options, such as a project or queue. To do so, use the `clusterOptions` config option: + +```nextflow +process { + executor = 'SLURM' + clusterOptions = '-A myproject' +} +``` + + +## Software Requirements +To run the pipeline, several software packages are required. How you satisfy these requirements is essentially up to you and depends on your system. If possible, we _highly_ recommend using either Docker or Singularity. + +Please see the [`installation documentation`](../installation.md) for how to run using the below as a one-off. These instructions are about configuring a config file for repeated use. + +### Docker +Docker is a great way to run nf-core/lehtio-quant-proteomics, as it manages all software installations and allows the pipeline to be run in an identical software environment across a range of systems. + +Nextflow has [excellent integration](https://www.nextflow.io/docs/latest/docker.html) with Docker, and beyond installing the two tools, not much else is required - nextflow will automatically fetch the [nfcore/lehtio-quant-proteomics](https://hub.docker.com/r/nfcore/lehtio-quant-proteomics/) image that we have created and is hosted at dockerhub at run time. + +To add docker support to your own config file, add the following: + +```nextflow +docker.enabled = true +process.container = "nfcore/lehtio-quant-proteomics" +``` + +Note that the dockerhub organisation name annoyingly can't have a hyphen, so is `nfcore` and not `nf-core`. + + +### Singularity image +Many HPC environments are not able to run Docker due to security issues. +[Singularity](http://singularity.lbl.gov/) is a tool designed to run on such HPC systems which is very similar to Docker. + +To specify singularity usage in your pipeline config file, add the following: + +```nextflow +singularity.enabled = true +process.container = "shub://nf-core/lehtio-quant-proteomics" +``` + +If you intend to run the pipeline offline, nextflow will not be able to automatically download the singularity image for you. +Instead, you'll have to do this yourself manually first, transfer the image file and then point to that. + +First, pull the image file where you have an internet connection: + +```bash +singularity pull --name nf-core-lehtio-quant-proteomics.simg shub://nf-core/lehtio-quant-proteomics +``` + +Then transfer this file and point the config file to the image: + +```nextflow +singularity.enabled = true +process.container = "/path/to/nf-core-lehtio-quant-proteomics.simg" +``` + + +### Conda +If you're not able to use Docker or Singularity, you can instead use conda to manage the software requirements. +To use conda in your own config file, add the following: + +```nextflow +process.conda = "$baseDir/environment.yml" +``` diff --git a/docs/configuration/reference_genomes.md b/docs/configuration/reference_genomes.md new file mode 100644 index 0000000..628e4e4 --- /dev/null +++ b/docs/configuration/reference_genomes.md @@ -0,0 +1,49 @@ +# nf-core/lehtio-quant-proteomics: Reference Genomes Configuration + +The nf-core/lehtio-quant-proteomics pipeline needs a reference genome for alignment and annotation. + +These paths can be supplied on the command line at run time (see the [usage docs](../usage.md)), +but for convenience it's often better to save these paths in a nextflow config file. +See below for instructions on how to do this. +Read [Adding your own system](adding_your_own.md) to find out how to set up custom config files. + +## Adding paths to a config file +Specifying long paths every time you run the pipeline is a pain. +To make this easier, the pipeline comes configured to understand reference genome keywords which correspond to preconfigured paths, meaning that you can just specify `--genome ID` when running the pipeline. + +Note that this genome key can also be specified in a config file if you always use the same genome. + +To use this system, add paths to your config file using the following template: + +```nextflow +params { + genomes { + 'YOUR-ID' { + fasta = '/genome.fa' + } + 'OTHER-GENOME' { + // [..] + } + } + // Optional - default genome. Ignored if --genome 'OTHER-GENOME' specified on command line + genome = 'YOUR-ID' +} +``` + +You can add as many genomes as you like as long as they have unique IDs. + +## illumina iGenomes +To make the use of reference genomes easier, illumina has developed a centralised resource called [iGenomes](https://support.illumina.com/sequencing/sequencing_software/igenome.html). +Multiple reference index types are held together with consistent structure for multiple genomes. + +We have put a copy of iGenomes up onto AWS S3 hosting and this pipeline is configured to use this by default. +The hosting fees for AWS iGenomes are currently kindly funded by a grant from Amazon. +The pipeline will automatically download the required reference files when you run the pipeline. +For more information about the AWS iGenomes, see https://ewels.github.io/AWS-iGenomes/ + +Downloading the files takes time and bandwidth, so we recommend making a local copy of the iGenomes resource. +Once downloaded, you can customise the variable `params.igenomes_base` in your custom configuration file to point to the reference location. +For example: +```nextflow +params.igenomes_base = '/path/to/data/igenomes/' +``` diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..3b50105 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,115 @@ +# nf-core/lehtio-quant-proteomics: Installation + +To start using the nf-core/lehtio-quant-proteomics pipeline, follow the steps below: + +1. [Install Nextflow](#1-install-nextflow) +2. [Install the pipeline](#2-install-the-pipeline) + * [Automatic](#21-automatic) + * [Offline](#22-offline) + * [Development](#23-development) +3. [Pipeline configuration](#3-pipeline-configuration) + * [Software deps: Docker and Singularity](#31-software-deps-docker-and-singularity) + * [Software deps: Bioconda](#32-software-deps-bioconda) + * [Configuration profiles](#33-configuration-profiles) +4. [Reference genomes](#4-reference-genomes) +5. [Appendices](#appendices) + * [Running on UPPMAX](#running-on-uppmax) + +## 1) Install NextFlow +Nextflow runs on most POSIX systems (Linux, Mac OSX etc). It can be installed by running the following commands: + +```bash +# Make sure that Java v8+ is installed: +java -version + +# Install Nextflow +curl -fsSL get.nextflow.io | bash + +# Add Nextflow binary to your PATH: +mv nextflow ~/bin/ +# OR system-wide installation: +# sudo mv nextflow /usr/local/bin +``` + +See [nextflow.io](https://www.nextflow.io/) for further instructions on how to install and configure Nextflow. + +## 2) Install the pipeline + +#### 2.1) Automatic +This pipeline itself needs no installation - NextFlow will automatically fetch it from GitHub if `nf-core/lehtio-quant-proteomics` is specified as the pipeline name. + +#### 2.2) Offline +The above method requires an internet connection so that Nextflow can download the pipeline files. If you're running on a system that has no internet connection, you'll need to download and transfer the pipeline files manually: + +```bash +wget https://github.com/nf-core/lehtio-quant-proteomics/archive/master.zip +mkdir -p ~/my-pipelines/nf-core/ +unzip master.zip -d ~/my-pipelines/nf-core/ +cd ~/my_data/ +nextflow run ~/my-pipelines/nf-core/lehtio-quant-proteomics-master +``` + +To stop nextflow from looking for updates online, you can tell it to run in offline mode by specifying the following environment variable in your ~/.bashrc file: + +```bash +export NXF_OFFLINE='TRUE' +``` + +#### 2.3) Development + +If you would like to make changes to the pipeline, it's best to make a fork on GitHub and then clone the files. Once cloned you can run the pipeline directly as above. + + +## 3) Pipeline configuration +By default, the pipeline runs with the `standard` configuration profile. This uses a number of sensible defaults for process requirements and is suitable for running on a simple (if powerful!) basic server. You can see this configuration in [`conf/base.config`](../conf/base.config). + +Be warned of two important points about this default configuration: + +1. The default profile uses the `local` executor + * All jobs are run in the login session. If you're using a simple server, this may be fine. If you're using a compute cluster, this is bad as all jobs will run on the head node. + * See the [nextflow docs](https://www.nextflow.io/docs/latest/executor.html) for information about running with other hardware backends. Most job scheduler systems are natively supported. +2. Nextflow will expect all software to be installed and available on the `PATH` + +#### 3.1) Software deps: Docker +First, install docker on your system: [Docker Installation Instructions](https://docs.docker.com/engine/installation/) + +Then, running the pipeline with the option `-profile standard,docker` tells Nextflow to enable Docker for this run. An image containing all of the software requirements will be automatically fetched and used from dockerhub (https://hub.docker.com/r/nfcore/lehtio-quant-proteomics). + +#### 3.1) Software deps: Singularity +If you're not able to use Docker then [Singularity](http://singularity.lbl.gov/) is a great alternative. +The process is very similar: running the pipeline with the option `-profile standard,singularity` tells Nextflow to enable singularity for this run. An image containing all of the software requirements will be automatically fetched and used from singularity hub. + +If running offline with Singularity, you'll need to download and transfer the Singularity image first: + +```bash +singularity pull --name nf-core-lehtio-quant-proteomics.simg shub://nf-core/lehtio-quant-proteomics +``` + +Once transferred, use `-with-singularity` and specify the path to the image file: + +```bash +nextflow run /path/to/nf-core-lehtio-quant-proteomics -with-singularity nf-core-lehtio-quant-proteomics.simg +``` + +Remember to pull updated versions of the singularity image if you update the pipeline. + + +#### 3.2) Software deps: conda +If you're not able to use Docker _or_ Singularity, you can instead use conda to manage the software requirements. +This is slower and less reproducible than the above, but is still better than having to install all requirements yourself! +The pipeline ships with a conda environment file and nextflow has built-in support for this. +To use it first ensure that you have conda installed (we recommend [miniconda](https://conda.io/miniconda.html)), then follow the same pattern as above and use the flag `-profile standard,conda` + + +## Appendices + +#### Running on UPPMAX +To run the pipeline on the [Swedish UPPMAX](https://www.uppmax.uu.se/) clusters (`rackham`, `irma`, `bianca` etc), use the command line flag `-profile uppmax`. This tells Nextflow to submit jobs using the SLURM job executor with Singularity for software dependencies. + +Note that you will need to specify your UPPMAX project ID when running a pipeline. To do this, use the command line flag `--project `. The pipeline will exit with an error message if you try to run it pipeline with the default UPPMAX config profile without a project. + +**Optional Extra:** To avoid having to specify your project every time you run Nextflow, you can add it to your personal Nextflow config file instead. Add this line to `~/.nextflow/config`: + +```nextflow +params.project = 'project_ID' // eg. b2017123 +``` diff --git a/docs/output.md b/docs/output.md new file mode 100644 index 0000000..3ddbf36 --- /dev/null +++ b/docs/output.md @@ -0,0 +1,40 @@ +# nf-core/lehtio-quant-proteomics: Output + +This document describes the output produced by the pipeline. Most of the plots are taken from the MultiQC report, which summarises results at the end of the pipeline. + + +## Pipeline overview +The pipeline is built using [Nextflow](https://www.nextflow.io/) +and processes data using the following steps: + +* [FastQC](#fastqc) - read quality control +* [MultiQC](#multiqc) - aggregate report, describing results of the whole pipeline + +## FastQC +[FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/) gives general quality metrics about your reads. It provides information about the quality score distribution across your reads, the per base sequence content (%T/A/G/C). You get information about adapter contamination and other overrepresented sequences. + +For further reading and documentation see the [FastQC help](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/). + +> **NB:** The FastQC plots displayed in the MultiQC report shows _untrimmed_ reads. They may contain adapter sequence and potentially regions with low quality. To see how your reads look after trimming, look at the FastQC reports in the `trim_galore` directory. + +**Output directory: `results/fastqc`** + +* `sample_fastqc.html` + * FastQC report, containing quality metrics for your untrimmed raw fastq files +* `zips/sample_fastqc.zip` + * zip file containing the FastQC report, tab-delimited data file and plot images + + +## MultiQC +[MultiQC](http://multiqc.info) is a visualisation tool that generates a single HTML report summarising all samples in your project. Most of the pipeline QC results are visualised in the report and further statistics are available in within the report data directory. + +The pipeline has special steps which allow the software versions used to be reported in the MultiQC output for future traceability. + +**Output directory: `results/multiqc`** + +* `Project_multiqc_report.html` + * MultiQC report - a standalone HTML file that can be viewed in your web browser +* `Project_multiqc_data/` + * Directory containing parsed statistics from the different tools used in the pipeline + +For more information about how to use MultiQC reports, see http://multiqc.info diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md new file mode 100644 index 0000000..3a7a18b --- /dev/null +++ b/docs/troubleshooting.md @@ -0,0 +1,28 @@ +# nf-core/lehtio-quant-proteomics: Troubleshooting + +## Input files not found + +If only no file, only one input file , or only read one and not read two is picked up then something is wrong with your input file declaration + +1. The path must be enclosed in quotes (`'` or `"`) +2. The path must have at least one `*` wildcard character. This is even if you are only running one paired end sample. +3. When using the pipeline with paired end data, the path must use `{1,2}` or `{R1,R2}` notation to specify read pairs. +4. If you are running Single end data make sure to specify `--singleEnd` + +If the pipeline can't find your files then you will get the following error + +``` +ERROR ~ Cannot find any reads matching: *{1,2}.fastq.gz +``` + +Note that if your sample name is "messy" then you have to be very particular with your glob specification. A file name like `L1-1-D-2h_S1_L002_R1_001.fastq.gz` can be difficult enough for a human to read. Specifying `*{1,2}*.gz` wont work give you what you want Whilst `*{R1,R2}*.gz` will. + + +## Data organization +The pipeline can't take a list of multiple input files - it takes a glob expression. If your input files are scattered in different paths then we recommend that you generate a directory with symlinked files. If running in paired end mode please make sure that your files are sensibly named so that they can be properly paired. See the previous point. + +## Extra resources and getting help +If you still have an issue with running the pipeline then feel free to contact us. +Have a look at the [pipeline website](https://github.com/nf-core/lehtio-quant-proteomics) to find out how. + +If you have problems that are related to Nextflow and not our pipeline then check out the [Nextflow gitter channel](https://gitter.im/nextflow-io/nextflow) or the [google group](https://groups.google.com/forum/#!forum/nextflow). diff --git a/docs/usage.md b/docs/usage.md new file mode 100644 index 0000000..357e4d0 --- /dev/null +++ b/docs/usage.md @@ -0,0 +1,239 @@ +# nf-core/lehtio-quant-proteomics: Usage + +## Table of contents + +* [Introduction](#general-nextflow-info) +* [Running the pipeline](#running-the-pipeline) +* [Updating the pipeline](#updating-the-pipeline) +* [Reproducibility](#reproducibility) +* [Main arguments](#main-arguments) + * [`-profile`](#-profile-single-dash) + * [`docker`](#docker) + * [`awsbatch`](#awsbatch) + * [`standard`](#standard) + * [`none`](#none) + * [`--reads`](#--reads) + * [`--singleEnd`](#--singleend) +* [Reference Genomes](#reference-genomes) + * [`--genome`](#--genome) + * [`--fasta`](#--fasta) +* [Job Resources](#job-resources) +* [Automatic resubmission](#automatic-resubmission) +* [Custom resource requests](#custom-resource-requests) +* [AWS batch specific parameters](#aws-batch-specific-parameters) + * [`-awsbatch`](#-awsbatch) + * [`--awsqueue`](#--awsqueue) + * [`--awsregion`](#--awsregion) +* [Other command line parameters](#other-command-line-parameters) + * [`--outdir`](#--outdir) + * [`--email`](#--email) + * [`-name`](#-name-single-dash) + * [`-resume`](#-resume-single-dash) + * [`-c`](#-c-single-dash) + * [`--max_memory`](#--max_memory) + * [`--max_time`](#--max_time) + * [`--max_cpus`](#--max_cpus) + * [`--plaintext_emails`](#--plaintext_emails) + * [`--sampleLevel`](#--sampleLevel) + * [`--multiqc_config`](#--multiqc_config) + + +## General Nextflow info +Nextflow handles job submissions on SLURM or other environments, and supervises running the jobs. Thus the Nextflow process must run until the pipeline is finished. We recommend that you put the process running in the background through `screen` / `tmux` or similar tool. Alternatively you can run nextflow within a cluster job submitted your job scheduler. + +It is recommended to limit the Nextflow Java virtual machines memory. We recommend adding the following line to your environment (typically in `~/.bashrc` or `~./bash_profile`): + +```bash +NXF_OPTS='-Xms1g -Xmx4g' +``` + +## Running the pipeline +The typical command for running the pipeline is as follows: +```bash +nextflow run nf-core/lehtio-quant-proteomics --reads '*_R{1,2}.fastq.gz' -profile standard,docker +``` + +This will launch the pipeline with the `docker` configuration profile. See below for more information about profiles. + +Note that the pipeline will create the following files in your working directory: + +```bash +work # Directory containing the nextflow working files +results # Finished results (configurable, see below) +.nextflow_log # Log file from Nextflow +# Other nextflow hidden files, eg. history of pipeline runs and old logs. +``` + +### Updating the pipeline +When you run the above command, Nextflow automatically pulls the pipeline code from GitHub and stores it as a cached version. When running the pipeline after this, it will always use the cached version if available - even if the pipeline has been updated since. To make sure that you're running the latest version of the pipeline, make sure that you regularly update the cached version of the pipeline: + +```bash +nextflow pull nf-core/lehtio-quant-proteomics +``` + +### Reproducibility +It's a good idea to specify a pipeline version when running the pipeline on your data. This ensures that a specific version of the pipeline code and software are used when you run your pipeline. If you keep using the same tag, you'll be running the same version of the pipeline, even if there have been changes to the code since. + +First, go to the [nf-core/lehtio-quant-proteomics releases page](https://github.com/nf-core/lehtio-quant-proteomics/releases) and find the latest version number - numeric only (eg. `1.3.1`). Then specify this when running the pipeline with `-r` (one hyphen) - eg. `-r 1.3.1`. + +This version number will be logged in reports when you run the pipeline, so that you'll know what you used when you look back in the future. + + +## Main Arguments + +### `-profile` +Use this parameter to choose a configuration profile. Profiles can give configuration presets for different compute environments. Note that multiple profiles can be loaded, for example: `-profile standard,docker` - the order of arguments is important! + +* `standard` + * The default profile, used if `-profile` is not specified at all. + * Runs locally and expects all software to be installed and available on the `PATH`. +* `docker` + * A generic configuration profile to be used with [Docker](http://docker.com/) + * Pulls software from dockerhub: [`nfcore/lehtio-quant-proteomics`](http://hub.docker.com/r/nfcore/lehtio-quant-proteomics/) +* `singularity` + * A generic configuration profile to be used with [Singularity](http://singularity.lbl.gov/) + * Pulls software from singularity-hub +* `conda` + * A generic configuration profile to be used with [conda](https://conda.io/docs/) + * Pulls most software from [Bioconda](https://bioconda.github.io/) +* `awsbatch` + * A generic configuration profile to be used with AWS Batch. +* `test` + * A profile with a complete configuration for automated testing + * Includes links to test data so needs no other parameters +* `none` + * No configuration at all. Useful if you want to build your own config from scratch and want to avoid loading in the default `base` config profile (not recommended). + +### `--reads` +Use this to specify the location of your input FastQ files. For example: + +```bash +--reads 'path/to/data/sample_*_{1,2}.fastq' +``` + +Please note the following requirements: + +1. The path must be enclosed in quotes +2. The path must have at least one `*` wildcard character +3. When using the pipeline with paired end data, the path must use `{1,2}` notation to specify read pairs. + +If left unspecified, a default pattern is used: `data/*{1,2}.fastq.gz` + +### `--singleEnd` +By default, the pipeline expects paired-end data. If you have single-end data, you need to specify `--singleEnd` on the command line when you launch the pipeline. A normal glob pattern, enclosed in quotation marks, can then be used for `--reads`. For example: + +```bash +--singleEnd --reads '*.fastq' +``` + +It is not possible to run a mixture of single-end and paired-end files in one run. + + +## Reference Genomes + +The pipeline config files come bundled with paths to the illumina iGenomes reference index files. If running with docker or AWS, the configuration is set up to use the [AWS-iGenomes](https://ewels.github.io/AWS-iGenomes/) resource. + +### `--genome` (using iGenomes) +There are 31 different species supported in the iGenomes references. To run the pipeline, you must specify which to use with the `--genome` flag. + +You can find the keys to specify the genomes in the [iGenomes config file](../conf/igenomes.config). Common genomes that are supported are: + +* Human + * `--genome GRCh37` +* Mouse + * `--genome GRCm38` +* _Drosophila_ + * `--genome BDGP6` +* _S. cerevisiae_ + * `--genome 'R64-1-1'` + +> There are numerous others - check the config file for more. + +Note that you can use the same configuration setup to save sets of reference files for your own use, even if they are not part of the iGenomes resource. See the [Nextflow documentation](https://www.nextflow.io/docs/latest/config.html) for instructions on where to save such a file. + +The syntax for this reference configuration is as follows: + +```nextflow +params { + genomes { + 'GRCh37' { + fasta = '' // Used if no star index given + } + // Any number of additional genomes, key is used with --genome + } +} +``` + +### `--fasta` +If you prefer, you can specify the full path to your reference genome when you run the pipeline: + +```bash +--fasta '[path to Fasta reference]' +``` + +## Job Resources +### Automatic resubmission +Each step in the pipeline has a default set of requirements for number of CPUs, memory and time. For most of the steps in the pipeline, if the job exits with an error code of `143` (exceeded requested resources) it will automatically resubmit with higher requests (2 x original, then 3 x original). If it still fails after three times then the pipeline is stopped. + +### Custom resource requests +Wherever process-specific requirements are set in the pipeline, the default value can be changed by creating a custom config file. See the files in [`conf`](../conf) for examples. + +## AWS Batch specific parameters +Running the pipeline on AWS Batch requires a couple of specific parameters to be set according to your AWS Batch configuration. Please use the `-awsbatch` profile and then specify all of the following parameters. +### `--awsqueue` +The JobQueue that you intend to use on AWS Batch. +### `--awsregion` +The AWS region to run your job in. Default is set to `eu-west-1` but can be adjusted to your needs. + +Please make sure to also set the `-w/--work-dir` and `--outdir` parameters to a S3 storage bucket of your choice - you'll get an error message notifying you if you didn't. + +## Other command line parameters + +### `--outdir` +The output directory where the results will be saved. + +### `--email` +Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits. If set in your user config file (`~/.nextflow/config`) then you don't need to speicfy this on the command line for every run. + +### `-name` +Name for the pipeline run. If not specified, Nextflow will automatically generate a random mnemonic. + +This is used in the MultiQC report (if not default) and in the summary HTML / e-mail (always). + +**NB:** Single hyphen (core Nextflow option) + +### `-resume` +Specify this when restarting a pipeline. Nextflow will used cached results from any pipeline steps where the inputs are the same, continuing from where it got to previously. + +You can also supply a run name to resume a specific run: `-resume [run-name]`. Use the `nextflow log` command to show previous run names. + +**NB:** Single hyphen (core Nextflow option) + +### `-c` +Specify the path to a specific config file (this is a core NextFlow command). + +**NB:** Single hyphen (core Nextflow option) + +Note - you can use this to override defaults. For example, you can specify a config file using `-c` that contains the following: + +```nextflow +process.$multiqc.module = [] +``` + +### `--max_memory` +Use to set a top-limit for the default memory requirement for each process. +Should be a string in the format integer-unit. eg. `--max_memory '8.GB'`` + +### `--max_time` +Use to set a top-limit for the default time requirement for each process. +Should be a string in the format integer-unit. eg. `--max_time '2.h'` + +### `--max_cpus` +Use to set a top-limit for the default CPU requirement for each process. +Should be a string in the format integer-unit. eg. `--max_cpus 1` + +### `--plaintext_email` +Set to receive plain-text e-mails instead of HTML formatted. + +### `--multiqc_config` +Specify a path to a custom MultiQC configuration file. diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..ba9ca77 --- /dev/null +++ b/environment.yml @@ -0,0 +1,8 @@ +name: nf-core-lehtio-quant-proteomics-1.0dev +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - fastqc=0.11.7 + - multiqc=1.6 diff --git a/main.nf b/main.nf new file mode 100644 index 0000000..556ca65 --- /dev/null +++ b/main.nf @@ -0,0 +1,347 @@ +#!/usr/bin/env nextflow +/* +======================================================================================== + nf-core/lehtio-quant-proteomics +======================================================================================== + nf-core/lehtio-quant-proteomics Analysis Pipeline. + #### Homepage / Documentation + https://github.com/nf-core/lehtio-quant-proteomics +---------------------------------------------------------------------------------------- +*/ + + +def helpMessage() { + log.info""" + ========================================= + nf-core/lehtio-quant-proteomics v${workflow.manifest.version} + ========================================= + Usage: + + The typical command for running the pipeline is as follows: + + nextflow run nf-core/lehtio-quant-proteomics --reads '*_R{1,2}.fastq.gz' -profile standard,docker + + Mandatory arguments: + --reads Path to input data (must be surrounded with quotes) + --genome Name of iGenomes reference + -profile Configuration profile to use. Can use multiple (comma separated) + Available: standard, conda, docker, singularity, awsbatch, test + + Options: + --singleEnd Specifies that the input is single end reads + + References If not specified in the configuration file or you wish to overwrite any of the references. + --fasta Path to Fasta reference + + Other options: + --outdir The output directory where the results will be saved + --email Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits + -name Name for the pipeline run. If not specified, Nextflow will automatically generate a random mnemonic. + + AWSBatch options: + --awsqueue The AWSBatch JobQueue that needs to be set when running on AWSBatch + --awsregion The AWS Region for your AWS Batch job to run on + """.stripIndent() +} + +/* + * SET UP CONFIGURATION VARIABLES + */ + +// Show help emssage +if (params.help){ + helpMessage() + exit 0 +} + +// Configurable variables +params.name = false +params.fasta = params.genome ? params.genomes[ params.genome ].fasta ?: false : false +params.multiqc_config = "$baseDir/conf/multiqc_config.yaml" +params.email = false +params.plaintext_email = false + +multiqc_config = file(params.multiqc_config) +output_docs = file("$baseDir/docs/output.md") + +// Validate inputs +if ( params.fasta ){ + fasta = file(params.fasta) + if( !fasta.exists() ) exit 1, "Fasta file not found: ${params.fasta}" +} +// AWSBatch sanity checking +if(workflow.profile == 'awsbatch'){ + if (!params.awsqueue || !params.awsregion) exit 1, "Specify correct --awsqueue and --awsregion parameters on AWSBatch!" + if (!workflow.workDir.startsWith('s3') || !params.outdir.startsWith('s3')) exit 1, "Specify S3 URLs for workDir and outdir parameters on AWSBatch!" +} +// +// NOTE - THIS IS NOT USED IN THIS PIPELINE, EXAMPLE ONLY +// If you want to use the above in a process, define the following: +// input: +// file fasta from fasta +// + + +// Has the run name been specified by the user? +// this has the bonus effect of catching both -name and --name +custom_runName = params.name +if( !(workflow.runName ==~ /[a-z]+_[a-z]+/) ){ + custom_runName = workflow.runName +} + +// Check workDir/outdir paths to be S3 buckets if running on AWSBatch +// related: https://github.com/nextflow-io/nextflow/issues/813 +if( workflow.profile == 'awsbatch') { + if(!workflow.workDir.startsWith('s3:') || !params.outdir.startsWith('s3:')) exit 1, "Workdir or Outdir not on S3 - specify S3 Buckets for each to run on AWSBatch!" +} + +/* + * Create a channel for input read files + */ + if(params.readPaths){ + if(params.singleEnd){ + Channel + .from(params.readPaths) + .map { row -> [ row[0], [file(row[1][0])]] } + .ifEmpty { exit 1, "params.readPaths was empty - no input files supplied" } + .into { read_files_fastqc; read_files_trimming } + } else { + Channel + .from(params.readPaths) + .map { row -> [ row[0], [file(row[1][0]), file(row[1][1])]] } + .ifEmpty { exit 1, "params.readPaths was empty - no input files supplied" } + .into { read_files_fastqc; read_files_trimming } + } + } else { + Channel + .fromFilePairs( params.reads, size: params.singleEnd ? 1 : 2 ) + .ifEmpty { exit 1, "Cannot find any reads matching: ${params.reads}\nNB: Path needs to be enclosed in quotes!\nIf this is single-end data, please specify --singleEnd on the command line." } + .into { read_files_fastqc; read_files_trimming } + } + + +// Header log info +log.info """======================================================= + ,--./,-. + ___ __ __ __ ___ /,-._.--~\' + |\\ | |__ __ / ` / \\ |__) |__ } { + | \\| | \\__, \\__/ | \\ |___ \\`-._,-`-, + `._,._,\' + +nf-core/lehtio-quant-proteomics v${workflow.manifest.version}" +=======================================================""" +def summary = [:] +summary['Pipeline Name'] = 'nf-core/lehtio-quant-proteomics' +summary['Pipeline Version'] = workflow.manifest.version +summary['Run Name'] = custom_runName ?: workflow.runName +summary['Reads'] = params.reads +summary['Fasta Ref'] = params.fasta +summary['Data Type'] = params.singleEnd ? 'Single-End' : 'Paired-End' +summary['Max Memory'] = params.max_memory +summary['Max CPUs'] = params.max_cpus +summary['Max Time'] = params.max_time +summary['Output dir'] = params.outdir +summary['Working dir'] = workflow.workDir +summary['Container Engine'] = workflow.containerEngine +if(workflow.containerEngine) summary['Container'] = workflow.container +summary['Current home'] = "$HOME" +summary['Current user'] = "$USER" +summary['Current path'] = "$PWD" +summary['Working dir'] = workflow.workDir +summary['Output dir'] = params.outdir +summary['Script dir'] = workflow.projectDir +summary['Config Profile'] = workflow.profile +if(workflow.profile == 'awsbatch'){ + summary['AWS Region'] = params.awsregion + summary['AWS Queue'] = params.awsqueue +} +if(params.email) summary['E-mail Address'] = params.email +log.info summary.collect { k,v -> "${k.padRight(15)}: $v" }.join("\n") +log.info "=========================================" + + +def create_workflow_summary(summary) { + + def yaml_file = workDir.resolve('workflow_summary_mqc.yaml') + yaml_file.text = """ + id: 'nf-core-lehtio-quant-proteomics-summary' + description: " - this information is collected when the pipeline is started." + section_name: 'nf-core/lehtio-quant-proteomics Workflow Summary' + section_href: 'https://github.com/nf-core/lehtio-quant-proteomics' + plot_type: 'html' + data: | +
+${summary.collect { k,v -> "
$k
${v ?: 'N/A'}
" }.join("\n")} +
+ """.stripIndent() + + return yaml_file +} + + +/* + * Parse software version numbers + */ +process get_software_versions { + + output: + file 'software_versions_mqc.yaml' into software_versions_yaml + + script: + """ + echo $workflow.manifest.version > v_pipeline.txt + echo $workflow.nextflow.version > v_nextflow.txt + fastqc --version > v_fastqc.txt + multiqc --version > v_multiqc.txt + scrape_software_versions.py > software_versions_mqc.yaml + """ +} + + + +/* + * STEP 1 - FastQC + */ +process fastqc { + tag "$name" + publishDir "${params.outdir}/fastqc", mode: 'copy', + saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"} + + input: + set val(name), file(reads) from read_files_fastqc + + output: + file "*_fastqc.{zip,html}" into fastqc_results + + script: + """ + fastqc -q $reads + """ +} + + + +/* + * STEP 2 - MultiQC + */ +process multiqc { + publishDir "${params.outdir}/MultiQC", mode: 'copy' + + input: + file multiqc_config + file ('fastqc/*') from fastqc_results.collect() + file ('software_versions/*') from software_versions_yaml + file workflow_summary from create_workflow_summary(summary) + + output: + file "*multiqc_report.html" into multiqc_report + file "*_data" + + script: + rtitle = custom_runName ? "--title \"$custom_runName\"" : '' + rfilename = custom_runName ? "--filename " + custom_runName.replaceAll('\\W','_').replaceAll('_+','_') + "_multiqc_report" : '' + """ + multiqc -f $rtitle $rfilename --config $multiqc_config . + """ +} + + + +/* + * STEP 3 - Output Description HTML + */ +process output_documentation { + tag "$prefix" + publishDir "${params.outdir}/Documentation", mode: 'copy' + + input: + file output_docs + + output: + file "results_description.html" + + script: + """ + markdown_to_html.r $output_docs results_description.html + """ +} + + + +/* + * Completion e-mail notification + */ +workflow.onComplete { + + // Set up the e-mail variables + def subject = "[nf-core/lehtio-quant-proteomics] Successful: $workflow.runName" + if(!workflow.success){ + subject = "[nf-core/lehtio-quant-proteomics] FAILED: $workflow.runName" + } + def email_fields = [:] + email_fields['version'] = workflow.manifest.version + email_fields['runName'] = custom_runName ?: workflow.runName + email_fields['success'] = workflow.success + email_fields['dateComplete'] = workflow.complete + email_fields['duration'] = workflow.duration + email_fields['exitStatus'] = workflow.exitStatus + email_fields['errorMessage'] = (workflow.errorMessage ?: 'None') + email_fields['errorReport'] = (workflow.errorReport ?: 'None') + email_fields['commandLine'] = workflow.commandLine + email_fields['projectDir'] = workflow.projectDir + email_fields['summary'] = summary + email_fields['summary']['Date Started'] = workflow.start + email_fields['summary']['Date Completed'] = workflow.complete + email_fields['summary']['Pipeline script file path'] = workflow.scriptFile + email_fields['summary']['Pipeline script hash ID'] = workflow.scriptId + if(workflow.repository) email_fields['summary']['Pipeline repository Git URL'] = workflow.repository + if(workflow.commitId) email_fields['summary']['Pipeline repository Git Commit'] = workflow.commitId + if(workflow.revision) email_fields['summary']['Pipeline Git branch/tag'] = workflow.revision + email_fields['summary']['Nextflow Version'] = workflow.nextflow.version + email_fields['summary']['Nextflow Build'] = workflow.nextflow.build + email_fields['summary']['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp + + // Render the TXT template + def engine = new groovy.text.GStringTemplateEngine() + def tf = new File("$baseDir/assets/email_template.txt") + def txt_template = engine.createTemplate(tf).make(email_fields) + def email_txt = txt_template.toString() + + // Render the HTML template + def hf = new File("$baseDir/assets/email_template.html") + def html_template = engine.createTemplate(hf).make(email_fields) + def email_html = html_template.toString() + + // Render the sendmail template + def smail_fields = [ email: params.email, subject: subject, email_txt: email_txt, email_html: email_html, baseDir: "$baseDir" ] + def sf = new File("$baseDir/assets/sendmail_template.txt") + def sendmail_template = engine.createTemplate(sf).make(smail_fields) + def sendmail_html = sendmail_template.toString() + + // Send the HTML e-mail + if (params.email) { + try { + if( params.plaintext_email ){ throw GroovyException('Send plaintext e-mail, not HTML') } + // Try to send HTML e-mail using sendmail + [ 'sendmail', '-t' ].execute() << sendmail_html + log.info "[nf-core/lehtio-quant-proteomics] Sent summary e-mail to $params.email (sendmail)" + } catch (all) { + // Catch failures and try with plaintext + [ 'mail', '-s', subject, params.email ].execute() << email_txt + log.info "[nf-core/lehtio-quant-proteomics] Sent summary e-mail to $params.email (mail)" + } + } + + // Write summary e-mail HTML to a file + def output_d = new File( "${params.outdir}/Documentation/" ) + if( !output_d.exists() ) { + output_d.mkdirs() + } + def output_hf = new File( output_d, "pipeline_report.html" ) + output_hf.withWriter { w -> w << email_html } + def output_tf = new File( output_d, "pipeline_report.txt" ) + output_tf.withWriter { w -> w << email_txt } + + log.info "[nf-core/lehtio-quant-proteomics] Pipeline Complete" + +} diff --git a/nextflow.config b/nextflow.config new file mode 100644 index 0000000..b907d83 --- /dev/null +++ b/nextflow.config @@ -0,0 +1,118 @@ +/* + * ------------------------------------------------- + * nf-core/lehtio-quant-proteomics Nextflow config file + * ------------------------------------------------- + * Default config options for all environments. + * Cluster-specific config options should be saved + * in the conf folder and imported under a profile + * name here. + */ + +// Global default params, used in configs +params { + + container = 'nfcore/lehtio-quant-proteomics:latest' // Container slug. Stable releases should specify release tag! + + help = false + reads = "data/*{1,2}.fastq.gz" + singleEnd = false + outdir = './results' + igenomes_base = "./iGenomes" + tracedir = "${params.outdir}/pipeline_info" + clusterOptions = false + awsqueue = false + awsregion = 'eu-west-1' +} + +profiles { + + standard { + includeConfig 'conf/base.config' + } + conda { process.conda = "$baseDir/environment.yml" } + docker { + docker.enabled = true + process.container = params.container + } + singularity { + singularity.enabled = true + process.container = {"shub://${params.container.replace('nfcore', 'nf-core')}"} + } + awsbatch { + includeConfig 'conf/base.config' + includeConfig 'conf/awsbatch.config' + includeConfig 'conf/igenomes.config' + } + test { + includeConfig 'conf/base.config' + includeConfig 'conf/test.config' + } + debug { process.beforeScript = 'echo $HOSTNAME' } + none { + // Don't load any config (for use with custom home configs) + } + +} + +// Capture exit codes from upstream processes when piping +process.shell = ['/bin/bash', '-euo', 'pipefail'] + +timeline { + enabled = true + file = "${params.tracedir}/nf-core/lehtio-quant-proteomics_timeline.html" +} +report { + enabled = true + file = "${params.tracedir}/nf-core/lehtio-quant-proteomics_report.html" +} +trace { + enabled = true + file = "${params.tracedir}/nf-core/lehtio-quant-proteomics_trace.txt" +} +dag { + enabled = true + file = "${params.tracedir}/nf-core/lehtio-quant-proteomics_dag.svg" +} + +manifest { + name = 'nf-core/lehtio-quant-proteomics' + author = 'Project author name (use a comma to separate multiple names).' + homePage = 'https://github.com/nf-core/lehtio-quant-proteomics' + description = 'Quantitative shotgun MS proteomics as done in Lehtio lab' + mainScript = 'main.nf' + nextflowVersion = '>=0.32.0' + version = '1.0dev' +} + +// Function to ensure that resource requirements don't go beyond +// a maximum limit +def check_max(obj, type) { + if(type == 'memory'){ + try { + if(obj.compareTo(params.max_memory as nextflow.util.MemoryUnit) == 1) + return params.max_memory as nextflow.util.MemoryUnit + else + return obj + } catch (all) { + println " ### ERROR ### Max memory '${params.max_memory}' is not valid! Using default value: $obj" + return obj + } + } else if(type == 'time'){ + try { + if(obj.compareTo(params.max_time as nextflow.util.Duration) == 1) + return params.max_time as nextflow.util.Duration + else + return obj + } catch (all) { + println " ### ERROR ### Max time '${params.max_time}' is not valid! Using default value: $obj" + return obj + } + } else if(type == 'cpus'){ + try { + return Math.min( obj, params.max_cpus as int ) + } catch (all) { + println " ### ERROR ### Max cpus '${params.max_cpus}' is not valid! Using default value: $obj" + return obj + } + } +}