diff --git a/.github/workflows/awsfulltest.yml b/.github/workflows/awsfulltest.yml index 4d71d9a3f171658e4189107f2abc239f9f98bfa2..82c1a4ecd1bac8b5410b2825e230f9f3924594d3 100644 --- a/.github/workflows/awsfulltest.yml +++ b/.github/workflows/awsfulltest.yml @@ -28,6 +28,3 @@ jobs: "outdir": "s3://${{ secrets.AWS_S3_BUCKET }}/hic/results-${{ github.sha }}" } profiles: test_full,aws_tower - nextflow_config: | - process.errorStrategy = 'retry' - process.maxRetries = 3 diff --git a/.github/workflows/awstest.yml b/.github/workflows/awstest.yml index f892cfd3f1d6deb2f2c57cd60269c51638c85dc6..5cd0714273dca87007b7c5ea50df27d05fe3606d 100644 --- a/.github/workflows/awstest.yml +++ b/.github/workflows/awstest.yml @@ -23,6 +23,3 @@ jobs: "outdir": "s3://${{ secrets.AWS_S3_BUCKET }}/hic/results-test-${{ github.sha }}" } profiles: test,aws_tower - nextflow_config: | - process.errorStrategy = 'retry' - process.maxRetries = 3 diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 363667229e33a8fe022f697e4755d911234a12fb..b92e3d24195d72e7a4c39605fd29de3cf657bd06 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -13,7 +13,7 @@ jobs: - name: Check PRs if: github.repository == 'nf-core/hic' run: | - "{ [[ ${{github.event.pull_request.head.repo.full_name }} == nf-core/hic ]] && [[ $GITHUB_HEAD_REF = "dev" ]]; } || [[ $GITHUB_HEAD_REF == "patch" ]]" + { [[ ${{github.event.pull_request.head.repo.full_name }} == nf-core/hic ]] && [[ $GITHUB_HEAD_REF = "dev" ]]; } || [[ $GITHUB_HEAD_REF == "patch" ]] # If the above check failed, post a comment on the PR explaining the failure # NOTE - this doesn't currently work if the PR is coming from a fork, due to limitations in GitHub actions secrets @@ -42,4 +42,3 @@ jobs: Thanks again for your contribution! repo-token: ${{ secrets.GITHUB_TOKEN }} allow-repeats: false -# diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc0fc52d25b4945b1bf0e460f3ce6527e5cad992..0dac5c2786f66f7e503085c858823a4833afb92a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,3 @@ jobs: - name: Run pipeline with test data run: | nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results - -# - diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml new file mode 100644 index 0000000000000000000000000000000000000000..502eff95019714bf6b719046f0127d1e998f6b8a --- /dev/null +++ b/.github/workflows/fix-linting.yml @@ -0,0 +1,55 @@ +name: Fix linting from a comment +on: + issue_comment: + types: [created] + +jobs: + deploy: + # Only run if comment is on a PR with the main repo, and if it contains the magic keywords + if: > + contains(github.event.comment.html_url, '/pull/') && + contains(github.event.comment.body, '@nf-core-bot fix linting') && + github.repository == 'nf-core/hic' + runs-on: ubuntu-latest + steps: + # Use the @nf-core-bot token to check out so we can push later + - uses: actions/checkout@v3 + with: + token: ${{ secrets.nf_core_bot_auth_token }} + + # Action runs on the issue comment, so we don't get the PR by default + # Use the gh cli to check out the PR + - name: Checkout Pull Request + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} + + - uses: actions/setup-node@v2 + + - name: Install Prettier + run: npm install -g prettier @prettier/plugin-php + + # Check that we actually need to fix something + - name: Run 'prettier --check' + id: prettier_status + run: | + if prettier --check ${GITHUB_WORKSPACE}; then + echo "::set-output name=result::pass" + else + echo "::set-output name=result::fail" + fi + + - name: Run 'prettier --write' + if: steps.prettier_status.outputs.result == 'fail' + run: prettier --write ${GITHUB_WORKSPACE} + + - name: Commit & push changes + if: steps.prettier_status.outputs.result == 'fail' + run: | + git config user.email "core@nf-co.re" + git config user.name "nf-core-bot" + git config push.default upstream + git add . + git status + git commit -m "[automated] Fix linting with Prettier" + git push diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index e9cf5de3ac6a3a8a41923568a170315053d7e2e0..77358dee77fafceacab736de94ae79f2258a523f 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -48,7 +48,7 @@ jobs: wget -qO- get.nextflow.io | bash sudo mv nextflow /usr/local/bin/ - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v3 with: python-version: "3.6" architecture: "x64" @@ -78,5 +78,3 @@ jobs: lint_log.txt lint_results.md PR_number.txt - -# diff --git a/.github/workflows/linting_comment.yml b/.github/workflows/linting_comment.yml index 91c487a1a5020bf2b0ff8d31a3c2b9d589e5fed8..04758f61e368b37a7651aff015e51a9c31162542 100644 --- a/.github/workflows/linting_comment.yml +++ b/.github/workflows/linting_comment.yml @@ -26,4 +26,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} number: ${{ steps.pr_number.outputs.pr_number }} path: linting-logs/lint_results.md -# diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000000000000000000000000000000000..d0e7ae58916d32ec5fc706ae0eda9403db44f290 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +email_template.html +.nextflow* +work/ +data/ +results/ +.DS_Store +testing/ +testing* +*.pyc diff --git a/CHANGELOG.md b/CHANGELOG.md index 3478c9d43223d5a31da6b35c737006e0a691242e..b66d2bc633650b8e74a028f5e760a79c83627dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## v1.4.0 +## v1.4.0dev ### `Added` diff --git a/README.md b/README.md index 8e7f9b97c22fc4459536d5ed97acd5134277a666..48a23b070e337e18fd7ceb230d4aa802f7bdd4e5 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,19 @@ -#   +#   [](https://github.com/nf-core/hic/actions?query=workflow%3A%22nf-core+CI%22) [](https://github.com/nf-core/hic/actions?query=workflow%3A%22nf-core+linting%22) -[](https://nf-co.re/hic/results) -[](https://doi.org/10.5281/zenodo.XXXXXXX) -[](https://www.nextflow.io/) -[](https://docs.conda.io/en/latest/) -[](https://www.docker.com/) -[](https://sylabs.io/docs/) - -[](https://nfcore.slack.com/channels/hic) -[](https://twitter.com/nf_core) -[](https://www.youtube.com/c/nf-core) +[](https://nf-co.re/hic/results) +[](https://doi.org/10.5281/zenodo.XXXXXXX) + +[](https://www.nextflow.io/) +[](https://docs.conda.io/en/latest/) +[](https://www.docker.com/) +[](https://sylabs.io/docs/) +[](https://tower.nf/launch?pipeline=https://github.com/nf-core/hic) + +[](https://nfcore.slack.com/channels/hic) +[](https://twitter.com/nf_core) +[](https://www.youtube.com/c/nf-core) ## Introduction diff --git a/assets/email_template.html b/assets/email_template.html index 80d5dac884d9d5032c63f7be02e8bb7c788a51d7..d207f011f3ab74ac04ace7a4e277c59900cf058a 100644 --- a/assets/email_template.html +++ b/assets/email_template.html @@ -1,111 +1,53 @@ <html> - <head> - <meta charset="utf-8" /> - <meta http-equiv="X-UA-Compatible" content="IE=edge" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> - <!-- prettier-ignore --> - <meta name="description" content="nf-core/hic: Analysis of Chromosome Conformation Capture data (Hi-C)" /> - <title>nf-core/hic Pipeline Report</title> - </head> - <body> - <div style="font-family: Helvetica, Arial, sans-serif; padding: 30px; max-width: 800px; margin: 0 auto"> - <img src="cid:nfcorepipelinelogo" /> + <meta name="description" content="nf-core/hic: Analysis of Chromosome Conformation Capture data (Hi-C)"> + <title>nf-core/hic Pipeline Report</title> +</head> +<body> +<div style="font-family: Helvetica, Arial, sans-serif; padding: 30px; max-width: 800px; margin: 0 auto;"> - <h1>nf-core/hic v${version}</h1> - <h2>Run Name: $runName</h2> +<img src="cid:nfcorepipelinelogo"> - <% if (!success){ out << """ - <div - style=" - color: #a94442; - background-color: #f2dede; - border-color: #ebccd1; - padding: 15px; - margin-bottom: 20px; - border: 1px solid transparent; - border-radius: 4px; - " - > - <h4 style="margin-top: 0; color: inherit">nf-core/hic execution completed unsuccessfully!</h4> +<h1>nf-core/hic v${version}</h1> +<h2>Run Name: $runName</h2> + +<% if (!success){ + out << """ + <div style="color: #a94442; background-color: #f2dede; border-color: #ebccd1; padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px;"> + <h4 style="margin-top:0; color: inherit;">nf-core/hic execution completed unsuccessfully!</h4> <p>The exit status of the task that caused the workflow execution to fail was: <code>$exitStatus</code>.</p> <p>The full error message was:</p> - <pre style="white-space: pre-wrap; overflow: visible; margin-bottom: 0">${errorReport}</pre> - </div> - """ } else { out << """ - <div - style=" - color: #3c763d; - background-color: #dff0d8; - border-color: #d6e9c6; - padding: 15px; - margin-bottom: 20px; - border: 1px solid transparent; - border-radius: 4px; - " - > + <pre style="white-space: pre-wrap; overflow: visible; margin-bottom: 0;">${errorReport}</pre> + </div> + """ +} else { + out << """ + <div style="color: #3c763d; background-color: #dff0d8; border-color: #d6e9c6; padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px;"> nf-core/hic execution completed successfully! - </div> - """ } %> + </div> + """ +} +%> - <p>The workflow was completed at <strong>$dateComplete</strong> (duration: <strong>$duration</strong>)</p> - <p>The command used to launch the workflow was as follows:</p> - <pre - style=" - white-space: pre-wrap; - overflow: visible; - background-color: #ededed; - padding: 15px; - border-radius: 4px; - margin-bottom: 30px; - " - > -$commandLine</pre - > +<p>The workflow was completed at <strong>$dateComplete</strong> (duration: <strong>$duration</strong>)</p> +<p>The command used to launch the workflow was as follows:</p> +<pre style="white-space: pre-wrap; overflow: visible; background-color: #ededed; padding: 15px; border-radius: 4px; margin-bottom:30px;">$commandLine</pre> - <h3>Pipeline Configuration:</h3> - <table - style=" - width: 100%; - max-width: 100%; - border-spacing: 0; - border-collapse: collapse; - border: 0; - margin-bottom: 30px; - " - > - <tbody style="border-bottom: 1px solid #ddd"> - <% out << summary.collect{ k,v -> " - <tr> - <th - style=" - text-align: left; - padding: 8px 0; - line-height: 1.42857143; - vertical-align: top; - border-top: 1px solid #ddd; - " - > - $k - </th> - <td - style=" - text-align: left; - padding: 8px; - line-height: 1.42857143; - vertical-align: top; - border-top: 1px solid #ddd; - " - > - <pre style="white-space: pre-wrap; overflow: visible">$v</pre> - </td> - </tr> - " }.join("\n") %> - </tbody> - </table> +<h3>Pipeline Configuration:</h3> +<table style="width:100%; max-width:100%; border-spacing: 0; border-collapse: collapse; border:0; margin-bottom: 30px;"> + <tbody style="border-bottom: 1px solid #ddd;"> + <% out << summary.collect{ k,v -> "<tr><th style='text-align:left; padding: 8px 0; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #ddd;'>$k</th><td style='text-align:left; padding: 8px; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #ddd;'><pre style='white-space: pre-wrap; overflow: visible;'>$v</pre></td></tr>" }.join("\n") %> + </tbody> +</table> - <p>nf-core/hic</p> - <p><a href="https://github.com/nf-core/hic">https://github.com/nf-core/hic</a></p> - </div> - </body> +<p>nf-core/hic</p> +<p><a href="https://github.com/nf-core/hic">https://github.com/nf-core/hic</a></p> + +</div> + +</body> </html> diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 17137e53b338a6a6a3e591ab1c71a5879c045994..6be15bd25d60d6901b2ff4154033e6271d9f3869 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -97,7 +97,7 @@ class RowChecker: if row[self._first_col] and row[self._second_col]: row[self._single_col] = False assert ( - Path(row[self._first_col]).suffixes == Path(row[self._second_col]).suffixes + Path(row[self._first_col]).suffixes[-2:] == Path(row[self._second_col]).suffixes[-2:] ), "FASTQ pairs must have the same file extensions." else: row[self._single_col] = True @@ -128,6 +128,16 @@ class RowChecker: # row[self._sample_col] = f"{sample}_T{seen[sample]}" +def read_head(handle, num_lines=10): + """Read the specified number of lines from the current position in the file.""" + lines = [] + for idx, line in enumerate(handle): + if idx == num_lines: + break + lines.append(line) + return "".join(lines) + + def sniff_format(handle): """ Detect the tabular format. @@ -143,13 +153,13 @@ def sniff_format(handle): https://docs.python.org/3/glossary.html#term-text-file """ - peek = handle.read(2048) + peek = read_head(handle) + handle.seek(0) sniffer = csv.Sniffer() if not sniffer.has_header(peek): logger.critical(f"The given sample sheet does not appear to contain a header.") sys.exit(1) dialect = sniffer.sniff(peek) - handle.seek(0) return dialect diff --git a/nextflow.config b/nextflow.config index 2a010be8d32879513280943f75f3a54a11555fd0..b003a2270e2297c98f77d5e204e06e3f06f0df69 100644 --- a/nextflow.config +++ b/nextflow.config @@ -233,7 +233,7 @@ trace { } dag { enabled = true - file = "${params.tracedir}/pipeline_dag_${trace_timestamp}.svg" + file = "${params.tracedir}/pipeline_dag_${trace_timestamp}.html" } manifest {