diff --git a/.editorconfig b/.editorconfig index dd9ffa53..72dda289 100644 --- a/.editorconfig +++ b/.editorconfig @@ -28,10 +28,6 @@ indent_style = unset [/assets/email*] indent_size = unset -# ignore Readme -[README.md] -indent_style = unset - -# ignore python +# ignore python and markdown [*.{py,md}] indent_style = unset diff --git a/.github/workflows/awsfulltest.yml b/.github/workflows/awsfulltest.yml index 2919151f..6026e464 100644 --- a/.github/workflows/awsfulltest.yml +++ b/.github/workflows/awsfulltest.yml @@ -8,12 +8,12 @@ on: types: [published] workflow_dispatch: jobs: - run-tower: + run-platform: name: Run AWS full tests if: github.repository == 'nf-core/raredisease' runs-on: ubuntu-latest steps: - - name: Launch workflow via tower + - name: Launch workflow via Seqera Platform uses: seqeralabs/action-tower-launch@v2 # TODO nf-core: You can customise AWS full pipeline tests as required # Add full size test data (but still relatively small datasets for few samples) @@ -33,7 +33,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: Tower debug log file + name: Seqera Platform debug log file path: | - tower_action_*.log - tower_action_*.json + seqera_platform_action_*.log + seqera_platform_action_*.json diff --git a/.github/workflows/awstest.yml b/.github/workflows/awstest.yml index 4ed98bab..7a710d67 100644 --- a/.github/workflows/awstest.yml +++ b/.github/workflows/awstest.yml @@ -5,13 +5,13 @@ name: nf-core AWS test on: workflow_dispatch: jobs: - run-tower: + run-platform: name: Run AWS tests if: github.repository == 'nf-core/raredisease' runs-on: ubuntu-latest steps: - # Launch workflow using Tower CLI tool action - - name: Launch workflow via tower + # Launch workflow using Seqera Platform CLI tool action + - name: Launch workflow via Seqera Platform uses: seqeralabs/action-tower-launch@v2 with: workspace_id: ${{ secrets.TOWER_WORKSPACE_ID }} @@ -27,7 +27,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: Tower debug log file + name: Seqera Platform debug log file path: | - tower_action_*.log - tower_action_*.json + seqera_platform_action_*.log + seqera_platform_action_*.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feb000c0..6133668e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,10 @@ jobs: - "-profile test_one_sample,docker" steps: - name: Check out pipeline code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - name: Install Nextflow - uses: nf-core/setup-nextflow@v1 + uses: nf-core/setup-nextflow@v2 with: version: "${{ matrix.NXF_VER }}" diff --git a/.github/workflows/download_pipeline.yml b/.github/workflows/download_pipeline.yml index 3c7ee491..f24cc9ff 100644 --- a/.github/workflows/download_pipeline.yml +++ b/.github/workflows/download_pipeline.yml @@ -14,6 +14,8 @@ on: pull_request: types: - opened + - edited + - synchronize branches: - master pull_request_target: @@ -28,14 +30,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Nextflow - uses: nf-core/setup-nextflow@v1 + uses: nf-core/setup-nextflow@v2 - name: Disk space cleanup uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 - - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: - python-version: "3.11" + python-version: "3.12" architecture: "x64" - uses: eWaterCycle/setup-singularity@931d4e31109e875b13309ae1d07c70ca8fbc8537 # v7 with: @@ -68,7 +70,9 @@ jobs: - name: Inspect download run: tree ./${{ env.REPOTITLE_LOWERCASE }} - - name: Run the downloaded pipeline + - name: Run the downloaded pipeline (stub) + id: stub_run_pipeline + continue-on-error: true env: NXF_SINGULARITY_CACHEDIR: ./ NXF_SINGULARITY_HOME_MOUNT: true diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 114b102d..4dbed09c 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: # Use the @nf-core-bot token to check out so we can push later - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 with: token: ${{ secrets.nf_core_bot_auth_token }} @@ -32,9 +32,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} # Install and run pre-commit - - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: - python-version: 3.11 + python-version: "3.12" - name: Install pre-commit run: pip install pre-commit diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 073e1876..1fcafe88 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -14,13 +14,12 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - - name: Set up Python 3.11 - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + - name: Set up Python 3.12 + uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: - python-version: 3.11 - cache: "pip" + python-version: "3.12" - name: Install pre-commit run: pip install pre-commit @@ -32,14 +31,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out pipeline code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 - name: Install Nextflow - uses: nf-core/setup-nextflow@v1 + uses: nf-core/setup-nextflow@v2 - - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: - python-version: "3.11" + python-version: "3.12" architecture: "x64" - name: Install dependencies @@ -60,7 +59,7 @@ jobs: - name: Upload linting log file artifact if: ${{ always() }} - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 with: name: linting-logs path: | diff --git a/.github/workflows/linting_comment.yml b/.github/workflows/linting_comment.yml index b706875f..40acc23f 100644 --- a/.github/workflows/linting_comment.yml +++ b/.github/workflows/linting_comment.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download lint results - uses: dawidd6/action-download-artifact@f6b0bace624032e30a85a8fd9c1a7f8f611f5737 # v3 + uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3 with: workflow: linting.yml workflow_conclusion: completed diff --git a/.github/workflows/release-announcements.yml b/.github/workflows/release-announcements.yml index d468aeaa..03ecfcf7 100644 --- a/.github/workflows/release-announcements.yml +++ b/.github/workflows/release-announcements.yml @@ -12,7 +12,7 @@ jobs: - name: get topics and convert to hashtags id: get_topics run: | - curl -s https://nf-co.re/pipelines.json | jq -r '.remote_workflows[] | select(.full_name == "${{ github.repository }}") | .topics[]' | awk '{print "#"$0}' | tr '\n' ' ' >> $GITHUB_OUTPUT + echo "topics=$(curl -s https://nf-co.re/pipelines.json | jq -r '.remote_workflows[] | select(.full_name == "${{ github.repository }}") | .topics[]' | awk '{print "#"$0}' | tr '\n' ' ')" >> $GITHUB_OUTPUT - uses: rzr/fediverse-action@master with: @@ -25,13 +25,13 @@ jobs: Please see the changelog: ${{ github.event.release.html_url }} - ${{ steps.get_topics.outputs.GITHUB_OUTPUT }} #nfcore #openscience #nextflow #bioinformatics + ${{ steps.get_topics.outputs.topics }} #nfcore #openscience #nextflow #bioinformatics send-tweet: runs-on: ubuntu-latest steps: - - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 with: python-version: "3.10" - name: Install dependencies diff --git a/.nf-core.yml b/.nf-core.yml index 07152a97..8d084d3b 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -7,4 +7,6 @@ lint: - docs/images/nf-core-raredisease_logo_dark.png - docs/images/nf-core-raredisease_logo_light.png - assets/nf-core-raredisease_logo_light.png + modules_config: False repository_type: pipeline +nf_core_version: "2.14.1" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af57081f..4dc0f1dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,9 @@ repos: rev: "v3.1.0" hooks: - id: prettier + additional_dependencies: + - prettier@3.2.5 + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python rev: "2.7.3" hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index afabf4ad..6854689c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,59 @@ 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). +## 2.1.0 - Obelix [2024-05-29] + +### `Added` + +- A new aligner, bwameme [#553](https://github.com/nf-core/raredisease/pull/553) +- A new parameter `run_mt_for_wes` to turn on mitochondrial analysis for targeted analysis [#552](https://github.com/nf-core/raredisease/pull/552) +- A new parameter `bwa_as_fallback` to switch aligner to bwa in case bwamem2 fails [#551](https://github.com/nf-core/raredisease/pull/551) +- A new parameter `skip_me_calling` to skip mobile element calling and the subsequent annotation of them [#556](https://github.com/nf-core/raredisease/pull/556) + +### `Changed` + +- Changed valid values for sex according to the PED file format [#550](https://github.com/nf-core/raredisease/pull/550) +- Refactored config files [#538](https://github.com/nf-core/raredisease/pull/538) +- Refactored mobile element annotation subworkflow files [#538](https://github.com/nf-core/raredisease/pull/538) +- Refactored to remove "a process is defined more than once" warning [#557](https://github.com/nf-core/raredisease/pull/557) +- Updated modules [#558](https://github.com/nf-core/raredisease/pull/558) + +### `Fixed` + +- Include multiallelic indel sites in CADD scoring jobs [#545](https://github.com/nf-core/raredisease/pull/545) +- Fixed issues with samtools merge not being run on samples sequenced over multiple lanes [#538](https://github.com/nf-core/raredisease/pull/538) +- Fixed join issues in the mobile element calling subworkflow which occured when mobile_element_references were not provided [#556](https://github.com/nf-core/raredisease/pull/556) + +### Parameters + +| Old parameter | New parameter | +| ------------- | --------------- | +| | bwameme | +| | bwa_as_fallback | +| | run_mt_for_wes | +| | skip_me_calling | + +:::note +Parameter has been updated if both old and new parameter information is present. +Parameter has been added if just the new parameter information is present. +Parameter has been removed if new parameter information isn't present. +::: + +### Module updates + +| Tool | Old version | New version | +| -------- | ----------- | ----------- | +| bwa | 0.7.17 | 0.7.18 | +| CADD | 1.6.1 | 1.6.post1 | +| Sentieon | 202308.01 | 202308.02 | +| bwameme | | 1.0.6 | + +:::note +Version has been updated if both old and new version information is present. +Version has been added if just the new version information is present. +Version has been removed if new version information isn't present. +::: + ## 2.0.1 - Asterix (Patch) [2024-03-25] ### `Fixed` diff --git a/README.md b/README.md index 7f87ce0f..61bf27d0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/) [![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/) [![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/) -[![Launch on Seqera Platform](https://img.shields.io/badge/Launch%20%F0%9F%9A%80-Seqera%20Platform-%234256e7)](https://tower.nf/launch?pipeline=https://github.com/nf-core/raredisease) +[![Launch on Seqera Platform](https://img.shields.io/badge/Launch%20%F0%9F%9A%80-Seqera%20Platform-%234256e7)](https://cloud.seqera.io/launch?pipeline=https://github.com/nf-core/raredisease) [![Get help on Slack](http://img.shields.io/badge/slack-nf--core%20%23raredisease-4A154B?labelColor=000000&logo=slack)](https://nfcore.slack.com/channels/raredisease)[![Follow on Twitter](http://img.shields.io/badge/twitter-%40nf__core-1DA1F2?labelColor=000000&logo=twitter)](https://twitter.com/nf_core)[![Follow on Mastodon](https://img.shields.io/badge/mastodon-nf__core-6364ff?labelColor=FFFFFF&logo=mastodon)](https://mstdn.science/@nf_core)[![Watch on YouTube](http://img.shields.io/badge/youtube-nf--core-FF0000?labelColor=000000&logo=youtube)](https://www.youtube.com/c/nf-core) diff --git a/assets/multiqc_config.yml b/assets/multiqc_config.yml index 1880cf3e..02488444 100644 --- a/assets/multiqc_config.yml +++ b/assets/multiqc_config.yml @@ -3,9 +3,9 @@ custom_logo_url: https://github.com/nf-core/raredisease/ custom_logo_title: "nf-core/raredisease" report_comment: > - This report has been generated by the nf-core/raredisease + This report has been generated by the nf-core/raredisease analysis pipeline. For information about how to interpret these results, please see the - documentation. + documentation. report_section_order: "nf-core-raredisease-methods-description": order: -1000 diff --git a/assets/schema_input.json b/assets/schema_input.json index 7bcd1812..38249daa 100644 --- a/assets/schema_input.json +++ b/assets/schema_input.json @@ -40,9 +40,9 @@ ] }, "sex": { - "type": "integer", + "type": "string", "meta": ["sex"], - "enum": [0, 1, 2], + "enum": ["1", "2", "other"], "errorMessage": "Sex must be provided and cannot contain spaces" }, "phenotype": { diff --git a/conf/base.config b/conf/base.config index 3f84e832..c65c634b 100644 --- a/conf/base.config +++ b/conf/base.config @@ -57,7 +57,9 @@ process { errorStrategy = 'retry' maxRetries = 2 } - withName:CUSTOM_DUMPSOFTWAREVERSIONS { - cache = false + withName: 'NFCORE_RAREDISEASE:RAREDISEASE:.*' { + publishDir = [ + enabled: false + ] } } diff --git a/conf/modules/align.config b/conf/modules/align.config index 29fda646..84f4a36a 100644 --- a/conf/modules/align.config +++ b/conf/modules/align.config @@ -12,36 +12,27 @@ */ process{ - withName: '.*ALIGN:.*' { + + withName: '.*ALIGN:FASTP' { + ext.args = { [ + params.min_trimmed_length ? "--length_required ${params.min_trimmed_length}" : '', + '--correction', + '--overrepresentation_analysis' + ].join(' ').trim() } publishDir = [ - enabled: false + path: { "${params.outdir}/trimming" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } - if (!params.skip_fastp) { - withName: '.*ALIGN:FASTP' { - ext.args = { [ - params.min_trimmed_length ? "--length_required ${params.min_trimmed_length}" : '', - '--correction', - '--overrepresentation_analysis' - ].join(' ').trim() } - publishDir = [ - path: { "${params.outdir}/trimming" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - - if (params.save_mapped_as_cram) { - withName: '.*ALIGN:SAMTOOLS_VIEW' { - ext.args = { '--output-fmt cram --write-index' } - ext.prefix = { "${meta.id}_sorted_md" } - publishDir = [ - path: { "${params.outdir}/alignment" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*ALIGN:SAMTOOLS_VIEW' { + ext.args = { '--output-fmt cram --write-index' } + ext.prefix = { "${meta.id}_sorted_md" } + publishDir = [ + path: { "${params.outdir}/alignment" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/align_MT.config b/conf/modules/align_MT.config index 5ffec1c0..a616272b 100644 --- a/conf/modules/align_MT.config +++ b/conf/modules/align_MT.config @@ -17,28 +17,28 @@ process { - if (params.aligner.equals("bwamem2")) { - withName: '.*ALIGN_MT:BWAMEM2_MEM_MT' { - ext.args = { "-M -K 100000000 -R ${meta.read_group}" } - ext.when = { !(params.analysis_type.equals("wes")) } - ext.prefix = { "${meta.id}_sorted" } - } + withName: '.*ALIGN_MT:BWAMEM2_MEM_MT' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } } - if (params.aligner.equals("bwa")) { - withName: '.*ALIGN_MT:BWA_MEM_MT' { - ext.args = { "-M -K 100000000 -R ${meta.read_group}" } - ext.when = { !(params.analysis_type.equals("wes")) } - ext.prefix = { "${meta.id}_sorted" } - } + withName: '.*ALIGN_MT:BWAMEME_MEM_MT' { + ext.args = { "-7 -M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } } - if (params.aligner.equals("sentieon")) { - withName: '.*ALIGN_MT:SENTIEON_BWAMEM_MT' { - ext.args = { "-M -K 10000000 -R ${meta.read_group}" } - ext.when = { !(params.analysis_type.equals("wes"))} - ext.prefix = { "${meta.id}_sorted" } - } + withName: '.*ALIGN_MT:BWA_MEM_MT' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } + } + + withName: '.*ALIGN_MT:SENTIEON_BWAMEM_MT' { + ext.args = { "-M -K 10000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } } withName: '.*ALIGN_MT:GATK4_MERGEBAMALIGNMENT_MT' { @@ -74,28 +74,28 @@ process { process { - if (params.aligner.equals("bwamem2")) { - withName: '.*ALIGN_MT_SHIFT:BWAMEM2_MEM_MT' { - ext.args = { "-M -K 100000000 -R ${meta.read_group}" } - ext.when = { !(params.analysis_type.equals("wes")) } - ext.prefix = { "${meta.id}_sorted_shifted" } - } + withName: '.*ALIGN_MT_SHIFT:BWAMEM2_MEM_MT' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted_shifted" } + } + + withName: '.*ALIGN_MT_SHIFT:BWAMEME_MEM_MT' { + ext.args = { "-7 -M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted_shifted" } } - if (params.aligner.equals("sentieon")) { - withName: '.*ALIGN_MT_SHIFT:SENTIEON_BWAMEM_MT' { - ext.args = { "-M -K 10000000 -R ${meta.read_group}" } - ext.when = { !(params.analysis_type.equals("wes"))} - ext.prefix = { "${meta.id}_sorted_shifted" } - } + withName: '.*ALIGN_MT_SHIFT:SENTIEON_BWAMEM_MT' { + ext.args = { "-M -K 10000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted_shifted" } } - if (params.aligner.equals("bwa")) { - withName: '.*ALIGN_MT_SHIFT:BWA_MEM_MT' { - ext.args = { "-M -K 100000000 -R ${meta.read_group}" } - ext.when = { !(params.analysis_type.equals("wes")) } - ext.prefix = { "${meta.id}_sorted_shifted" } - } + withName: '.*ALIGN_MT_SHIFT:BWA_MEM_MT' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted_shifted" } } withName: '.*ALIGN_MT_SHIFT:GATK4_MERGEBAMALIGNMENT_MT' { diff --git a/conf/modules/align_bwa_bwamem2.config b/conf/modules/align_bwa_bwamem2.config deleted file mode 100644 index e91360fc..00000000 --- a/conf/modules/align_bwa_bwamem2.config +++ /dev/null @@ -1,62 +0,0 @@ -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Config file for defining DSL2 per module options and publishing paths -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Available keys to override module options: - ext.args = Additional arguments appended to command in module. - ext.args2 = Second set of arguments appended to command in module (multi-tool modules). - ext.args3 = Third set of arguments appended to command in module (multi-tool modules). - ext.prefix = File name prefix for output files. - ext.when = Conditional clause ----------------------------------------------------------------------------------------- -*/ - -// -// Bwamem2 alignment options -// - -process { - - if (params.aligner.equals("bwamem2") || params.aligner.equals("bwa")) { - - withName: '.*ALIGN:ALIGN_BWA_BWAMEM2:BWAMEM2_MEM' { - ext.args = { "-M -K 100000000 -R ${meta.read_group}" } - ext.prefix = { "${meta.id}_sorted" } - ext.when = { params.aligner.equals("bwamem2") } - } - - withName: '.*ALIGN:ALIGN_BWA_BWAMEM2:BWA_MEM' { - ext.args = { "-M -K 100000000 -R ${meta.read_group}" } - ext.prefix = { "${meta.id}_sorted" } - ext.when = { params.aligner.equals("bwa") } - } - - withName: '.*ALIGN:ALIGN_BWA_BWAMEM2:SAMTOOLS_STATS' { - ext.args = '-s --remove-overlaps' - } - - withName: '.*ALIGN:ALIGN_BWA_BWAMEM2:SAMTOOLS_MERGE' { - ext.prefix = { "${meta.id}_sorted_merged" } - } - - withName: '.*ALIGN:ALIGN_BWA_BWAMEM2:MARKDUPLICATES' { - ext.args = "--TMP_DIR ." - ext.prefix = { "${meta.id}_sorted_md" } - publishDir = [ - enabled: !params.save_mapped_as_cram, - path: { "${params.outdir}/alignment" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*ALIGN:ALIGN_BWA_BWAMEM2:SAMTOOLS_INDEX_MARKDUP' { - publishDir = [ - enabled: !params.save_mapped_as_cram, - path: { "${params.outdir}/alignment" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } -} diff --git a/conf/modules/align_bwa_bwamem2_bwameme.config b/conf/modules/align_bwa_bwamem2_bwameme.config new file mode 100644 index 00000000..f9037d3d --- /dev/null +++ b/conf/modules/align_bwa_bwamem2_bwameme.config @@ -0,0 +1,72 @@ +/* +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Config file for defining DSL2 per module options and publishing paths +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Available keys to override module options: + ext.args = Additional arguments appended to command in module. + ext.args2 = Second set of arguments appended to command in module (multi-tool modules). + ext.args3 = Third set of arguments appended to command in module (multi-tool modules). + ext.prefix = File name prefix for output files. + ext.when = Conditional clause +---------------------------------------------------------------------------------------- +*/ + +// +// Bwamem2 alignment options +// + +process { + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:BWAMEM2_MEM' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:BWAMEM_FALLBACK' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:BWAMEME_MEM' { + ext.args = { "-7 -M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } + ext.when = { params.aligner.equals("bwameme") } + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:BWA' { + ext.args = { "-M -K 100000000 -R ${meta.read_group}" } + ext.args2 = { "-T ./samtools_sort_tmp" } + ext.prefix = { "${meta.id}_sorted" } + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:SAMTOOLS_STATS' { + ext.args = '-s --remove-overlaps' + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:SAMTOOLS_MERGE' { + ext.prefix = { "${meta.id}_sorted_merged" } + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:MARKDUPLICATES' { + ext.args = "--TMP_DIR ." + ext.prefix = { "${meta.id}_sorted_md" } + publishDir = [ + enabled: !params.save_mapped_as_cram, + path: { "${params.outdir}/alignment" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*ALIGN:ALIGN_BWA_BWAMEM2_BWAMEME:SAMTOOLS_INDEX_MARKDUP' { + publishDir = [ + enabled: !params.save_mapped_as_cram, + path: { "${params.outdir}/alignment" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } +} diff --git a/conf/modules/align_sentieon.config b/conf/modules/align_sentieon.config index d5156e58..56b75c26 100644 --- a/conf/modules/align_sentieon.config +++ b/conf/modules/align_sentieon.config @@ -17,30 +17,28 @@ process { - if (params.aligner.equals("sentieon")) { - withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_BWAMEM' { - ext.args = { "-M -K 10000000 -R ${meta.read_group} " } - ext.prefix = { "${meta.id}.sorted" } - } + withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_BWAMEM' { + ext.args = { "-M -K 10000000 -R ${meta.read_group} " } + ext.prefix = { "${meta.id}_sorted" } + } - withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_DATAMETRICS' { - ext.prefix = { "${meta.id}_datametrics" } - } + withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_DATAMETRICS' { + ext.prefix = { "${meta.id}_datametrics" } + } - withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_READWRITER' { - ext.prefix = { "${meta.id}_merged" } - } + withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_READWRITER' { + ext.prefix = { "${meta.id}_merged" } + } - withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_DEDUP' { - ext.args = { $params.rmdup ? "--rmdup" : '' } - ext.prefix = { "${meta.id}_dedup" } - ext.suffix = ".bam" - publishDir = [ - enabled: !params.save_mapped_as_cram, - path: { "${params.outdir}/alignment" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*ALIGN:ALIGN_SENTIEON:SENTIEON_DEDUP' { + ext.args = { $params.rmdup ? "--rmdup" : '' } + ext.prefix = { "${meta.id}_dedup" } + ext.suffix = ".bam" + publishDir = [ + enabled: !params.save_mapped_as_cram, + path: { "${params.outdir}/alignment" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/annotate_cadd.config b/conf/modules/annotate_cadd.config index 4ac5b618..404e71e5 100644 --- a/conf/modules/annotate_cadd.config +++ b/conf/modules/annotate_cadd.config @@ -21,7 +21,7 @@ process { } withName: '.*:ANNOTATE_CADD:BCFTOOLS_VIEW' { - ext.args = { "--output-type z --types indels" } + ext.args = { "--output-type z --types indels,other" } ext.prefix = { "${vcf.simpleName}_indels" } } diff --git a/conf/modules/annotate_consequence_pli.config b/conf/modules/annotate_consequence_pli.config index e9451357..21e2e835 100644 --- a/conf/modules/annotate_consequence_pli.config +++ b/conf/modules/annotate_consequence_pli.config @@ -13,69 +13,66 @@ process { - if (!params.skip_sv_annotation) { - withName: '.*ANN_CSQ_PLI_SV:.*' { - publishDir = [ - enabled: false - ] - } - - withName: '.*ANN_CSQ_PLI_SV:ADD_MOST_SEVERE_CSQ' { - ext.prefix = { "${meta.id}_sv_csq_${meta.set}" } - } - - withName: '.*ANN_CSQ_PLI_SV:ADD_MOST_SEVERE_PLI' { - ext.prefix = { "${meta.id}_sv_csq_pli_${meta.set}" } - } - - withName: '.*ANN_CSQ_PLI_SV:TABIX_BGZIPTABIX' { - ext.prefix = { "${meta.id}_sv_csq_pli_${meta.set}" } - } + + withName: '.*ANN_CSQ_PLI_SV:ADD_MOST_SEVERE_CSQ' { + ext.prefix = { "${meta.id}_sv_csq_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_SV:ADD_MOST_SEVERE_PLI' { + ext.prefix = { "${meta.id}_sv_csq_pli_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_SV:TABIX_BGZIPTABIX' { + ext.prefix = { "${meta.id}_sv_csq_pli_${meta.set}" } + } +} + +process { + + withName: '.*ANN_CSQ_PLI_SNV:ADD_MOST_SEVERE_CSQ' { + ext.prefix = { "${meta.id}_snv_csq_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_SNV:ADD_MOST_SEVERE_PLI' { + ext.prefix = { "${meta.id}_snv_csq_pli_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_SNV:TABIX_BGZIPTABIX' { + ext.prefix = { "${meta.id}_snv_csq_pli_${meta.set}" } } } process { - if (!params.skip_snv_annotation) { - withName: '.*ANN_CSQ_PLI_SNV:.*' { - ext.when = !params.skip_snv_annotation - publishDir = [ - enabled: false - ] - } - - withName: '.*ANN_CSQ_PLI_SNV:ADD_MOST_SEVERE_CSQ' { - ext.prefix = { "${meta.id}_snv_csq_${meta.set}" } - } - - withName: '.*ANN_CSQ_PLI_SNV:ADD_MOST_SEVERE_PLI' { - ext.prefix = { "${meta.id}_snv_csq_pli_${meta.set}" } - } - - withName: '.*ANN_CSQ_PLI_SNV:TABIX_BGZIPTABIX' { - ext.prefix = { "${meta.id}_snv_csq_pli_${meta.set}" } - } + + withName: '.*ANN_CSQ_PLI_MT:ADD_MOST_SEVERE_CSQ' { + ext.prefix = { "${meta.id}_mt_csq_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_MT:ADD_MOST_SEVERE_PLI' { + ext.prefix = { "${meta.id}_mt_csq_pli_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_MT:TABIX_BGZIPTABIX' { + ext.prefix = { "${meta.id}_mt_csq_pli_${meta.set}" } } } process { - if (!params.skip_mt_annotation) { - withName: '.*ANN_CSQ_PLI_MT:.*' { - ext.when = !params.skip_mt_annotation - publishDir = [ - enabled: false - ] - } - - withName: '.*ANN_CSQ_PLI_MT:ADD_MOST_SEVERE_CSQ' { - ext.prefix = { "${meta.id}_mt_csq_${meta.set}" } - } - - withName: '.*ANN_CSQ_PLI_MT:ADD_MOST_SEVERE_PLI' { - ext.prefix = { "${meta.id}_mt_csq_pli_${meta.set}" } - } - - withName: '.*ANN_CSQ_PLI_MT:TABIX_BGZIPTABIX' { - ext.prefix = { "${meta.id}_mt_csq_pli_${meta.set}" } - } + + withName: '.*ANN_CSQ_PLI_ME:ADD_MOST_SEVERE_CSQ' { + ext.prefix = { "${meta.id}_me_csq_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_ME:ADD_MOST_SEVERE_PLI' { + ext.prefix = { "${meta.id}_me_pli_${meta.set}" } + } + + withName: '.*ANN_CSQ_PLI_ME:TABIX_BGZIPTABIX' { + ext.prefix = { "${meta.id}_me_annotated_${meta.set}" } + publishDir = [ + path: { "${params.outdir}/annotate_mobile_elements" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/annotate_genome_snvs.config b/conf/modules/annotate_genome_snvs.config index 768aeee3..60bcd259 100644 --- a/conf/modules/annotate_genome_snvs.config +++ b/conf/modules/annotate_genome_snvs.config @@ -17,104 +17,102 @@ process { - if (!params.skip_snv_annotation) { - withName: '.*ANNOTATE_GENOME_SNVS:BCFTOOLS_ROH' { - ext.args = { "--samples ${meta.probands.unique().first()} --skip-indels " } - ext.prefix = { "${meta.id}_roh" } - } - - withName: '.*ANNOTATE_GENOME_SNVS:RHOCALL_ANNOTATE' { - ext.args = { "--v14 " } - } - - withName: '.*ANNOTATE_GENOME_SNVS:ZIP_TABIX_ROHCALL' { - ext.prefix = { "${input.simpleName}" } - } - - withName: '.*ANNOTATE_GENOME_SNVS:VCFANNO' { - ext.prefix = { "${vcf.simpleName}_vcfanno" } - } - - withName: '.*ANNOTATE_GENOME_SNVS:UPD_SITES' { - ext.prefix = { "${vcf.simpleName}_upd_sites" } - ext.args = {"--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} sites"} - } - - withName: '.*ANNOTATE_GENOME_SNVS:UPD_REGIONS' { - ext.prefix = { "${vcf.simpleName}_upd_regions" } - ext.args = {"--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} regions --min-size 5 --min-sites 1"} - ext.when = { !(workflow.profile.tokenize(',').intersect(['test', 'test_one_sample']).size() >= 1) || workflow.stubRun } - } - - withName: '.*ANNOTATE_GENOME_SNVS:CHROMOGRAPH_SITES' { - ext.prefix = { "${sites.simpleName}_chromograph" } - ext.args = { "--euploid" } - tag = {"${meta7.id}"} - publishDir = [ - path: { "${params.outdir}/annotate_snv/genome" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*ANNOTATE_GENOME_SNVS:CHROMOGRAPH_REGIONS' { - ext.prefix = { "${regions.simpleName}_chromograph" } - ext.args = { '--euploid' } - ext.when = { !(workflow.profile.tokenize(',').intersect(['test', 'test_one_sample', 'test_sentieon']).size() >= 1) || workflow.stubRun } - tag = {"${meta6.id}"} - publishDir = [ - path: { "${params.outdir}/annotate_snv/genome" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*ANNOTATE_GENOME_SNVS:ZIP_TABIX_VCFANNO' { - ext.prefix = { "${input.simpleName}" } - } - - withName: '.*ANNOTATE_GENOME_SNVS:BCFTOOLS_VIEW' { - ext.prefix = { "${vcf.simpleName}_filter" } - ext.args = { '--output-type z --exclude "INFO/GNOMADAF > 0.70 | INFO/GNOMADAF_popmax > 0.70" ' } - } - - withName: '.*ANNOTATE_GENOME_SNVS:GATK4_SELECTVARIANTS' { - ext.prefix = { "${vcf.simpleName}_${intervals.simpleName}" } - } - - withName: '.*ANNOTATE_GENOME_SNVS:ENSEMBLVEP_SNV' { - ext.prefix = { "${meta.prefix}_vep_${meta.scatterid}" } - ext.args = { [ - '--dir_plugins vep_cache/Plugins', - '--plugin LoFtool,LoFtool_scores.txt', - '--plugin pLI,pLI_values.txt', - '--plugin SpliceAI,snv=spliceai_21_scores_raw_snv_-v1.3-.vcf.gz,indel=spliceai_21_scores_raw_snv_-v1.3-.vcf.gz', - '--distance 5000', - '--buffer_size 20000', - '--format vcf --max_sv_size 248956422', - '--appris --biotype --cache --canonical --ccds --compress_output bgzip', - '--domains --exclude_predicted --force_overwrite', - '--hgvs --humdiv --no_progress --numbers', - '--merged --polyphen p --protein --offline --regulatory --sift p --symbol --tsl', - '--uniprot --vcf' - ].join(' ') } - } - - withName: '.*ANNOTATE_GENOME_SNVS:BCFTOOLS_CONCAT' { - ext.prefix = { "${meta.prefix}_vep" } - publishDir = [ - path: { "${params.outdir}/annotate_snv/genome" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*ANNOTATE_GENOME_SNVS:TABIX_BCFTOOLS_CONCAT' { - publishDir = [ - path: { "${params.outdir}/annotate_snv/genome" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*ANNOTATE_GENOME_SNVS:BCFTOOLS_ROH' { + ext.args = { "--samples ${meta.probands.unique().first()} --skip-indels " } + ext.prefix = { "${meta.id}_roh" } + } + + withName: '.*ANNOTATE_GENOME_SNVS:RHOCALL_ANNOTATE' { + ext.args = { "--v14 " } + } + + withName: '.*ANNOTATE_GENOME_SNVS:ZIP_TABIX_ROHCALL' { + ext.prefix = { "${input.simpleName}" } + } + + withName: '.*ANNOTATE_GENOME_SNVS:VCFANNO' { + ext.prefix = { "${vcf.simpleName}_vcfanno" } + } + + withName: '.*ANNOTATE_GENOME_SNVS:UPD_SITES' { + ext.prefix = { "${vcf.simpleName}_upd_sites" } + ext.args = {"--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} sites"} + } + + withName: '.*ANNOTATE_GENOME_SNVS:UPD_REGIONS' { + ext.prefix = { "${vcf.simpleName}_upd_regions" } + ext.args = {"--af-tag GNOMADAF --proband ${meta.upd_child} --mother ${meta.mother} --father ${meta.father} regions --min-size 5 --min-sites 1"} + ext.when = { !(workflow.profile.tokenize(',').intersect(['test', 'test_one_sample']).size() >= 1) || workflow.stubRun } + } + + withName: '.*ANNOTATE_GENOME_SNVS:CHROMOGRAPH_SITES' { + ext.prefix = { "${sites.simpleName}_chromograph" } + ext.args = { "--euploid" } + tag = {"${meta7.id}"} + publishDir = [ + path: { "${params.outdir}/annotate_snv/genome" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*ANNOTATE_GENOME_SNVS:CHROMOGRAPH_REGIONS' { + ext.prefix = { "${regions.simpleName}_chromograph" } + ext.args = { '--euploid' } + ext.when = { !(workflow.profile.tokenize(',').intersect(['test', 'test_one_sample', 'test_sentieon']).size() >= 1) || workflow.stubRun } + tag = {"${meta6.id}"} + publishDir = [ + path: { "${params.outdir}/annotate_snv/genome" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*ANNOTATE_GENOME_SNVS:ZIP_TABIX_VCFANNO' { + ext.prefix = { "${input.simpleName}" } + } + + withName: '.*ANNOTATE_GENOME_SNVS:BCFTOOLS_VIEW' { + ext.prefix = { "${vcf.simpleName}_filter" } + ext.args = { '--output-type z --exclude "INFO/GNOMADAF > 0.70 | INFO/GNOMADAF_popmax > 0.70" ' } + } + + withName: '.*ANNOTATE_GENOME_SNVS:GATK4_SELECTVARIANTS' { + ext.prefix = { "${vcf.simpleName}_${intervals.simpleName}" } + } + + withName: '.*ANNOTATE_GENOME_SNVS:ENSEMBLVEP_SNV' { + ext.prefix = { "${meta.prefix}_vep_${meta.scatterid}" } + ext.args = { [ + '--dir_plugins vep_cache/Plugins', + '--plugin LoFtool,LoFtool_scores.txt', + '--plugin pLI,pLI_values.txt', + '--plugin SpliceAI,snv=spliceai_21_scores_raw_snv_-v1.3-.vcf.gz,indel=spliceai_21_scores_raw_snv_-v1.3-.vcf.gz', + '--distance 5000', + '--buffer_size 20000', + '--format vcf --max_sv_size 248956422', + '--appris --biotype --cache --canonical --ccds --compress_output bgzip', + '--domains --exclude_predicted --force_overwrite', + '--hgvs --humdiv --no_progress --numbers', + '--merged --polyphen p --protein --offline --regulatory --sift p --symbol --tsl', + '--uniprot --vcf' + ].join(' ') } + } + + withName: '.*ANNOTATE_GENOME_SNVS:BCFTOOLS_CONCAT' { + ext.prefix = { "${meta.prefix}_vep" } + publishDir = [ + path: { "${params.outdir}/annotate_snv/genome" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*ANNOTATE_GENOME_SNVS:TABIX_BCFTOOLS_CONCAT' { + publishDir = [ + path: { "${params.outdir}/annotate_snv/genome" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/annotate_mobile_elements.config b/conf/modules/annotate_mobile_elements.config index bed2c0a7..7d001727 100644 --- a/conf/modules/annotate_mobile_elements.config +++ b/conf/modules/annotate_mobile_elements.config @@ -17,13 +17,6 @@ process { - withName: '.*ANNOTATE_MOBILE_ELEMENTS:.*' { - ext.when = !params.skip_me_annotation - publishDir = [ - enabled: false - ] - } - withName: '.*ANNOTATE_MOBILE_ELEMENTS:SVDB_QUERY_DB' { ext.args = { [ '--bnd_distance 150', @@ -58,31 +51,4 @@ process { ext.prefix = { "${meta.id}_filter" } } - withName: '.*:ANNOTATE_MOBILE_ELEMENTS:GENERATE_CLINICAL_SET_ME:ENSEMBLVEP_FILTERVEP' { - ext.when = !params.skip_vep_filter - ext.prefix = { "${meta.id}_me_${meta.set}" } - ext.args = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" } - } - - withName: '.*:ANNOTATE_MOBILE_ELEMENTS:GENERATE_CLINICAL_SET_ME:TABIX_BGZIP' { - ext.when = !params.skip_vep_filter - ext.prefix = { "${meta.id}_me_${meta.set}" } - } - - withName: '.*ANNOTATE_MOBILE_ELEMENTS:ANNOTATE_CSQ_PLI_ME:ADD_MOST_SEVERE_CSQ' { - ext.prefix = { "${meta.id}_me_csq_${meta.set}" } - } - - withName: '.*ANNOTATE_MOBILE_ELEMENTS:ANNOTATE_CSQ_PLI_ME:ADD_MOST_SEVERE_PLI' { - ext.prefix = { "${meta.id}_me_pli_${meta.set}" } - } - - withName: '.*ANNOTATE_MOBILE_ELEMENTS:ANNOTATE_CSQ_PLI_ME:TABIX_BGZIPTABIX' { - ext.prefix = { "${meta.id}_me_annotated_${meta.set}" } - publishDir = [ - path: { "${params.outdir}/annotate_mobile_elements" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } } diff --git a/conf/modules/annotate_mt_snvs.config b/conf/modules/annotate_mt_snvs.config index 3e25c36f..0d0026cf 100644 --- a/conf/modules/annotate_mt_snvs.config +++ b/conf/modules/annotate_mt_snvs.config @@ -16,6 +16,11 @@ // process { + withName: '.*ANNOTATE_MT_SNVS:HMTNOTE_ANNOTATE' { + ext.prefix = { "${meta.prefix}" } + ext.args = '--offline' + } + withName: '.*ANNOTATE_MT_SNVS:ENSEMBLVEP_MT' { ext.args = { [ '--dir_plugins vep_cache/Plugins', @@ -32,14 +37,6 @@ process { '--uniprot' ].join(' ') } ext.prefix = { "${meta.prefix}" } - } - - withName: '.*ANNOTATE_MT_SNVS:VCFANNO_MT' { - ext.prefix = { "${meta.prefix}" } - } - - withName: '.*ANNOTATE_MT_SNVS:ZIP_TABIX_HMTNOTE' { - ext.prefix = { "${meta.prefix}" } publishDir = [ path: { "${params.outdir}/annotate_snv/mitochondria" }, mode: params.publish_dir_mode, @@ -48,14 +45,23 @@ process { ] } - withName: '.*ANNOTATE_MT_SNVS:HMTNOTE_ANNOTATE' { - ext.prefix = { "${meta.prefix}_uncompressed" } - ext.args = '--offline' - publishDir = [ - enabled: false + withName: '.*ANNOTATE_MT_SNVS:TABIX_TABIX_VEP_MT' { + publishDir = [ + path: { "${params.outdir}/annotate_snv/mitochondria" }, + mode: params.publish_dir_mode, + pattern: "*{vcf.gz,vcf.gz.tbi}", + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } + withName: '.*ANNOTATE_MT_SNVS:VCFANNO_MT' { + ext.prefix = { "${meta.prefix}" } + } + + withName: '.*ANNOTATE_MT_SNVS:ZIP_TABIX_VCFANNO_MT' { + ext.prefix = { "${meta.prefix}" } + } + withName: '.*ANNOTATE_MT_SNVS:HAPLOGREP2_CLASSIFY_MT' { ext.prefix = { "${meta.prefix}_haplogrep" } publishDir = [ diff --git a/conf/modules/annotate_rhocallviz.config b/conf/modules/annotate_rhocallviz.config index bf33d35e..32822b9d 100644 --- a/conf/modules/annotate_rhocallviz.config +++ b/conf/modules/annotate_rhocallviz.config @@ -17,7 +17,7 @@ process { - withName: '.*ANNOTATE_GENOME_SNVS:ANNOTATE_RHOCALLVIZ:BCFTOOLS_VIEW' { + withName: '.*ANNOTATE_GENOME_SNVS:ANNOTATE_RHOCALLVIZ:BCFTOOLS_VIEW_RHOCALL' { ext.prefix = { "${meta.sample}" } ext.args = { "--output-type z --min-ac 1 --samples ${meta.sample}" } } diff --git a/conf/modules/annotate_structural_variants.config b/conf/modules/annotate_structural_variants.config index f8666a82..07725c24 100644 --- a/conf/modules/annotate_structural_variants.config +++ b/conf/modules/annotate_structural_variants.config @@ -17,58 +17,50 @@ process { - if (!params.skip_sv_annotation) { - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:.*' { - publishDir = [ - enabled: false - ] - } - - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:SVDB_QUERY_BEDPE' { - ext.when = {!params.svdb_query_bedpedbs.equals(null)} - ext.prefix = { "${meta.id}_bedpedb" } - } + withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:SVDB_QUERY_BEDPE' { + ext.when = {!params.svdb_query_bedpedbs.equals(null)} + ext.prefix = { "${meta.id}_bedpedb" } + } - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:SVDB_QUERY_DB' { - ext.when = {!params.svdb_query_dbs.equals(null)} - ext.prefix = { "${meta.id}_vcfdb" } - } + withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:SVDB_QUERY_DB' { + ext.when = {!params.svdb_query_dbs.equals(null)} + ext.prefix = { "${meta.id}_vcfdb" } + } - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:PICARD_SORTVCF' { - ext.prefix = { "${meta.id}_svdbquery" } - } + withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:PICARD_SORTVCF' { + ext.prefix = { "${meta.id}_svdbquery" } + } - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:BCFTOOLS_VIEW' { - ext.prefix = { "${meta.id}_view" } - } + withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:BCFTOOLS_VIEW' { + ext.prefix = { "${meta.id}_view" } + } - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:ENSEMBLVEP_SV' { - ext.args = { [ - '--dir_cache vep_cache', - '--dir_plugins vep_cache/Plugins', - '--plugin pLI,pLI_values.txt', - '--appris --biotype --buffer_size 100 --canonical --cache --ccds', - '--compress_output bgzip --distance 5000 --domains', - '--exclude_predicted --force_overwrite --format vcf', - '--fork 4 --hgvs --humdiv --max_sv_size 248956422 --merged', - '--no_progress --numbers --per_gene --polyphen p', - '--protein --offline --regulatory --sift p', - '--symbol --tsl --uniprot --vcf' - ].join(' ') } - ext.prefix = { "${meta.id}_svdbquery_vep" } - publishDir = [ - path: { "${params.outdir}/annotate_sv" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:ENSEMBLVEP_SV' { + ext.args = { [ + '--dir_cache vep_cache', + '--dir_plugins vep_cache/Plugins', + '--plugin pLI,pLI_values.txt', + '--appris --biotype --buffer_size 100 --canonical --cache --ccds', + '--compress_output bgzip --distance 5000 --domains', + '--exclude_predicted --force_overwrite --format vcf', + '--fork 4 --hgvs --humdiv --max_sv_size 248956422 --merged', + '--no_progress --numbers --per_gene --polyphen p', + '--protein --offline --regulatory --sift p', + '--symbol --tsl --uniprot --vcf' + ].join(' ') } + ext.prefix = { "${meta.id}_svdbquery_vep" } + publishDir = [ + path: { "${params.outdir}/annotate_sv" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } - withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:TABIX_VEP' { - publishDir = [ - path: { "${params.outdir}/annotate_sv" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*ANNOTATE_STRUCTURAL_VARIANTS:TABIX_VEP' { + publishDir = [ + path: { "${params.outdir}/annotate_sv" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/call_mobile_elements.config b/conf/modules/call_mobile_elements.config index 0a5e4faf..fd6bf61c 100644 --- a/conf/modules/call_mobile_elements.config +++ b/conf/modules/call_mobile_elements.config @@ -13,12 +13,6 @@ process { - withName: '.*CALL_MOBILE_ELEMENTS:.*' { - publishDir = [ - enabled: false - ] - } - withName: '.*CALL_MOBILE_ELEMENTS:ME_SPLIT_ALIGNMENT' { ext.args = { [ '--output-fmt bam', diff --git a/conf/modules/call_repeat_expansions.config b/conf/modules/call_repeat_expansions.config index 7fbcdc4c..a3c140a0 100644 --- a/conf/modules/call_repeat_expansions.config +++ b/conf/modules/call_repeat_expansions.config @@ -16,13 +16,6 @@ // process { - withName: '.*CALL_REPEAT_EXPANSIONS:.*' { - ext.when = { params.analysis_type != "wes" } - publishDir = [ - enabled: false - ] - } - withName: '.*CALL_REPEAT_EXPANSIONS:EXPANSIONHUNTER' { ext.args = { ("${meta.sex}" == '1') ? '--sex male' : '--sex female' } ext.prefix = { "${meta.id}_exphunter" } @@ -46,27 +39,13 @@ process { } withName: '.*CALL_REPEAT_EXPANSIONS:BCFTOOLS_REHEADER_EXP' { - ext.args = "--temp-prefix ." - ext.prefix = { "${meta.id}_reheader" } - } - - withName: '.*CALL_REPEAT_EXPANSIONS:RENAMESAMPLE_EXP' { + ext.args = "--temp-prefix ." + ext.args2 = "-O v" + ext.prefix = { "${meta.id}_repeat_expansion" } publishDir = [ path: { "${params.outdir}/repeat_expansions" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : - filename.contains('_renam.vcf.gz') ? "${meta.id}_repeat_expansion.vcf.gz" : - filename }, - ] - } - - withName: '.*CALL_REPEAT_EXPANSIONS:TABIX_EXP_RENAME' { - publishDir = [ - path: { "${params.outdir}/repeat_expansions" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : - filename.contains('_renam.vcf.gz.tbi') ? "${meta.id}_repeat_expansion.vcf.gz.tbi" : - filename }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, ] } diff --git a/conf/modules/call_snv.config b/conf/modules/call_snv.config index 1170d515..1546df4b 100644 --- a/conf/modules/call_snv.config +++ b/conf/modules/call_snv.config @@ -13,12 +13,6 @@ process { - withName: '.*CALL_SNV:.*' { - publishDir = [ - enabled: false - ] - } - withName: '.*CALL_SNV:GATK4_SELECTVARIANTS' { ext.args = { "--exclude-intervals ${params.mito_name}" } ext.prefix = { "${meta.id}_snv" } diff --git a/conf/modules/call_snv_sentieon.config b/conf/modules/call_snv_sentieon.config index 83cedb9f..869aabc3 100644 --- a/conf/modules/call_snv_sentieon.config +++ b/conf/modules/call_snv_sentieon.config @@ -17,45 +17,43 @@ process { - if(params.variant_caller.equals("sentieon")) { - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:SENTIEON_DNASCOPE' { - ext.prefix = { "${meta.id}_dnascope" } - ext.args2 = { - params.variant_type ? "--var_type ${params.variant_type}" : '' - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:SENTIEON_DNASCOPE' { + ext.prefix = { "${meta.id}_dnascope" } + ext.args2 = { + params.variant_type ? "--var_type ${params.variant_type}" : '' } + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:SENTIEON_DNAMODELAPPLY' { - ext.prefix = { "${meta.id}_dnamodelapply" } - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:SENTIEON_DNAMODELAPPLY' { + ext.prefix = { "${meta.id}_dnamodelapply" } + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:BCF_FILTER_ONE' { - ext.args = "-s 'ML_FAIL' -i 'INFO/ML_PROB <= 0.95' -m x -Oz" - ext.prefix = { "${meta.id}_mlfiltered_0.95" } - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:BCF_FILTER_ONE' { + ext.args = "-s 'ML_FAIL' -i 'INFO/ML_PROB <= 0.95' -m x -Oz" + ext.prefix = { "${meta.id}_mlfiltered_0.95" } + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:BCF_FILTER_TWO' { - ext.args = "-i FILTER='\"PASS\"' -m x -Oz" - ext.prefix = { "${meta.id}_passed" } - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:BCF_FILTER_TWO' { + ext.args = "-i FILTER='\"PASS\"' -m x -Oz" + ext.prefix = { "${meta.id}_passed" } + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:SPLIT_MULTIALLELICS_SEN' { - ext.args = '--output-type z --multiallelics -both' - ext.prefix = { "${meta.id}_split" } - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:SPLIT_MULTIALLELICS_SEN' { + ext.args = '--output-type z --multiallelics -both' + ext.prefix = { "${meta.id}_split" } + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:REMOVE_DUPLICATES_SEN' { - ext.args = '--output-type z --rm-dup none' - ext.prefix = { "${meta.id}_split_rmdup" } - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:REMOVE_DUPLICATES_SEN' { + ext.args = '--output-type z --rm-dup none' + ext.prefix = { "${meta.id}_split_rmdup" } + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:ADD_VARCALLER_TO_BED' { - ext.args2 = '-s 1 -b 2 -e 3' - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:ADD_VARCALLER_TO_BED' { + ext.args2 = '-s 1 -b 2 -e 3' + } - withName: '.*CALL_SNV:CALL_SNV_SENTIEON:BCFTOOLS_ANNOTATE' { - ext.args = "-c CHROM,FROM,TO,FOUND_IN --output-type z" - ext.prefix = { "${meta.id}_split_rmdup_info" } - } + withName: '.*CALL_SNV:CALL_SNV_SENTIEON:BCFTOOLS_ANNOTATE' { + ext.args = "-c CHROM,FROM,TO,FOUND_IN --output-type z" + ext.prefix = { "${meta.id}_split_rmdup_info" } } } diff --git a/conf/modules/call_structural_variants.config b/conf/modules/call_structural_variants.config index f8da7840..23e9325b 100644 --- a/conf/modules/call_structural_variants.config +++ b/conf/modules/call_structural_variants.config @@ -17,12 +17,6 @@ process { - withName: '.*CALL_STRUCTURAL_VARIANTS:.*' { - publishDir = [ - enabled: false - ] - } - withName: '.*CALL_STRUCTURAL_VARIANTS:SVDB_MERGE' { ext.prefix = {"${meta.id}_sv"} ext.args = '--pass_only --same_order' diff --git a/conf/modules/call_sv_MT.config b/conf/modules/call_sv_MT.config index 05f98e84..388fee33 100644 --- a/conf/modules/call_sv_MT.config +++ b/conf/modules/call_sv_MT.config @@ -27,15 +27,13 @@ process { ] } - if (!params.skip_eklipse){ - withName: '.*CALL_SV_MT:EKLIPSE' { - ext.args = "-tmp ." - publishDir = [ - path: { "${params.outdir}/call_sv/mitochondria" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*CALL_SV_MT:EKLIPSE' { + ext.args = "-tmp ." + publishDir = [ + path: { "${params.outdir}/call_sv/mitochondria" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/call_sv_germlinecnvcaller.config b/conf/modules/call_sv_germlinecnvcaller.config index 5f85c0f9..a63da3d3 100644 --- a/conf/modules/call_sv_germlinecnvcaller.config +++ b/conf/modules/call_sv_germlinecnvcaller.config @@ -17,30 +17,21 @@ process { - if (!params.skip_germlinecnvcaller) { - withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER.*" { - publishDir = [ - enabled: false - ] - ext.when = !params.skip_germlinecnvcaller - } - - withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:GATK4_COLLECTREADCOUNTS" { - ext.args = "--format TSV --interval-merging-rule OVERLAPPING_ONLY" - } + withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:GATK4_COLLECTREADCOUNTS" { + ext.args = "--format TSV --interval-merging-rule OVERLAPPING_ONLY" + } - withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:GATK4_DETERMINEGERMLINECONTIGPLOIDY" { - ext.prefix = { "${meta.id}_ploidy" } - } + withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:GATK4_DETERMINEGERMLINECONTIGPLOIDY" { + ext.prefix = { "${meta.id}_ploidy" } + } - withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:GATK4_GERMLINECNVCALLER" { - ext.args = "--run-mode CASE" - ext.prefix = { "${meta.id}_${model.simpleName}" } - } + withName: ".*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:GATK4_GERMLINECNVCALLER" { + ext.args = "--run-mode CASE" + ext.prefix = { "${meta.id}_${model.simpleName}" } + } - withName: '.*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:BCFTOOLS_VIEW' { - ext.prefix = { "${meta.id}_gatkcnv_segments_refiltered" } - ext.args = { '--output-type z --exclude "N_ALT = 0" ' } - } + withName: '.*CALL_STRUCTURAL_VARIANTS:CALL_SV_GERMLINECNVCALLER:BCFTOOLS_VIEW' { + ext.prefix = { "${meta.id}_gatkcnv_segments_refiltered" } + ext.args = { '--output-type z --exclude "N_ALT = 0" ' } } } diff --git a/conf/modules/generate_clinical_set.config b/conf/modules/generate_clinical_set.config index 4ab31579..de4d1b27 100644 --- a/conf/modules/generate_clinical_set.config +++ b/conf/modules/generate_clinical_set.config @@ -21,7 +21,7 @@ process { withName: '.*:GENERATE_CLINICAL_SET_SNV:ENSEMBLVEP_FILTERVEP' { ext.when = !params.skip_vep_filter ext.prefix = { "${meta.id}_snv_${meta.set}" } - ext.args = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" } + ext.args = { "--filter \"HGNC_ID in ${feature_file}\"" } } withName: '.*:GENERATE_CLINICAL_SET_SNV:TABIX_BGZIP' { @@ -36,7 +36,7 @@ process { withName: '.*:GENERATE_CLINICAL_SET_SV:ENSEMBLVEP_FILTERVEP' { ext.when = !params.skip_vep_filter ext.prefix = { "${input.simpleName}_sv_${meta.set}" } - ext.args = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" } + ext.args = { "--filter \"HGNC_ID in ${feature_file}\"" } } withName: '.*:GENERATE_CLINICAL_SET_SV:TABIX_BGZIP' { @@ -51,7 +51,7 @@ process { withName: '.*:GENERATE_CLINICAL_SET_MT:ENSEMBLVEP_FILTERVEP' { ext.when = !params.skip_vep_filter ext.prefix = { "${meta.id}_mt_${meta.set}" } - ext.args = { "--filter \"HGNC_ID in ${meta.hgnc_ids.join(',')}\"" } + ext.args = { "--filter \"HGNC_ID in ${feature_file}\"" } } withName: '.*:GENERATE_CLINICAL_SET_MT:TABIX_BGZIP' { @@ -59,3 +59,17 @@ process { ext.prefix = { "${meta.id}_mt_${meta.set}" } } } + +// ME variants +process{ + withName: '.*:GENERATE_CLINICAL_SET_ME:ENSEMBLVEP_FILTERVEP' { + ext.when = !params.skip_vep_filter + ext.prefix = { "${meta.id}_me_${meta.set}" } + ext.args = { "--filter \"HGNC_ID in ${feature_file}\"" } + } + + withName: '.*:GENERATE_CLINICAL_SET_ME:TABIX_BGZIP' { + ext.when = !params.skip_vep_filter + ext.prefix = { "${meta.id}_me_${meta.set}" } + } +} diff --git a/conf/modules/generate_cytosure_files.config b/conf/modules/generate_cytosure_files.config index 1cd076f3..6aab516d 100644 --- a/conf/modules/generate_cytosure_files.config +++ b/conf/modules/generate_cytosure_files.config @@ -17,41 +17,38 @@ process { - if ( params.analysis_type != "wes" && !params.skip_vcf2cytosure ) { - - withName: '.*GENERATE_CYTOSURE_FILES:TIDDIT_COV_VCF2CYTOSURE' { - ext.args = { '-z 500' } - ext.prefix = { "${meta.id}_cov" } - } + withName: '.*GENERATE_CYTOSURE_FILES:TIDDIT_COV_VCF2CYTOSURE' { + ext.args = { '-z 500' } + ext.prefix = { "${meta.id}_cov" } + } - withName: '.*GENERATE_CYTOSURE_FILES:SPLIT_AND_FILTER_SV_VCF' { - ext.args = { [ - "--samples ${meta.id}", - '--output-type z', - "--exclude 'gnomad_svAF > 0.05'" - ].join(' ') } - ext.prefix = { "${meta.id}" } - } + withName: '.*GENERATE_CYTOSURE_FILES:SPLIT_AND_FILTER_SV_VCF' { + ext.args = { [ + "--samples ${meta.id}", + '--output-type z', + "--exclude 'gnomad_svAF > 0.05'" + ].join(' ') } + ext.prefix = { "${meta.id}" } + } - withName: '.*GENERATE_CYTOSURE_FILES:BCFTOOLS_REHEADER_SV_VCF' { - beforeScript = { "echo ${meta.custid} > ${meta.custid}.txt" } - ext.args = { "--samples ${meta.custid}.txt" } - ext.args2 = "--output-type v" - ext.prefix = { "${meta.custid}" } - } + withName: '.*GENERATE_CYTOSURE_FILES:BCFTOOLS_REHEADER_SV_VCF' { + beforeScript = { "echo ${meta.custid} > ${meta.custid}.txt" } + ext.args = { "--samples ${meta.custid}.txt" } + ext.args2 = "--output-type v" + ext.prefix = { "${meta.custid}" } + } - withName: '.*GENERATE_CYTOSURE_FILES:VCF2CYTOSURE' { - ext.args = { [ - meta.sex.equals(1) ? '--sex male' : '--sex female', - '--size 5000', - '--maxbnd 5000' - ].join(' ') } - ext.prefix = { "${meta.custid}" ? "${meta.custid}" : "${meta.id}" } - publishDir = [ - path: { "${params.outdir}/vcf2cytosure" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - ] - } + withName: '.*GENERATE_CYTOSURE_FILES:VCF2CYTOSURE' { + ext.args = { [ + meta.sex.equals('1') ? '--sex male' : '--sex female', + '--size 5000', + '--maxbnd 5000' + ].join(' ') } + ext.prefix = { "${meta.custid}" ? "${meta.custid}" : "${meta.id}" } + publishDir = [ + path: { "${params.outdir}/vcf2cytosure" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, + ] } } diff --git a/conf/modules/gens.config b/conf/modules/gens.config index 6882775c..691cacd7 100644 --- a/conf/modules/gens.config +++ b/conf/modules/gens.config @@ -16,27 +16,20 @@ // process { - if (!params.skip_gens && params.analysis_type != "wes") { - withName: '.*GENS:.*' { - publishDir = [ - enabled: false - ] - } - withName: '.*GENS:COLLECTREADCOUNTS' { - ext.args = { [ - '--interval-merging-rule OVERLAPPING_ONLY', - '--format HDF5' - ].join(' ') } - } + withName: '.*GENS:COLLECTREADCOUNTS' { + ext.args = { [ + '--interval-merging-rule OVERLAPPING_ONLY', + '--format HDF5' + ].join(' ') } + } - withName: '.*GENS:GENS_GENERATE' { - ext.prefix = { "${meta.id}_gens" } - publishDir = [ - path: { "${params.outdir}/gens" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: '.*GENS:GENS_GENERATE' { + ext.prefix = { "${meta.id}_gens" } + publishDir = [ + path: { "${params.outdir}/gens" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/prepare_references.config b/conf/modules/prepare_references.config index 3721d220..9ec4d47b 100644 --- a/conf/modules/prepare_references.config +++ b/conf/modules/prepare_references.config @@ -29,8 +29,18 @@ process { ext.when = {!params.bwamem2 && params.aligner == "bwamem2"} } + withName: '.*PREPARE_REFERENCES:BWAMEME_INDEX_GENOME' { + ext.args = '-a meme' + ext.when = {!params.bwameme && params.aligner == "bwameme"} + } + withName: '.*PREPARE_REFERENCES:BWAMEM2_INDEX_MT_SHIFT' { - ext.when = { !(params.analysis_type == "wes") && params.aligner == "bwamem2"} + ext.when = { (params.analysis_type.equals("wgs") || params.run_mt_for_wes) && params.aligner == "bwamem2"} + } + + withName: '.*PREPARE_REFERENCES:BWAMEME_INDEX_MT_SHIFT' { + ext.args = '-a meme' + ext.when = { !(params.analysis_type == "wes") && params.aligner == "bwameme"} } withName: '.*PREPARE_REFERENCES:SENTIEON_BWAINDEX_GENOME' { @@ -38,11 +48,11 @@ process { } withName: '.*PREPARE_REFERENCES:SENTIEON_BWAINDEX_MT_SHIFT' { - ext.when = { !(params.analysis_type == "wes") && params.aligner == "sentieon"} + ext.when = { (params.analysis_type.equals("wgs") || params.run_mt_for_wes) && params.aligner == "sentieon"} } withName: '.*PREPARE_REFERENCES:BWA_INDEX_MT_SHIFT' { - ext.when = { !(params.analysis_type == "wes") && params.aligner == "bwa"} + ext.when = { (params.analysis_type.equals("wgs") || params.run_mt_for_wes) && params.aligner == "bwa"} } withName: '.*PREPARE_REFERENCES:BWA_INDEX_GENOME' { @@ -63,7 +73,7 @@ process { } withName: '.*PREPARE_REFERENCES:SAMTOOLS_FAIDX_MT_SHIFT' { - ext.when = { !(params.analysis_type == "wes")} + ext.when = { (params.analysis_type.equals("wgs") || params.run_mt_for_wes) } } withName: '.*PREPARE_REFERENCES:GATK_SD' { @@ -75,13 +85,7 @@ process { } withName: '.*PREPARE_REFERENCES:GATK_SD_MT_SHIFT' { - ext.when = { !(params.analysis_type == "wes")} - } - - withName: '.*PREPARE_REFERENCES:GET_CHROM_SIZES' { - publishDir = [ - enabled: false, - ] + ext.when = { (params.analysis_type.equals("wgs") || params.run_mt_for_wes)} } withName: '.*PREPARE_REFERENCES:TABIX_DBSNP' { @@ -109,9 +113,6 @@ process { withName: '.*PREPARE_REFERENCES:GATK_ILT' { ext.when = { !params.target_bed.equals(null) } ext.args = { "--PADDING ${params.bait_padding} -SUBDIVISION_MODE INTERVAL_SUBDIVISION --SCATTER_COUNT 2" } - publishDir = [ - enabled: false - ] } withName: '.*PREPARE_REFERENCES:CAT_CAT_BAIT' { @@ -121,13 +122,15 @@ process { withName: '.*PREPARE_REFERENCES:UNTAR_VEP_CACHE' { ext.when = { (params.vep_cache && params.vep_cache.endsWith("tar.gz")) } - publishDir = [ - enabled: false - ] } withName: '.*PREPARE_REFERENCES:GATK_PREPROCESS_WGS' { - ext.args = { "--padding 0 --interval-merging-rule OVERLAPPING_ONLY --exclude-intervals ${params.mito_name}" } + ext.args = { [ + '--padding 0', + '--interval-merging-rule OVERLAPPING_ONLY', + "--exclude-intervals ${params.mito_name}", + "--tmp-dir ./" + ].join(' ') } ext.when = { params.analysis_type.equals("wgs") && !params.readcount_intervals } } diff --git a/conf/modules/qc_bam.config b/conf/modules/qc_bam.config index d57670c7..29cd3900 100644 --- a/conf/modules/qc_bam.config +++ b/conf/modules/qc_bam.config @@ -72,25 +72,25 @@ process { ] } - withName: '.*QC_BAM:PICARD_COLLECTWGSMETRICS' { + withName: '.*QC_BAM:PICARD_COLLECTWGSMETRICS_WG' { ext.args = "--TMP_DIR ." - ext.when = { params.analysis_type.equals("wgs") && !params.aligner.equals("sentieon") } + ext.when = { !params.aligner.equals("sentieon") } ext.prefix = { "${meta.id}_wgsmetrics" } } withName: '.*QC_BAM:PICARD_COLLECTWGSMETRICS_Y' { ext.args = "--TMP_DIR ." - ext.when = { params.analysis_type.equals("wgs") && !params.aligner.equals("sentieon") } + ext.when = { !params.aligner.equals("sentieon") } ext.prefix = { "${meta.id}_wgsmetrics_y" } } - withName: '.*QC_BAM:SENTIEON_WGSMETRICS' { - ext.when = { params.analysis_type.equals("wgs") && params.aligner.equals("sentieon") } + withName: '.*QC_BAM:SENTIEON_WGSMETRICS_WG' { + ext.when = { params.aligner.equals("sentieon") } ext.prefix = { "${meta.id}_wgsmetrics" } } withName: '.*QC_BAM:SENTIEON_WGSMETRICS_Y' { - ext.when = { params.analysis_type.equals("wgs") && params.aligner.equals("sentieon") } + ext.when = { params.aligner.equals("sentieon") } ext.prefix = { "${meta.id}_wgsmetrics_y" } } } diff --git a/conf/modules/rank_variants.config b/conf/modules/rank_variants.config index a17dee05..cd5ab7c9 100644 --- a/conf/modules/rank_variants.config +++ b/conf/modules/rank_variants.config @@ -16,56 +16,51 @@ // process { - if (!params.skip_sv_annotation) { - withName: '.*RANK_VARIANTS_SV:.*' { - publishDir = [ - enabled: false - ] - } - - withName: '.*RANK_VARIANTS_SV:GENMOD_ANNOTATE' { - ext.prefix = { "${meta.id}_sv_genmod_annotate_${meta.set}" } - ext.args = { [ - '--annotate_regions', - params.genome.equals('GRCh37') ? '--genome-build 37' : '--genome-build 38' - ].join(' ') } - } - - withName: '.*RANK_VARIANTS_SV:GENMOD_MODELS' { - ext.prefix = { "${meta.id}_sv_genmod_models_${meta.set}" } - ext.args = " --whole_gene " - } - - withName: '.*RANK_VARIANTS_SV:GENMOD_SCORE' { - ext.prefix = { "${meta.id}_sv_genmod_score_${meta.set}" } - ext.args = " --rank_results " - } - - withName: '.*RANK_VARIANTS_SV:GENMOD_COMPOUND' { - ext.prefix = { "${meta.id}_sv_genmod_compound_${meta.set}" } - } - - withName: '.*RANK_VARIANTS_SV:BCFTOOLS_SORT' { - ext.args = "--output-type z" - ext.prefix = { "${meta.id}_sv_ranked_${meta.set}" } - publishDir = [ - path: { "${params.outdir}/rank_and_filter" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*RANK_VARIANTS_SV:TABIX_BGZIP' { - ext.when = false - } - - withName: '.*RANK_VARIANTS_SV:TABIX_TABIX' { - publishDir = [ - path: { "${params.outdir}/rank_and_filter" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + + withName: '.*RANK_VARIANTS_SV:GENMOD_ANNOTATE' { + ext.prefix = { "${meta.id}_sv_genmod_annotate_${meta.set}" } + ext.args = { [ + '--annotate_regions', + params.genome.equals('GRCh37') ? '--genome-build 37' : '--genome-build 38', + '--temp_dir ./' + ].join(' ') } + } + + withName: '.*RANK_VARIANTS_SV:GENMOD_MODELS' { + ext.prefix = { "${meta.id}_sv_genmod_models_${meta.set}" } + ext.args = "--whole_gene --temp_dir ./" + } + + withName: '.*RANK_VARIANTS_SV:GENMOD_SCORE' { + ext.prefix = { "${meta.id}_sv_genmod_score_${meta.set}" } + ext.args = "--rank_results" + } + + withName: '.*RANK_VARIANTS_SV:GENMOD_COMPOUND' { + ext.prefix = { "${meta.id}_sv_genmod_compound_${meta.set}" } + ext.args = "--temp_dir ./" + } + + withName: '.*RANK_VARIANTS_SV:BCFTOOLS_SORT' { + ext.args = "--output-type z" + ext.prefix = { "${meta.id}_sv_ranked_${meta.set}" } + publishDir = [ + path: { "${params.outdir}/rank_and_filter" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*RANK_VARIANTS_SV:TABIX_BGZIP' { + ext.when = false + } + + withName: '.*RANK_VARIANTS_SV:TABIX_TABIX' { + publishDir = [ + path: { "${params.outdir}/rank_and_filter" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } @@ -74,56 +69,50 @@ process { // process { - if (!params.skip_snv_annotation) { - withName: '.*RANK_VARIANTS_SNV:.*' { - ext.when = !params.skip_snv_annotation - publishDir = [ - enabled: false - ] - } - - withName: '.*RANK_VARIANTS_SNV:GENMOD_ANNOTATE' { - ext.prefix = { "${meta.id}_snv_genmod_annotate_${meta.set}" } - ext.args = { [ - '--annotate_regions', - params.genome.equals('GRCh37') ? '--genome-build 37' : '--genome-build 38' - ].join(' ') } - } - - withName: '.*RANK_VARIANTS_SNV:GENMOD_MODELS' { - ext.prefix = { "${meta.id}_snv_genmod_models_${meta.set}" } - ext.args = " --whole_gene " - } - - withName: '.*RANK_VARIANTS_SNV:GENMOD_SCORE' { - ext.prefix = { "${meta.id}_snv_genmod_score_${meta.set}" } - ext.args = " --rank_results " - } - - withName: '.*RANK_VARIANTS_SNV:GENMOD_COMPOUND' { - ext.prefix = { "${meta.id}_snv_genmod_compound_${meta.set}" } - } - - withName: '.*RANK_VARIANTS_SNV:BCFTOOLS_SORT' { - ext.when = false - } - - withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIP' { - ext.prefix = { "${meta.id}_snv_ranked_${meta.set}" } - publishDir = [ - path: { "${params.outdir}/rank_and_filter" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*RANK_VARIANTS_SNV:TABIX_TABIX' { - publishDir = [ - path: { "${params.outdir}/rank_and_filter" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + + withName: '.*RANK_VARIANTS_SNV:GENMOD_ANNOTATE' { + ext.prefix = { "${meta.id}_snv_genmod_annotate_${meta.set}" } + ext.args = { [ + '--annotate_regions', + params.genome.equals('GRCh37') ? '--genome-build 37' : '--genome-build 38', + '--temp_dir ./' + ].join(' ') } + } + + withName: '.*RANK_VARIANTS_SNV:GENMOD_MODELS' { + ext.prefix = { "${meta.id}_snv_genmod_models_${meta.set}" } + ext.args = "--whole_gene --temp_dir ./" + } + + withName: '.*RANK_VARIANTS_SNV:GENMOD_SCORE' { + ext.prefix = { "${meta.id}_snv_genmod_score_${meta.set}" } + ext.args = "--rank_results" + } + + withName: '.*RANK_VARIANTS_SNV:GENMOD_COMPOUND' { + ext.prefix = { "${meta.id}_snv_genmod_compound_${meta.set}" } + ext.args = "--temp_dir ./" + } + + withName: '.*RANK_VARIANTS_SNV:BCFTOOLS_SORT' { + ext.when = false + } + + withName: '.*RANK_VARIANTS_SNV:TABIX_BGZIP' { + ext.prefix = { "${meta.id}_snv_ranked_${meta.set}" } + publishDir = [ + path: { "${params.outdir}/rank_and_filter" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*RANK_VARIANTS_SNV:TABIX_TABIX' { + publishDir = [ + path: { "${params.outdir}/rank_and_filter" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } @@ -132,55 +121,49 @@ process { // process { - if (!params.skip_mt_annotation) { - withName: '.*RANK_VARIANTS_MT:.*' { - ext.when = !params.skip_mt_annotation - publishDir = [ - enabled: false - ] - } - - withName: '.*RANK_VARIANTS_MT:GENMOD_ANNOTATE' { - ext.prefix = { "${meta.id}_mt_genmod_annotate_${meta.set}" } - ext.args = { [ - '--annotate_regions', - params.genome.equals('GRCh37') ? '--genome-build 37' : '--genome-build 38' - ].join(' ') } - } - - withName: '.*RANK_VARIANTS_MT:GENMOD_MODELS' { - ext.prefix = { "${meta.id}_mt_genmod_models_${meta.set}" } - ext.args = " --whole_gene " - } - - withName: '.*RANK_VARIANTS_MT:GENMOD_SCORE' { - ext.prefix = { "${meta.id}_mt_genmod_score_${meta.set}" } - ext.args = " --rank_results " - } - - withName: '.*RANK_VARIANTS_MT:GENMOD_COMPOUND' { - ext.prefix = { "${meta.id}_mt_genmod_compound_${meta.set}" } - } - - withName: '.*RANK_VARIANTS_MT:BCFTOOLS_SORT' { - ext.when = false - } - - withName: '.*RANK_VARIANTS_MT:TABIX_BGZIP' { - ext.prefix = { "${meta.id}_mt_ranked_${meta.set}" } - publishDir = [ - path: { "${params.outdir}/rank_and_filter" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*RANK_VARIANTS_MT:TABIX_TABIX' { - publishDir = [ - path: { "${params.outdir}/rank_and_filter" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + + withName: '.*RANK_VARIANTS_MT:GENMOD_ANNOTATE' { + ext.prefix = { "${meta.id}_mt_genmod_annotate_${meta.set}" } + ext.args = { [ + '--annotate_regions', + params.genome.equals('GRCh37') ? '--genome-build 37' : '--genome-build 38', + '--temp_dir ./' + ].join(' ') } + } + + withName: '.*RANK_VARIANTS_MT:GENMOD_MODELS' { + ext.prefix = { "${meta.id}_mt_genmod_models_${meta.set}" } + ext.args = "--whole_gene --temp_dir ./" + } + + withName: '.*RANK_VARIANTS_MT:GENMOD_SCORE' { + ext.prefix = { "${meta.id}_mt_genmod_score_${meta.set}" } + ext.args = "--rank_results" + } + + withName: '.*RANK_VARIANTS_MT:GENMOD_COMPOUND' { + ext.prefix = { "${meta.id}_mt_genmod_compound_${meta.set}" } + ext.args = "--temp_dir ./" + } + + withName: '.*RANK_VARIANTS_MT:BCFTOOLS_SORT' { + ext.when = false + } + + withName: '.*RANK_VARIANTS_MT:TABIX_BGZIP' { + ext.prefix = { "${meta.id}_mt_ranked_${meta.set}" } + publishDir = [ + path: { "${params.outdir}/rank_and_filter" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*RANK_VARIANTS_MT:TABIX_TABIX' { + publishDir = [ + path: { "${params.outdir}/rank_and_filter" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } } diff --git a/conf/modules/raredisease.config b/conf/modules/raredisease.config index a16e6e0c..4499800d 100644 --- a/conf/modules/raredisease.config +++ b/conf/modules/raredisease.config @@ -12,37 +12,20 @@ */ // -// General configuration options +// Read QC options // process { - withName: 'CUSTOM_DUMPSOFTWAREVERSIONS' { + withName: '.*RAREDISEASE:FASTQC' { + ext.args = '--quiet --dir ./' publishDir = [ - path: { "${params.outdir}/pipeline_info" }, - mode: params.publish_dir_mode, - pattern: '*_versions.yml' + path: { "${params.outdir}/fastqc/${meta.id}" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, ] } } -// -// Read QC options -// - -process { - - if (!params.skip_fastqc) { - withName: '.*RAREDISEASE:FASTQC' { - ext.args = '--quiet' - publishDir = [ - path: { "${params.outdir}/fastqc/${meta.id}" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - ] - } - } -} - // // Smncopynumbercaller options // @@ -75,6 +58,20 @@ process { } } +// +// Generate Pedigree File +// + +process { + + withName: '.*RAREDISEASE:CREATE_PEDIGREE_FILE' { + publishDir = [ + path: { "${params.outdir}/pedigree" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, + ] + } +} + // // Multiqc options // diff --git a/conf/test.config b/conf/test.config index 5301f96b..85a2e404 100644 --- a/conf/test.config +++ b/conf/test.config @@ -34,33 +34,33 @@ params { skip_peddy = true // Input data - input = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/testdata/samplesheet_trio.csv' + input = params.pipelines_testdata_base_path + 'raredisease/testdata/samplesheet_trio.csv' // Genome references - fasta = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/reference.fasta" - fai = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/reference.fasta.fai" + fasta = params.pipelines_testdata_base_path + 'raredisease/reference/reference.fasta' + fai = params.pipelines_testdata_base_path + 'raredisease/reference/reference.fasta.fai' genome = 'GRCh37' - gnomad_af = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/gnomad_reformated.tab.gz" - intervals_wgs = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/target_wgs.interval_list" - intervals_y = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/targetY.interval_list" - known_dbsnp = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/dbsnp_-138-.vcf.gz" - ml_model = "https://s3.amazonaws.com/sentieon-release/other/SentieonDNAscopeModel1.0.model" - mobile_element_references = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/mobile_element_references.tsv" - mobile_element_svdb_annotations = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/svdb_querydb_files.csv" - reduced_penetrance = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/reduced_penetrance.tsv" - score_config_mt = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/rank_model_snv.ini" - score_config_snv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/rank_model_snv.ini" - score_config_sv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/rank_model_sv.ini" - svdb_query_dbs = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/svdb_querydb_files.csv" - target_bed = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/target.bed" - variant_catalog = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/variant_catalog.json" - vcfanno_lua = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vcfanno_functions.lua" - vcfanno_resources = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vcfanno_resources.txt" - vcfanno_toml = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vcfanno_config.toml" - variant_consequences_snv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/variant_consequences_v2.txt" - variant_consequences_sv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/variant_consequences_v2.txt" - vep_cache = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vep_cache_and_plugins.tar.gz" - vep_filters = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/hgnc.txt" + gnomad_af = params.pipelines_testdata_base_path + 'raredisease/reference/gnomad_reformated.tab.gz' + intervals_wgs = params.pipelines_testdata_base_path + 'raredisease/reference/target_wgs.interval_list' + intervals_y = params.pipelines_testdata_base_path + 'raredisease/reference/targetY.interval_list' + known_dbsnp = params.pipelines_testdata_base_path + 'raredisease/reference/dbsnp_-138-.vcf.gz' + ml_model = 'https://s3.amazonaws.com/sentieon-release/other/SentieonDNAscopeModel1.0.model' + mobile_element_references = params.pipelines_testdata_base_path + 'raredisease/reference/mobile_element_references.tsv' + mobile_element_svdb_annotations = params.pipelines_testdata_base_path + 'raredisease/reference/svdb_querydb_files.csv' + reduced_penetrance = params.pipelines_testdata_base_path + 'raredisease/reference/reduced_penetrance.tsv' + score_config_mt = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_snv.ini' + score_config_snv = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_snv.ini' + score_config_sv = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_sv.ini' + svdb_query_dbs = params.pipelines_testdata_base_path + 'raredisease/reference/svdb_querydb_files.csv' + target_bed = params.pipelines_testdata_base_path + 'raredisease/reference/target.bed' + variant_catalog = params.pipelines_testdata_base_path + 'raredisease/reference/variant_catalog.json' + vcfanno_lua = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_functions.lua' + vcfanno_resources = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_resources.txt' + vcfanno_toml = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_config.toml' + variant_consequences_snv = params.pipelines_testdata_base_path + 'raredisease/reference/variant_consequences_v2.txt' + variant_consequences_sv = params.pipelines_testdata_base_path + 'raredisease/reference/variant_consequences_v2.txt' + vep_cache = params.pipelines_testdata_base_path + 'raredisease/reference/vep_cache_and_plugins.tar.gz' + vep_filters = params.pipelines_testdata_base_path + 'raredisease/reference/hgnc.txt' vep_cache_version = 107 - vep_plugin_files = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vep_files.csv" + vep_plugin_files = params.pipelines_testdata_base_path + 'raredisease/reference/vep_files.csv' } diff --git a/conf/test_full.config b/conf/test_full.config index 587b8600..0fe2b4f2 100644 --- a/conf/test_full.config +++ b/conf/test_full.config @@ -15,11 +15,11 @@ params { config_profile_description = 'Full test dataset to check pipeline function' // Input data for full size test - input = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/testdata/samplesheet_full.csv' - intervals_wgs = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/test_full/genome.interval_list' - intervals_y = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/test_full/genomeY.interval_list' - target_bed = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/test_full/target.bed' - variant_catalog = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/test_full/variant_catalog_hg38.json' + input = params.pipelines_testdata_base_path + 'raredisease/testdata/samplesheet_full.csv' + intervals_wgs = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/genome.interval_list' + intervals_y = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/genomeY.interval_list' + target_bed = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/target.bed' + variant_catalog = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/variant_catalog_hg38.json' // Genome references genome = 'GRCh38' diff --git a/conf/test_one_sample.config b/conf/test_one_sample.config index 404fe607..4f641aac 100644 --- a/conf/test_one_sample.config +++ b/conf/test_one_sample.config @@ -34,33 +34,33 @@ params { skip_peddy = true // Input data - input = 'https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/testdata/samplesheet_single.csv' + input = params.pipelines_testdata_base_path + 'raredisease/testdata/samplesheet_single.csv' // Genome references - fasta = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/reference.fasta" - fai = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/reference.fasta.fai" + fasta = params.pipelines_testdata_base_path + 'raredisease/reference/reference.fasta' + fai = params.pipelines_testdata_base_path + 'raredisease/reference/reference.fasta.fai' genome = 'GRCh37' - gnomad_af = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/gnomad_reformated.tab.gz" - intervals_wgs = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/target_wgs.interval_list" - intervals_y = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/targetY.interval_list" - known_dbsnp = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/dbsnp_-138-.vcf.gz" - ml_model = "https://s3.amazonaws.com/sentieon-release/other/SentieonDNAscopeModel1.0.model" - mobile_element_references = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/mobile_element_references.tsv" - mobile_element_svdb_annotations = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/svdb_querydb_files.csv" - reduced_penetrance = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/reduced_penetrance.tsv" - score_config_mt = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/rank_model_snv.ini" - score_config_snv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/rank_model_snv.ini" - score_config_sv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/rank_model_sv.ini" - svdb_query_dbs = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/svdb_querydb_files.csv" - target_bed = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/target.bed" - variant_catalog = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/variant_catalog.json" - vcfanno_lua = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vcfanno_functions.lua" - vcfanno_resources = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vcfanno_resources.txt" - vcfanno_toml = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vcfanno_config.toml" - variant_consequences_snv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/variant_consequences_v2.txt" - variant_consequences_sv = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/variant_consequences_v2.txt" - vep_cache = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vep_cache_and_plugins.tar.gz" - vep_filters = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/hgnc.txt" + gnomad_af = params.pipelines_testdata_base_path + 'raredisease/reference/gnomad_reformated.tab.gz' + intervals_wgs = params.pipelines_testdata_base_path + 'raredisease/reference/target_wgs.interval_list' + intervals_y = params.pipelines_testdata_base_path + 'raredisease/reference/targetY.interval_list' + known_dbsnp = params.pipelines_testdata_base_path + 'raredisease/reference/dbsnp_-138-.vcf.gz' + ml_model = 'https://s3.amazonaws.com/sentieon-release/other/SentieonDNAscopeModel1.0.model' + mobile_element_references = params.pipelines_testdata_base_path + 'raredisease/reference/mobile_element_references.tsv' + mobile_element_svdb_annotations = params.pipelines_testdata_base_path + 'raredisease/reference/svdb_querydb_files.csv' + reduced_penetrance = params.pipelines_testdata_base_path + 'raredisease/reference/reduced_penetrance.tsv' + score_config_mt = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_snv.ini' + score_config_snv = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_snv.ini' + score_config_sv = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_sv.ini' + svdb_query_dbs = params.pipelines_testdata_base_path + 'raredisease/reference/svdb_querydb_files.csv' + target_bed = params.pipelines_testdata_base_path + 'raredisease/reference/target.bed' + variant_catalog = params.pipelines_testdata_base_path + 'raredisease/reference/variant_catalog.json' + vcfanno_lua = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_functions.lua' + vcfanno_resources = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_resources.txt' + vcfanno_toml = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_config.toml' + variant_consequences_snv = params.pipelines_testdata_base_path + 'raredisease/reference/variant_consequences_v2.txt' + variant_consequences_sv = params.pipelines_testdata_base_path + 'raredisease/reference/variant_consequences_v2.txt' + vep_cache = params.pipelines_testdata_base_path + 'raredisease/reference/vep_cache_and_plugins.tar.gz' + vep_filters = params.pipelines_testdata_base_path + 'raredisease/reference/hgnc.txt' vep_cache_version = 107 - vep_plugin_files = "https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/vep_files.csv" + vep_plugin_files = params.pipelines_testdata_base_path + 'raredisease/reference/vep_files.csv' } diff --git a/docs/images/raredisease_metromap_dark.pdf b/docs/images/raredisease_metromap_dark.pdf index bb8df737..030e64e0 100644 Binary files a/docs/images/raredisease_metromap_dark.pdf and b/docs/images/raredisease_metromap_dark.pdf differ diff --git a/docs/images/raredisease_metromap_dark.png b/docs/images/raredisease_metromap_dark.png index ece6bb7d..1d5faec2 100644 Binary files a/docs/images/raredisease_metromap_dark.png and b/docs/images/raredisease_metromap_dark.png differ diff --git a/docs/images/raredisease_metromap_dark.svg b/docs/images/raredisease_metromap_dark.svg index 60ff7c05..02b513c1 100644 --- a/docs/images/raredisease_metromap_dark.svg +++ b/docs/images/raredisease_metromap_dark.svg @@ -10,7 +10,7 @@ xml:space="preserve" inkscape:version="1.3.2 (091e20e, 2023-11-25)" sodipodi:docname="raredisease_metromap_dark.svg" - inkscape:export-filename="raredisease_metromap_dark.png" + inkscape:export-filename="raredisease_metromap_dark.pdf" inkscape:export-xdpi="96" inkscape:export-ydpi="96" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" @@ -28,14 +28,14 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="true" - inkscape:zoom="0.23190539" - inkscape:cx="1634.2872" - inkscape:cy="1187.9845" - inkscape:window-width="1440" - inkscape:window-height="872" - inkscape:window-x="0" - inkscape:window-y="0" - inkscape:window-maximized="1" + inkscape:zoom="0.29297896" + inkscape:cx="1926.7595" + inkscape:cy="762.85341" + inkscape:window-width="1920" + inkscape:window-height="1052" + inkscape:window-x="1710" + inkscape:window-y="28" + inkscape:window-maximized="0" inkscape:current-layer="layer1" showguides="true" inkscape:export-bgcolor="#272829ff">sentieon-bwasentieon-dedupmarkduplicatesbwamem2bwamantaalignment to mitochondriaalignment to mitochondriabwamem2/sentieon/bwabwamem2/sentieon/bwamarkduplicatesmarkduplicatesmutect2mutect2alignment to shifted mitochondriaalignment to shifted mitochondriasentieon-dnascopesentieon-dnascopesentieon-dnamodelapplysentieon-dnamodelapplydeepvariantglnexusdeepvariantglnexusbcftools - rohbcftools - rohstrangerstrangerupdupdvcfannovcfannocaddcaddvepvepgenmodgenmodcaddcaddvepvephmtnotehmtnotegenmodgenmodmanta + id="text16-5-0-9-5-5-5-04" + transform="matrix(1.3718931,-0.01669353,0.01669353,1.3718931,438.73449,-78.364966)">manta + + x="-95.560486" + y="292.85658" + id="tspan13"> + tiddit + x="-95.560486" + y="299.03019" + id="tspan14">tiddit + + x="-95.560486" + y="305.20381" + id="tspan15"> + cnvnatorcnvnatorvepvepsvdb-querysvdb-querygermlinecnvcallergermlinecnvcallergenmodgenmodexpansionhunterexpansionhuntermultiqcmultiqcpicardtools+mosdepthpicardtools+mosdepthvcfannovcfannobambam vcf vcf vcf vcffastqfastqreferenceseklipsedefault path alternative pathskippable pathsretroseq vcfvepsvdb-querymarkduplicatessentieon-bwasentieon-dedupbwa/bwamem2/bwamemefastqbamfastqbam vcf vcf vcf vcfeklipsedefault path alternative pathskippable pathsmantaretroseq vcfreferencesvepsvdb-query + inkscape:connector-curvature="0" + d="m 56.147034,260.93382 h 12.22215 v 5.39866 c 0,0.29149 0.236487,0.5276 0.52759,0.5276 h 4.660723 v 2.64321 H 56.147034 Z m 17.410508,24.51077 H 56.147034 v -5.08297 h 17.410463 v 5.08297 z" + id="path6276-4-8-2-4" /> diff --git a/docs/images/raredisease_metromap_light.pdf b/docs/images/raredisease_metromap_light.pdf index 2ae11fff..ac9e3918 100644 Binary files a/docs/images/raredisease_metromap_light.pdf and b/docs/images/raredisease_metromap_light.pdf differ diff --git a/docs/images/raredisease_metromap_light.png b/docs/images/raredisease_metromap_light.png index ce8f63b4..b1d0c3c6 100644 Binary files a/docs/images/raredisease_metromap_light.png and b/docs/images/raredisease_metromap_light.png differ diff --git a/docs/images/raredisease_metromap_light.svg b/docs/images/raredisease_metromap_light.svg index 7390dfb5..c761ed36 100644 --- a/docs/images/raredisease_metromap_light.svg +++ b/docs/images/raredisease_metromap_light.svg @@ -28,13 +28,13 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="true" - inkscape:zoom="0.31207156" - inkscape:cx="1339.4364" - inkscape:cy="860.37958" - inkscape:window-width="1440" - inkscape:window-height="872" - inkscape:window-x="0" - inkscape:window-y="0" + inkscape:zoom="0.31621395" + inkscape:cx="1563.8146" + inkscape:cy="1098.9395" + inkscape:window-width="1920" + inkscape:window-height="1052" + inkscape:window-x="1710" + inkscape:window-y="28" inkscape:window-maximized="0" inkscape:current-layer="layer1" showguides="true" @@ -139,874 +139,13 @@ id="path26-7" />alignment to mitochondriabwamem2/sentieon/bwamarkduplicatesmutect2alignment to shifted mitochondriasentieon-dnascopesentieon-dnamodelapplydeepvariantglnexusbcftools - rohstrangerupdvcfannocaddvepgenmodcaddvephmtnotegenmodmanta - + -tiddit - + -cnvnatorvepsvdb-querygermlinecnvcallergenmodexpansionhuntermultiqcpicardtools+mosdepthvcfannobambam vcf vcf vcf vcfeklipseretroseq vcfdefault path alternative pathskippable pathssentieon-bwasentieon-dedupmarkduplicatesbwamem2mantabwaalignment to mitochondriabwamem2/sentieon/bwamarkduplicatesmutect2alignment to shifted mitochondriasentieon-dnascopesentieon-dnamodelapplydeepvariantglnexusbcftools - rohstrangerupdvcfannocaddvepgenmodcaddvephmtnotegenmodmanta + + +tiddit + + +cnvnatorvepsvdb-querygermlinecnvcallergenmodexpansionhuntermultiqcpicardtools+mosdepthvcfanno vcf vcf vcf vcfeklipseretroseq vcfdefault path alternative pathskippable pathsmarkduplicatessentieon-bwasentieon-dedupbwa/bwamem2/bwamemefastqfastqfastqfastqreferencesreferencesmantavepsvdb-query + d="m 74.145119,274.25217 h 12.22215 v 5.39866 c 0,0.29149 0.236487,0.5276 0.52759,0.5276 h 4.660723 v 2.64321 H 74.145119 Z m 17.410508,24.51077 H 74.145119 v -5.08297 h 17.410463 v 5.08297 z" + id="path6276-4-8-2" />vepsvdb-querybambam diff --git a/docs/output.md b/docs/output.md index a0053784..3241f5d4 100644 --- a/docs/output.md +++ b/docs/output.md @@ -66,7 +66,8 @@ The pipeline is built using [Nextflow](https://www.nextflow.io/) and processes d - [CADD](#cadd-1) - [Hmtnote](#hmtnote) - [VEP](#vep-2) - - [Rank variants and filtering](#rank-variants-and-filtering) + - [Filtering and ranking](#filtering-and-ranking) + - [Filter_vep](#filter_vep) - [GENMOD](#genmod) - [Mobile element analysis](#mobile-element-analysis) - [Calling mobile elements](#calling-mobile-elements) @@ -319,14 +320,13 @@ The pipeline performs variant calling using [Sentieon DNAscope](https://support. #### Expansion Hunter -[Expansion Hunter](https://github.com/Illumina/ExpansionHunter) aims to estimate sizes of repeat sequences by performing a targeted search through alignments that span, flank, and are fully contained in each repeat. +[Expansion Hunter](https://github.com/Illumina/ExpansionHunter) aims to estimate sizes of repeat sequences by performing a targeted search through alignments that span, flank, and are fully contained in each repeat. The files generated are ready to be used with [REViewer](https://github.com/Illumina/REViewer).
Output files - `repeat_expansions/` - - `_repeat_expansion.vcf.gz`: file containing variant calls. - - `_repeat_expansion.vcf.gz.tbi`: index of the file containing variant calls. + - `_repeat_expansion.vcf`: file containing variant calls. - `_exphunter_sorted.bam`: A BAMlet containing alignments of reads that overlap or located in close proximity to each variant identified by ExpansionHunter - `_exphunter_sorted.bam.bai`: Index of the BAMlet file @@ -479,7 +479,7 @@ The pipeline for mitochondrial variant discovery, using Mutect2, uses a high sen Output files - `annotate_snv/mitochondria` - - `_mitochondria_haplogrep.txt`: file containing haplogroup information. + - `*haplogrep.txt`: file containing haplogroup information.
@@ -505,8 +505,8 @@ We recommend using vcfanno to annotate SNVs with precomputed CADD scores (files Output files - `annotate_snv/mitochondria` - - `_mitochondria_vep_vcfanno_hmtnote.vcf.gz`: file containing mitochondrial annotations. - - `_mitochondria_vep_vcfanno_hmtnote.vcf.gz.tbi`: index of the file containing mitochondrial annotations. + - `_mitochondria_hmtnote_vcfanno_.vcf.gz`: file containing mitochondrial annotations. + - `_mitochondria_hmtnote_vcfanno_.vcf.gz.tbi`: index of the file containing mitochondrial annotations. diff --git a/docs/usage.md b/docs/usage.md index b419b28a..84aca20a 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -21,9 +21,10 @@ Table of contents: - [7. SNV annotation \& Ranking](#7-snv-annotation--ranking) - [8. SV annotation \& Ranking](#8-sv-annotation--ranking) - [9. Mitochondrial annotation](#9-mitochondrial-annotation) - - [10. Mobile element annoation](#10-mobile-element-annotation) - - [11. Variant evaluation](#11-variant-evaluation) - - [12. Prepare data CNV visualization in Gens](#12-prepare-data-for-cnv-visualisation-in-gens) + - [10. Mobile element calling](#10-mobile-element-calling) + - [11. Mobile element annotation](#11-mobile-element-annotation) + - [12. Variant evaluation](#12-variant-evaluation) + - [13. Prepare data for CNV visualisation in Gens](#13-prepare-data-for-cnv-visualisation-in-gens) - [Run the pipeline](#run-the-pipeline) - [Direct input in CLI](#direct-input-in-cli) - [Import from a config file (recommended)](#import-from-a-config-file-recommended) @@ -281,7 +282,16 @@ We use CADD only to annotate small indels. To annotate SNVs with precomputed CAD | score_config_mt | | | variant_consequences_snv | | -##### 10. Mobile element annotation +##### 10. Mobile element calling + +| Mandatory | Optional | +| ------------------------------------- | -------- | +| genome | | +| mobile_element_references1 | | + +1 A TSV file that describes the references (BEDs) used by RetroSeq for calling mobile elements. Sample file [here](https://raw.githubusercontent.com/nf-core/test-datasets/raredisease/reference/mobile_element_references.tsv) + +##### 11. Mobile element annotation | Mandatory | Optional | | ------------------------------------------- | --------------------------------- | @@ -293,7 +303,7 @@ We use CADD only to annotate small indels. To annotate SNVs with precomputed CAD 1 A CSV file that describes the databases (VCFs) used by SVDB for annotating mobile elements with allele frequencies. Sample file [here](https://github.com/nf-core/test-datasets/blob/raredisease/reference/svdb_querydb_files.csv). -##### 11. Variant evaluation +##### 12. Variant evaluation | Mandatory | Optional | | -------------------------- | -------- | @@ -303,7 +313,7 @@ We use CADD only to annotate small indels. To annotate SNVs with precomputed CAD 1 This parameter is set to false by default, set it to true if if you'd like to run the evaluation subworkflow 2 A CSV file that describes the truth VCF files used by RTG Tools' vcfeval for evaluating SNVs. Sample file [here](https://github.com/nf-core/test-datasets/blob/raredisease/reference/rtg_example.csv). The file contains four columns `samplename,vcf,bedregions,evaluationregions` where samplename is the user assigned samplename in the input samplesheet, vcf is the path to the truth vcf file, bedregions and evaluationregions are the path to the bed files that are supposed to be passed through --bed_regions and --evaluation_regions options of vcfeval. -##### 12. Prepare data for CNV visualisation in Gens +##### 13. Prepare data for CNV visualisation in Gens Optionally the read data can be prepared for CNV visualization in [Gens](https://github.com/Clinical-Genomics-Lund/gens). This subworkflow is turned off by default. You can activate it by supplying the option `--skip_gens false`. @@ -435,6 +445,8 @@ If `-profile` is not specified, the pipeline will run locally and expect all sof - A generic configuration profile to be used with [Charliecloud](https://hpc.github.io/charliecloud/) - `apptainer` - A generic configuration profile to be used with [Apptainer](https://apptainer.org/) +- `wave` + - A generic configuration profile to enable [Wave](https://seqera.io/wave/) containers. Use together with one of the above (requires Nextflow ` 24.03.0-edge` or later). - `conda` - A generic configuration profile to be used with [Conda](https://conda.io/docs/). Please only use Conda as a last resort i.e. when it's not possible to run the pipeline with Docker, Singularity, Podman, Shifter, Charliecloud, or Apptainer. diff --git a/lib/CustomFunctions.groovy b/lib/CustomFunctions.groovy index 9ed0a9c0..1a8d0227 100644 --- a/lib/CustomFunctions.groovy +++ b/lib/CustomFunctions.groovy @@ -2,22 +2,6 @@ import nextflow.Nextflow class CustomFunctions { - // Function to generate a pedigree file - public static File makePed(samples, outdir) { - - def case_name = samples[0].case_id - def outfile = new File(outdir +"/pipeline_info/${case_name}" + '.ped') - outfile.text = ['#family_id', 'sample_id', 'father', 'mother', 'sex', 'phenotype'].join('\t') - def samples_list = [] - for(int i = 0; i versions.yml + "${task.process}": + create_hgncids_file: v1.0 + python: \$(python --version | sed 's/Python //g') + END_VERSIONS + """ + + stub: + """ + python3 < versions.yml + "${task.process}": + create_hgncids_file: v1.0 + python: \$(python --version | sed 's/Python //g') + END_VERSIONS + """ +} diff --git a/modules/local/create_pedigree_file.nf b/modules/local/create_pedigree_file.nf new file mode 100644 index 00000000..9e680902 --- /dev/null +++ b/modules/local/create_pedigree_file.nf @@ -0,0 +1,53 @@ +process CREATE_PEDIGREE_FILE { + tag "pedigree" + label 'process_single' + + conda "conda-forge::python=3.8.3" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/python:3.8.3' : + 'biocontainers/python:3.8.3' }" + + input: + val(samples) + + output: + path("*.ped"), emit: ped + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def case_name = samples[0].case_id + def out = new File(case_name + ".ped") + outfile_text = ['#family_id', 'sample_id', 'father', 'mother', 'sex', 'phenotype'].join('\\t') + def samples_list = [] + for(int i = 0; i${case_name}.ped + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + create_pedigree_file: v1.0 + python: \$(python --version | sed 's/Python //g') + END_VERSIONS + """ + + stub: + def case_name = samples[0].case_id + """ + touch ${case_name}.ped + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + create_pedigree_file: v1.0 + python: \$(python --version | sed 's/Python //g') + END_VERSIONS + """ +} diff --git a/modules/nf-core/bcftools/annotate/main.nf b/modules/nf-core/bcftools/annotate/main.nf index 27ebfd4a..64e7ec76 100644 --- a/modules/nf-core/bcftools/annotate/main.nf +++ b/modules/nf-core/bcftools/annotate/main.nf @@ -52,8 +52,10 @@ process BCFTOOLS_ANNOTATE { args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" : args.contains("--output-type v") || args.contains("-Ov") ? "vcf" : "vcf" + + def create_cmd = extension.endsWith(".gz") ? "echo '' | gzip >" : "touch" """ - touch ${prefix}.${extension} + ${create_cmd} ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/bcftools/annotate/tests/bcf.config b/modules/nf-core/bcftools/annotate/tests/bcf.config new file mode 100644 index 00000000..b8496b33 --- /dev/null +++ b/modules/nf-core/bcftools/annotate/tests/bcf.config @@ -0,0 +1,6 @@ +process { + withName: 'BCFTOOLS_ANNOTATE' { + ext.args = "-x ID,INFO/DP,FORMAT/DP --output-type u" + ext.prefix = { "${meta.id}_ann" } + } +} \ No newline at end of file diff --git a/modules/nf-core/bcftools/annotate/tests/main.nf.test b/modules/nf-core/bcftools/annotate/tests/main.nf.test new file mode 100644 index 00000000..9abf9475 --- /dev/null +++ b/modules/nf-core/bcftools/annotate/tests/main.nf.test @@ -0,0 +1,108 @@ +nextflow_process { + + name "Test Process BCFTOOLS_ANNOTATE" + script "../main.nf" + process "BCFTOOLS_ANNOTATE" + + tag "modules" + tag "modules_nfcore" + tag "bcftools" + tag "bcftools/annotate" + + test("sarscov2 - [vcf, tbi, vcf2, tbi2, []] - vcf_output") { + + config "./vcf.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test2_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test2_vcf_gz_tbi'], checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.vcf.collect { it.collect { it instanceof Map ? it : file(it).name }}, + process.out.versions + ).match("vcf") } + ) + } + + } + + + test("sarscov2 - [vcf, [], [], [], header] - bcf_output") { + + config "./bcf.config" + + when { + process { + """ + vcf = Channel.of([ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), + [], + [], + [] + ]) + + header = Channel.of( + '##INFO=', + '##INFO=' + ) + .collectFile(name:"headers.vcf", newLine:true) + + input[0] = vcf.combine(header) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.vcf.collect { it.collect { it instanceof Map ? it : file(it).name }}, + process.out.versions + ).match("bcf") } + ) + } + + } + + test("sarscov2 - [vcf, tbi, vcf2, tbi2, []] - stub") { + + config "./vcf.config" + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test2_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test2_vcf_gz_tbi'], checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("stub") } + ) + } + + } + +} diff --git a/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap b/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap new file mode 100644 index 00000000..72b06878 --- /dev/null +++ b/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap @@ -0,0 +1,79 @@ +{ + "bcf": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_ann.bcf" + ] + ], + [ + "versions.yml:md5,ea2b798edb5c1c0d46938f313a97a901" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T09:21:58.526449656" + }, + "vcf": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_vcf.vcf.gz" + ] + ], + [ + "versions.yml:md5,ea2b798edb5c1c0d46938f313a97a901" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-02T16:47:47.127427579" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_vcf.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,ea2b798edb5c1c0d46938f313a97a901" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_vcf.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,ea2b798edb5c1c0d46938f313a97a901" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-02T16:43:43.707474961" + } +} \ No newline at end of file diff --git a/modules/nf-core/bcftools/annotate/tests/tags.yml b/modules/nf-core/bcftools/annotate/tests/tags.yml new file mode 100644 index 00000000..f97a1afc --- /dev/null +++ b/modules/nf-core/bcftools/annotate/tests/tags.yml @@ -0,0 +1,2 @@ +bcftools/annotate: + - "modules/nf-core/bcftools/annotate/**" diff --git a/modules/nf-core/bcftools/annotate/tests/vcf.config b/modules/nf-core/bcftools/annotate/tests/vcf.config new file mode 100644 index 00000000..cb809f61 --- /dev/null +++ b/modules/nf-core/bcftools/annotate/tests/vcf.config @@ -0,0 +1,6 @@ +process { + withName: 'BCFTOOLS_ANNOTATE' { + ext.prefix = { "${meta.id}_vcf" } + ext.args = "-x ID,INFO/DP,FORMAT/DP --output-type z" + } +} diff --git a/modules/nf-core/bcftools/concat/main.nf b/modules/nf-core/bcftools/concat/main.nf index a5830a25..d64640b3 100644 --- a/modules/nf-core/bcftools/concat/main.nf +++ b/modules/nf-core/bcftools/concat/main.nf @@ -36,7 +36,7 @@ process BCFTOOLS_CONCAT { stub: prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.vcf.gz + echo "" | gzip > ${prefix}.vcf.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/bcftools/concat/tests/main.nf.test b/modules/nf-core/bcftools/concat/tests/main.nf.test index bf1a5f3f..d5d9f787 100644 --- a/modules/nf-core/bcftools/concat/tests/main.nf.test +++ b/modules/nf-core/bcftools/concat/tests/main.nf.test @@ -34,10 +34,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - process.out.vcf, - process.out.versions - ).match() } + { assert snapshot(process.out).match() } ) } @@ -63,10 +60,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - process.out.vcf, - process.out.versions - ).match() } + { assert snapshot(process.out).match() } ) } @@ -96,10 +90,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - file(process.out.vcf[0][1]).name, - process.out.versions - ).match() } + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/bcftools/concat/tests/main.nf.test.snap b/modules/nf-core/bcftools/concat/tests/main.nf.test.snap index 7344e6e3..90d3fc06 100644 --- a/modules/nf-core/bcftools/concat/tests/main.nf.test.snap +++ b/modules/nf-core/bcftools/concat/tests/main.nf.test.snap @@ -1,43 +1,101 @@ { "sarscov2 - [[vcf1, vcf2], []]": { "content": [ - [ - [ - { - "id": "test3" - }, - "test3.vcf.gz:md5,4bcd0afd89f56c5d433f6b6abc44d0a6" + { + "0": [ + [ + { + "id": "test3" + }, + "test3.vcf.gz:md5,5f6796c3ae109a1a5b87353954693f5a" + ] + ], + "1": [ + "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" + ], + "vcf": [ + [ + { + "id": "test3" + }, + "test3.vcf.gz:md5,5f6796c3ae109a1a5b87353954693f5a" + ] + ], + "versions": [ + "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" ] - ], - [ - "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" - ] + } ], - "timestamp": "2023-11-29T13:52:27.03724666" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T13:22:49.766749302" }, "sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]]": { "content": [ - [ - [ - { - "id": "test3" - }, - "test3.vcf.gz:md5,4bcd0afd89f56c5d433f6b6abc44d0a6" + { + "0": [ + [ + { + "id": "test3" + }, + "test3.vcf.gz:md5,5f6796c3ae109a1a5b87353954693f5a" + ] + ], + "1": [ + "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" + ], + "vcf": [ + [ + { + "id": "test3" + }, + "test3.vcf.gz:md5,5f6796c3ae109a1a5b87353954693f5a" + ] + ], + "versions": [ + "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" ] - ], - [ - "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" - ] + } ], - "timestamp": "2023-11-29T13:52:21.468988293" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T13:22:41.119912312" }, "sarscov2 - [[vcf1, vcf2], [tbi1, tbi2]] - stub": { "content": [ - "test3.vcf.gz", - [ - "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" - ] + { + "0": [ + [ + { + "id": "test3" + }, + "test3.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" + ], + "vcf": [ + [ + { + "id": "test3" + }, + "test3.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,24ae05eb858733b40fbd3f89743a6d09" + ] + } ], - "timestamp": "2023-11-29T13:41:04.716017811" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T13:22:59.90466392" } } \ No newline at end of file diff --git a/modules/nf-core/bcftools/filter/main.nf b/modules/nf-core/bcftools/filter/main.nf index 1a40cb93..cc9a2361 100644 --- a/modules/nf-core/bcftools/filter/main.nf +++ b/modules/nf-core/bcftools/filter/main.nf @@ -43,6 +43,7 @@ process BCFTOOLS_FILTER { """ stub: + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" extension = args.contains("--output-type b") || args.contains("-Ob") ? "bcf.gz" : @@ -53,8 +54,10 @@ process BCFTOOLS_FILTER { if ("$vcf" == "${prefix}.${extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + def create_file = extension.endsWith(".gz") ? "echo '' | gzip > ${prefix}.${extension}" : "touch ${prefix}.${extension}" + """ - touch ${prefix}.${extension} + ${create_file} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/bcftools/filter/meta.yml b/modules/nf-core/bcftools/filter/meta.yml index 5b111fc3..deb93b13 100644 --- a/modules/nf-core/bcftools/filter/meta.yml +++ b/modules/nf-core/bcftools/filter/meta.yml @@ -21,7 +21,7 @@ input: - vcf: type: file description: VCF input file - pattern: "*.{vcf}" + pattern: "*.{vcf,bcf,vcf.gz,bcf.gz}" output: - meta: type: map @@ -31,7 +31,7 @@ output: - vcf: type: file description: VCF filtered output file - pattern: "*.{vcf}" + pattern: "*.{vcf,bcf,vcf.gz,bcf.gz}" - versions: type: file description: File containing software versions diff --git a/modules/nf-core/bcftools/filter/tests/main.nf.test b/modules/nf-core/bcftools/filter/tests/main.nf.test new file mode 100644 index 00000000..eaf100e8 --- /dev/null +++ b/modules/nf-core/bcftools/filter/tests/main.nf.test @@ -0,0 +1,82 @@ +nextflow_process { + + name "Test Process BCFTOOLS_FILTER" + script "../main.nf" + process "BCFTOOLS_FILTER" + + tag "modules" + tag "modules_nfcore" + tag "bcftools" + tag "bcftools/filter" + + config "./nextflow.config" + + test("sarscov2 - vcf") { + + when { + process { + """ + input[0] = [ + [id:"vcf_test"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("vcf") } + ) + } + + } + + test("sarscov2 - vcf - bcf output") { + + when { + process { + """ + input[0] = [ + [id:"bcf_test"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("bcf output") } + ) + } + + } + + test("sarscov2 - vcf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id:"vcf_test"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("vcf - stub") } + ) + } + + } + +} diff --git a/modules/nf-core/bcftools/filter/tests/main.nf.test.snap b/modules/nf-core/bcftools/filter/tests/main.nf.test.snap new file mode 100644 index 00000000..f8e17aa0 --- /dev/null +++ b/modules/nf-core/bcftools/filter/tests/main.nf.test.snap @@ -0,0 +1,101 @@ +{ + "vcf": { + "content": [ + { + "0": [ + [ + { + "id": "vcf_test" + }, + "vcf_test.vcf.gz:md5,8e722884ffb75155212a3fc053918766" + ] + ], + "1": [ + "versions.yml:md5,7dc77043f9afb848d942d47a7bc19f67" + ], + "vcf": [ + [ + { + "id": "vcf_test" + }, + "vcf_test.vcf.gz:md5,8e722884ffb75155212a3fc053918766" + ] + ], + "versions": [ + "versions.yml:md5,7dc77043f9afb848d942d47a7bc19f67" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-27T16:57:32.940161987" + }, + "bcf output": { + "content": [ + { + "0": [ + [ + { + "id": "bcf_test" + }, + "bcf_test.bcf.gz:md5,c8a304c8d2892039201154153c8cd536" + ] + ], + "1": [ + "versions.yml:md5,7dc77043f9afb848d942d47a7bc19f67" + ], + "vcf": [ + [ + { + "id": "bcf_test" + }, + "bcf_test.bcf.gz:md5,c8a304c8d2892039201154153c8cd536" + ] + ], + "versions": [ + "versions.yml:md5,7dc77043f9afb848d942d47a7bc19f67" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-27T16:45:14.586866398" + }, + "vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "vcf_test" + }, + "vcf_test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,7dc77043f9afb848d942d47a7bc19f67" + ], + "vcf": [ + [ + { + "id": "vcf_test" + }, + "vcf_test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,7dc77043f9afb848d942d47a7bc19f67" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-27T17:05:52.80837892" + } +} \ No newline at end of file diff --git a/modules/nf-core/bcftools/filter/tests/nextflow.config b/modules/nf-core/bcftools/filter/tests/nextflow.config new file mode 100644 index 00000000..4e960c8d --- /dev/null +++ b/modules/nf-core/bcftools/filter/tests/nextflow.config @@ -0,0 +1,3 @@ +process { + ext.args = {"--no-version${meta.id == 'bcf_test' ? ' --output-type b' : ' --output-type z'}"} +} diff --git a/modules/nf-core/bcftools/filter/tests/tags.yml b/modules/nf-core/bcftools/filter/tests/tags.yml new file mode 100644 index 00000000..d5e01080 --- /dev/null +++ b/modules/nf-core/bcftools/filter/tests/tags.yml @@ -0,0 +1,2 @@ +bcftools/filter: + - "modules/nf-core/bcftools/filter/**" diff --git a/modules/nf-core/bcftools/sort/main.nf b/modules/nf-core/bcftools/sort/main.nf index c982944c..246148d6 100644 --- a/modules/nf-core/bcftools/sort/main.nf +++ b/modules/nf-core/bcftools/sort/main.nf @@ -49,9 +49,9 @@ process BCFTOOLS_SORT { args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" : args.contains("--output-type v") || args.contains("-Ov") ? "vcf" : "vcf" - + def create_cmd = extension.endsWith(".gz") ? "echo '' | gzip >" : "touch" """ - touch ${prefix}.${extension} + ${create_cmd} ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/bcftools/sort/tests/main.nf.test b/modules/nf-core/bcftools/sort/tests/main.nf.test new file mode 100644 index 00000000..8a496dda --- /dev/null +++ b/modules/nf-core/bcftools/sort/tests/main.nf.test @@ -0,0 +1,54 @@ +nextflow_process { + + name "Test Process BCFTOOLS_SORT" + script "../main.nf" + process "BCFTOOLS_SORT" + + tag "modules" + tag "modules_nfcore" + tag "bcftools" + tag "bcftools/sort" + + test("sarscov2 - vcf") { + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match("vcf") } + ) + } + + } + + test("sarscov2 - vcf - stub") { + options "-stub" + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } +} diff --git a/modules/nf-core/bcftools/sort/tests/main.nf.test.snap b/modules/nf-core/bcftools/sort/tests/main.nf.test.snap new file mode 100644 index 00000000..6200cc42 --- /dev/null +++ b/modules/nf-core/bcftools/sort/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "vcf": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,8e722884ffb75155212a3fc053918766" + ] + ], + "1": [ + "versions.yml:md5,622bd32d4ff0fac3360cd534ae0f0168" + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,8e722884ffb75155212a3fc053918766" + ] + ], + "versions": [ + "versions.yml:md5,622bd32d4ff0fac3360cd534ae0f0168" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-02T16:55:21.237927554" + }, + "sarscov2 - vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,622bd32d4ff0fac3360cd534ae0f0168" + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,622bd32d4ff0fac3360cd534ae0f0168" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T12:32:50.506309198" + } +} \ No newline at end of file diff --git a/modules/nf-core/bcftools/sort/tests/tags.yml b/modules/nf-core/bcftools/sort/tests/tags.yml new file mode 100644 index 00000000..6e9520dd --- /dev/null +++ b/modules/nf-core/bcftools/sort/tests/tags.yml @@ -0,0 +1,2 @@ +bcftools/sort: + - "modules/nf-core/bcftools/sort/**" diff --git a/modules/nf-core/bedtools/genomecov/main.nf b/modules/nf-core/bedtools/genomecov/main.nf index 7a4d9c45..954e8913 100644 --- a/modules/nf-core/bedtools/genomecov/main.nf +++ b/modules/nf-core/bedtools/genomecov/main.nf @@ -11,6 +11,7 @@ process BEDTOOLS_GENOMECOV { tuple val(meta), path(intervals), val(scale) path sizes val extension + val sort output: tuple val(meta), path("*.${extension}"), emit: genomecov @@ -26,6 +27,7 @@ process BEDTOOLS_GENOMECOV { if (!args_list.contains('-bg') && (scale > 0 && scale != 1)) { args += " -bg" } + def sort_cmd = sort ? '| bedtools sort' : '' def prefix = task.ext.prefix ?: "${meta.id}" if (intervals.name =~ /\.bam/) { @@ -34,6 +36,7 @@ process BEDTOOLS_GENOMECOV { genomecov \\ -ibam $intervals \\ $args \\ + $sort_cmd \\ > ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml @@ -48,6 +51,7 @@ process BEDTOOLS_GENOMECOV { -i $intervals \\ -g $sizes \\ $args \\ + $sort_cmd \\ > ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/bedtools/genomecov/tests/main.nf.test b/modules/nf-core/bedtools/genomecov/tests/main.nf.test index 21e69aed..8213cff9 100644 --- a/modules/nf-core/bedtools/genomecov/tests/main.nf.test +++ b/modules/nf-core/bedtools/genomecov/tests/main.nf.test @@ -15,13 +15,14 @@ nextflow_process { """ input[0] = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.bam", checkIfExists: true), 1 ] // sizes input[1] = [] // extension input[2] = "txt" + input[3] = true """ } } @@ -41,13 +42,14 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.bam", checkIfExists: true), 0.5 ] // sizes input[1] = file('dummy_chromosome_sizes') // extension input[2] = 'txt' + input[3] = false """ } } @@ -67,13 +69,14 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['baits_bed'], checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/sarscov2/genome/bed/baits.bed", checkIfExists: true), 0.5 ] // sizes - input[1] = file(params.test_data['sarscov2']['genome']['genome_sizes'], checkIfExists: true) + input[1] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.sizes", checkIfExists: true) // extension input[2] = 'txt' + input[3] = false """ } } @@ -95,13 +98,14 @@ nextflow_process { """ input[0] = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/bam/test.paired_end.bam", checkIfExists: true), 1 ] // sizes input[1] = [] // extension input[2] = 'txt' + input[3] = false """ } } diff --git a/modules/nf-core/bwa/index/environment.yml b/modules/nf-core/bwa/index/environment.yml index 5d3cb323..126e0034 100644 --- a/modules/nf-core/bwa/index/environment.yml +++ b/modules/nf-core/bwa/index/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::bwa=0.7.17 + - bioconda::bwa=0.7.18 diff --git a/modules/nf-core/bwa/index/main.nf b/modules/nf-core/bwa/index/main.nf index 24b5a2ea..2e48b6ca 100644 --- a/modules/nf-core/bwa/index/main.nf +++ b/modules/nf-core/bwa/index/main.nf @@ -4,8 +4,8 @@ process BWA_INDEX { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bwa:0.7.17--hed695b0_7' : - 'biocontainers/bwa:0.7.17--hed695b0_7' }" + 'https://depot.galaxyproject.org/singularity/bwa:0.7.18--he4a0461_0' : + 'biocontainers/bwa:0.7.18--he4a0461_0' }" input: tuple val(meta), path(fasta) diff --git a/modules/nf-core/bwa/index/meta.yml b/modules/nf-core/bwa/index/meta.yml index 730628d0..4c7d30f3 100644 --- a/modules/nf-core/bwa/index/meta.yml +++ b/modules/nf-core/bwa/index/meta.yml @@ -43,3 +43,4 @@ authors: maintainers: - "@drpatelh" - "@maxulysse" + - "@gallvp" diff --git a/modules/nf-core/bwa/index/tests/main.nf.test.snap b/modules/nf-core/bwa/index/tests/main.nf.test.snap index e51ad5bf..7c8f0465 100644 --- a/modules/nf-core/bwa/index/tests/main.nf.test.snap +++ b/modules/nf-core/bwa/index/tests/main.nf.test.snap @@ -17,7 +17,7 @@ ] ], "1": [ - "versions.yml:md5,0f20525da90e7489a7ebb02adca3265f" + "versions.yml:md5,a64462ac7dfb21f4ade9b02e7f65c5bb" ], "index": [ [ @@ -34,10 +34,14 @@ ] ], "versions": [ - "versions.yml:md5,0f20525da90e7489a7ebb02adca3265f" + "versions.yml:md5,a64462ac7dfb21f4ade9b02e7f65c5bb" ] } ], - "timestamp": "2023-10-17T17:20:20.180927714" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-16T11:40:09.925307" } } \ No newline at end of file diff --git a/modules/nf-core/bwa/mem/environment.yml b/modules/nf-core/bwa/mem/environment.yml index 3f136d0a..3aa9f0cc 100644 --- a/modules/nf-core/bwa/mem/environment.yml +++ b/modules/nf-core/bwa/mem/environment.yml @@ -4,7 +4,7 @@ channels: - bioconda - defaults dependencies: - - bwa=0.7.17 + - bwa=0.7.18 # renovate: datasource=conda depName=bioconda/samtools - - samtools=1.19.2 - - htslib=1.19.1 + - samtools=1.20 + - htslib=1.20.0 diff --git a/modules/nf-core/bwa/mem/main.nf b/modules/nf-core/bwa/mem/main.nf index 54ec0f16..9c815f0c 100644 --- a/modules/nf-core/bwa/mem/main.nf +++ b/modules/nf-core/bwa/mem/main.nf @@ -4,17 +4,21 @@ process BWA_MEM { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:a34558545ae1413d94bde4578787ebef08027945-0' : - 'biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:a34558545ae1413d94bde4578787ebef08027945-0' }" + 'https://depot.galaxyproject.org/singularity/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:1bd8542a8a0b42e0981337910954371d0230828e-0' : + 'biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:1bd8542a8a0b42e0981337910954371d0230828e-0' }" input: - tuple val(meta), path(reads) + tuple val(meta) , path(reads) tuple val(meta2), path(index) + tuple val(meta3), path(fasta) val sort_bam output: - tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions + tuple val(meta), path("*.bam") , emit: bam, optional: true + tuple val(meta), path("*.cram") , emit: cram, optional: true + tuple val(meta), path("*.csi") , emit: csi, optional: true + tuple val(meta), path("*.crai") , emit: crai, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -24,6 +28,13 @@ process BWA_MEM { def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def samtools_command = sort_bam ? 'sort' : 'view' + def extension = args2.contains("--output-fmt sam") ? "sam" : + args2.contains("--output-fmt cram") ? "cram": + sort_bam && args2.contains("-O cram")? "cram": + !sort_bam && args2.contains("-C") ? "cram": + "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" """ INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'` @@ -32,7 +43,7 @@ process BWA_MEM { -t $task.cpus \\ \$INDEX \\ $reads \\ - | samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam - + | samtools $samtools_command $args2 ${reference} --threads $task.cpus -o ${prefix}.${extension} - cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -42,9 +53,19 @@ process BWA_MEM { """ stub: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def samtools_command = sort_bam ? 'sort' : 'view' + def extension = args2.contains("--output-fmt sam") ? "sam" : + args2.contains("--output-fmt cram") ? "cram": + sort_bam && args2.contains("-O cram")? "cram": + !sort_bam && args2.contains("-C") ? "cram": + "bam" """ - touch ${prefix}.bam + touch ${prefix}.${extension} + touch ${prefix}.csi + touch ${prefix}.crai cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/bwa/mem/meta.yml b/modules/nf-core/bwa/mem/meta.yml index 440fb1f9..1532c261 100644 --- a/modules/nf-core/bwa/mem/meta.yml +++ b/modules/nf-core/bwa/mem/meta.yml @@ -37,6 +37,10 @@ input: type: file description: BWA genome index files pattern: "Directory containing BWA index *.{amb,ann,bwt,pac,sa}" + - fasta: + type: file + description: Reference genome in FASTA format + pattern: "*.{fasta,fa}" - sort_bam: type: boolean description: use samtools sort (true) or samtools view (false) @@ -46,6 +50,18 @@ output: type: file description: Output BAM file containing read alignments pattern: "*.{bam}" + - cram: + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + - csi: + type: file + description: Optional index file for BAM file + pattern: "*.{csi}" + - crai: + type: file + description: Optional index file for CRAM file + pattern: "*.{crai}" - versions: type: file description: File containing software versions @@ -53,6 +69,8 @@ output: authors: - "@drpatelh" - "@jeremy1805" + - "@matthdsm" maintainers: - "@drpatelh" - "@jeremy1805" + - "@matthdsm" diff --git a/modules/nf-core/bwa/mem/tests/main.nf.test b/modules/nf-core/bwa/mem/tests/main.nf.test index 2696e4bf..463b76f8 100644 --- a/modules/nf-core/bwa/mem/tests/main.nf.test +++ b/modules/nf-core/bwa/mem/tests/main.nf.test @@ -35,7 +35,8 @@ nextflow_process { ] ] input[1] = BWA_INDEX.out.index - input[2] = false + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = false """ } } @@ -43,7 +44,14 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.cram, + process.out.csi, + process.out.crai, + process.out.versions, + file(process.out.bam[0][1]).name + ).match() + } ) } @@ -75,7 +83,8 @@ nextflow_process { ] ] input[1] = BWA_INDEX.out.index - input[2] = true + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = true """ } } @@ -83,7 +92,14 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.cram, + process.out.csi, + process.out.crai, + process.out.versions, + file(process.out.bam[0][1]).name + ).match() + } ) } @@ -116,7 +132,8 @@ nextflow_process { ] ] input[1] = BWA_INDEX.out.index - input[2] = false + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = false """ } } @@ -124,7 +141,14 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.cram, + process.out.csi, + process.out.crai, + process.out.versions, + file(process.out.bam[0][1]).name + ).match() + } ) } @@ -157,7 +181,104 @@ nextflow_process { ] ] input[1] = BWA_INDEX.out.index - input[2] = true + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.cram, + process.out.csi, + process.out.crai, + process.out.versions, + file(process.out.bam[0][1]).name + ).match() + } + ) + } + + } + + test("Paired-End - no fasta") { + + setup { + run("BWA_INDEX") { + script "../../index/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = BWA_INDEX.out.index + input[2] = [[:],[]] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.cram, + process.out.csi, + process.out.crai, + process.out.versions, + file(process.out.bam[0][1]).name + ).match() + } + ) + } + + } + + test("Single-end - stub") { + options "-stub" + setup { + run("BWA_INDEX") { + script "../../index/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + ] + input[1] = BWA_INDEX.out.index + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = false """ } } @@ -165,9 +286,56 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + file(process.out.bam[0][1]).name, + file(process.out.csi[0][1]).name, + process.out.versions + ).match() } ) } + } + + test("Paired-end - stub") { + options "-stub" + setup { + run("BWA_INDEX") { + script "../../index/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = BWA_INDEX.out.index + input[2] = [[id: 'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = false + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + file(process.out.csi[0][1]).name, + process.out.versions + ).match() } + ) + } } } diff --git a/modules/nf-core/bwa/mem/tests/main.nf.test.snap b/modules/nf-core/bwa/mem/tests/main.nf.test.snap index e4fd8cc0..038ee7b7 100644 --- a/modules/nf-core/bwa/mem/tests/main.nf.test.snap +++ b/modules/nf-core/bwa/mem/tests/main.nf.test.snap @@ -1,142 +1,140 @@ { "Single-End": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": true - }, - "test.bam:md5,a74710a0345b4717bb4431bf9c257120" - ] - ], - "1": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ], - "bam": [ - [ - { - "id": "test", - "single_end": true - }, - "test.bam:md5,a74710a0345b4717bb4431bf9c257120" - ] - ], - "versions": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ] - } + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ], + "test.bam" ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T11:11:48.440661587" + "timestamp": "2024-05-20T08:44:32.953673185" }, "Single-End Sort": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": true - }, - "test.bam:md5,cb1e038bc4d990683fa485d632550b54" - ] - ], - "1": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ], - "bam": [ - [ - { - "id": "test", - "single_end": true - }, - "test.bam:md5,cb1e038bc4d990683fa485d632550b54" - ] - ], - "versions": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ] - } + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ], + "test.bam" ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T11:11:56.086493265" + "timestamp": "2024-05-20T08:44:45.27066093" }, "Paired-End": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,aea123a3828a99da1906126355f15a12" - ] - ], - "1": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ], - "bam": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,aea123a3828a99da1906126355f15a12" - ] - ], - "versions": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ] - } + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ], + "test.bam" ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T11:12:03.474974773" + "timestamp": "2024-05-20T08:44:57.706852274" }, "Paired-End Sort": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,4682087bcdc3617384b375093fecd8dd" - ] - ], - "1": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ], - "bam": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,4682087bcdc3617384b375093fecd8dd" - ] - ], - "versions": [ - "versions.yml:md5,c32f719a68bb2966c8511d808154d42d" - ] - } + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ], + "test.bam" ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T11:12:10.721510817" + "timestamp": "2024-05-20T08:45:10.376505036" + }, + "Single-end - stub": { + "content": [ + "test.bam", + "test.csi", + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-20T08:46:07.182072398" + }, + "Paired-End - no fasta": { + "content": [ + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ], + "test.bam" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-20T08:45:53.813076501" + }, + "Paired-end - stub": { + "content": [ + "test.bam", + "test.csi", + [ + "versions.yml:md5,478b816fbd37871f5e8c617833d51d80" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-20T08:46:18.412916364" } } \ No newline at end of file diff --git a/modules/nf-core/bwamem2/index/tests/main.nf.test b/modules/nf-core/bwamem2/index/tests/main.nf.test new file mode 100644 index 00000000..dbf11132 --- /dev/null +++ b/modules/nf-core/bwamem2/index/tests/main.nf.test @@ -0,0 +1,31 @@ +nextflow_process { + + name "Test Process BWAMEM2_INDEX" + tag "modules_nfcore" + tag "modules" + tag "bwamem2" + tag "bwamem2/index" + script "../main.nf" + process "BWAMEM2_INDEX" + + test("BWAMEM2 index") { + + when { + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/bwamem2/index/tests/main.nf.test.snap b/modules/nf-core/bwamem2/index/tests/main.nf.test.snap new file mode 100644 index 00000000..69b268ee --- /dev/null +++ b/modules/nf-core/bwamem2/index/tests/main.nf.test.snap @@ -0,0 +1,47 @@ +{ + "BWAMEM2 index": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "genome.fasta.0123:md5,b02870de80106104abcb03cd9463e7d8", + "genome.fasta.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", + "genome.fasta.ann:md5,c32e11f6c859f166c7525a9c1d583567", + "genome.fasta.bwt.2bit.64:md5,d097a1b82dee375d41a1ea69895a9216", + "genome.fasta.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66" + ] + ] + ], + "1": [ + "versions.yml:md5,9ffd13d12e7108ed15c58566bc4717d6" + ], + "index": [ + [ + { + "id": "test" + }, + [ + "genome.fasta.0123:md5,b02870de80106104abcb03cd9463e7d8", + "genome.fasta.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", + "genome.fasta.ann:md5,c32e11f6c859f166c7525a9c1d583567", + "genome.fasta.bwt.2bit.64:md5,d097a1b82dee375d41a1ea69895a9216", + "genome.fasta.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66" + ] + ] + ], + "versions": [ + "versions.yml:md5,9ffd13d12e7108ed15c58566bc4717d6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T12:59:39.132616" + } +} \ No newline at end of file diff --git a/modules/nf-core/bwamem2/index/tests/tags.yml b/modules/nf-core/bwamem2/index/tests/tags.yml new file mode 100644 index 00000000..3953018e --- /dev/null +++ b/modules/nf-core/bwamem2/index/tests/tags.yml @@ -0,0 +1,2 @@ +bwamem2/index: + - modules/nf-core/bwamem2/index/** diff --git a/modules/nf-core/bwamem2/mem/main.nf b/modules/nf-core/bwamem2/mem/main.nf index 29f90778..729428c4 100644 --- a/modules/nf-core/bwamem2/mem/main.nf +++ b/modules/nf-core/bwamem2/mem/main.nf @@ -10,11 +10,16 @@ process BWAMEM2_MEM { input: tuple val(meta), path(reads) tuple val(meta2), path(index) + tuple val(meta3), path(fasta) val sort_bam output: - tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions + tuple val(meta), path("*.sam") , emit: sam , optional:true + tuple val(meta), path("*.bam") , emit: bam , optional:true + tuple val(meta), path("*.cram") , emit: cram, optional:true + tuple val(meta), path("*.crai") , emit: crai, optional:true + tuple val(meta), path("*.csi") , emit: csi , optional:true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -24,6 +29,13 @@ process BWAMEM2_MEM { def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def samtools_command = sort_bam ? 'sort' : 'view' + + def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + """ INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'` @@ -33,7 +45,7 @@ process BWAMEM2_MEM { -t $task.cpus \\ \$INDEX \\ $reads \\ - | samtools $samtools_command $args2 -@ $task.cpus -o ${prefix}.bam - + | samtools $samtools_command $args2 -@ $task.cpus ${reference} -o ${prefix}.${extension} - cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -43,9 +55,28 @@ process BWAMEM2_MEM { """ stub: + + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def samtools_command = sort_bam ? 'sort' : 'view' + def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + + def create_index = "" + if (extension == "cram") { + create_index = "touch ${prefix}.crai" + } else if (extension == "bam") { + create_index = "touch ${prefix}.csi" + } + """ - touch ${prefix}.bam + touch ${prefix}.${extension} + ${create_index} + cat <<-END_VERSIONS > versions.yml "${task.process}": bwamem2: \$(echo \$(bwa-mem2 version 2>&1) | sed 's/.* //') diff --git a/modules/nf-core/bwamem2/mem/meta.yml b/modules/nf-core/bwamem2/mem/meta.yml index 04891b26..931f7129 100644 --- a/modules/nf-core/bwamem2/mem/meta.yml +++ b/modules/nf-core/bwamem2/mem/meta.yml @@ -37,6 +37,15 @@ input: type: file description: BWA genome index files pattern: "Directory containing BWA index *.{0132,amb,ann,bwt.2bit.64,pac}" + - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference genome in FASTA format + pattern: "*.{fa,fasta,fna}" - sort_bam: type: boolean description: use samtools sort (true) or samtools view (false) @@ -47,15 +56,33 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - sam: + type: file + description: Output SAM file containing read alignments + pattern: "*.{sam}" - bam: type: file description: Output BAM file containing read alignments pattern: "*.{bam}" + - cram: + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + - crai: + type: file + description: Index file for CRAM file + pattern: "*.{crai}" + - csi: + type: file + description: Index file for BAM file + pattern: "*.{csi}" - versions: type: file description: File containing software versions pattern: "versions.yml" authors: - "@maxulysse" + - "@matthdsm" maintainers: - "@maxulysse" + - "@matthdsm" diff --git a/modules/nf-core/bwamem2/mem/tests/main.nf.test b/modules/nf-core/bwamem2/mem/tests/main.nf.test index 365a0c43..5e67f70b 100644 --- a/modules/nf-core/bwamem2/mem/tests/main.nf.test +++ b/modules/nf-core/bwamem2/mem/tests/main.nf.test @@ -10,7 +10,7 @@ nextflow_process { tag "bwamem2/mem" tag "bwamem2/index" - test("sarscov2 - fastq, index, false") { + test("sarscov2 - fastq, index, fasta, false") { setup { run("BWAMEM2_INDEX") { @@ -34,7 +34,8 @@ nextflow_process { [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = false + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = false """ } } @@ -51,7 +52,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, true") { + test("sarscov2 - fastq, index, fasta, true") { setup { run("BWAMEM2_INDEX") { @@ -75,7 +76,8 @@ nextflow_process { [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = true + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true """ } } @@ -92,7 +94,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, false") { + test("sarscov2 - [fastq1, fastq2], index, fasta, false") { setup { run("BWAMEM2_INDEX") { @@ -119,7 +121,8 @@ nextflow_process { ] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = false + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = false """ } } @@ -136,7 +139,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true") { setup { run("BWAMEM2_INDEX") { @@ -163,7 +166,8 @@ nextflow_process { ] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = true + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true """ } } @@ -180,7 +184,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true - stub") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true - stub") { options "-stub" @@ -209,7 +213,8 @@ nextflow_process { ] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = true + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true """ } } diff --git a/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap b/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap index 84be71c6..9fb1e69d 100644 --- a/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap +++ b/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "sarscov2 - [fastq1, fastq2], index, true": { + "sarscov2 - [fastq1, fastq2], index, fasta, false": { "content": [ "test.bam", [ @@ -8,11 +8,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:30:22.691288603" + "timestamp": "2024-03-19T13:13:18.890289958" }, - "sarscov2 - [fastq1, fastq2], index, false": { + "sarscov2 - [fastq1, fastq2], index, fasta, true - stub": { "content": [ "test.bam", [ @@ -21,11 +21,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:30:11.276168706" + "timestamp": "2024-03-19T13:45:51.821633029" }, - "sarscov2 - [fastq1, fastq2], index, true - stub": { + "sarscov2 - [fastq1, fastq2], index, fasta, true": { "content": [ "test.bam", [ @@ -34,11 +34,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:30:32.07431961" + "timestamp": "2024-03-19T13:13:36.458291078" }, - "sarscov2 - fastq, index, false": { + "sarscov2 - fastq, index, fasta, false": { "content": [ "test.bam", [ @@ -47,11 +47,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:29:48.586760544" + "timestamp": "2024-03-19T13:12:44.084654507" }, - "sarscov2 - fastq, index, true": { + "sarscov2 - fastq, index, fasta, true": { "content": [ "test.bam", [ @@ -60,8 +60,8 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:29:59.846686393" + "timestamp": "2024-03-19T13:13:01.763341681" } } \ No newline at end of file diff --git a/modules/nf-core/bwameme/index/environment.yml b/modules/nf-core/bwameme/index/environment.yml new file mode 100644 index 00000000..5d76ea18 --- /dev/null +++ b/modules/nf-core/bwameme/index/environment.yml @@ -0,0 +1,7 @@ +name: "bwameme_index" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::bwa-meme=1.0.6" diff --git a/modules/nf-core/bwameme/index/main.nf b/modules/nf-core/bwameme/index/main.nf new file mode 100644 index 00000000..870f494c --- /dev/null +++ b/modules/nf-core/bwameme/index/main.nf @@ -0,0 +1,61 @@ +process BWAMEME_INDEX { + tag "$fasta" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/bwa-meme:1.0.6--hdcf5f25_2': + 'biocontainers/bwa-meme:1.0.6--hdcf5f25_2' }" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("bwameme"), emit: index + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${fasta}" + def VERSION = '1.0.6' // WARN: Version information provided by tool on CLI is incorrect. Please update this string when bumping container versions. + """ + mkdir bwameme + + bwa-meme index \\ + $args \\ + -t $task.cpus \\ + -p bwameme/$prefix \\ + $fasta + + build_rmis_dna.sh bwameme/$prefix + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bwameme: $VERSION + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${fasta}" + def VERSION = '1.0.6' // WARN: Version information provided by tool on CLI is incorrect. Please update this string when bumping container versions. + """ + mkdir bwameme + touch bwameme/${prefix}.0123 + touch bwameme/${prefix}.ann + touch bwameme/${prefix}.pac + touch bwameme/${prefix}.amb + touch bwameme/${prefix}.pos_packed + touch bwameme/${prefix}.suffixarray_uint64 + touch bwameme/${prefix}.suffixarray_uint64_L0_PARAMETERS + touch bwameme/${prefix}.suffixarray_uint64_L1_PARAMETERS + touch bwameme/${prefix}.suffixarray_uint64_L2_PARAMETERS + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bwameme: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/bwameme/index/meta.yml b/modules/nf-core/bwameme/index/meta.yml new file mode 100644 index 00000000..2db1d3a8 --- /dev/null +++ b/modules/nf-core/bwameme/index/meta.yml @@ -0,0 +1,44 @@ +name: "bwameme_index" +description: Create BWA-MEME index for reference genome +keywords: + - index + - fasta + - genome + - reference +tools: + - "bwameme": + description: "Faster BWA-MEM2 using learned-index" + homepage: https://github.com/kaist-ina/BWA-MEME + documentation: https://github.com/kaist-ina/BWA-MEME#getting-started + doi: "10.1093/bioinformatics/btac137" + licence: ["MIT"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - fasta: + type: file + description: Input genome fasta file + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - index: + type: file + description: BWA-MEME genome index files + pattern: "*.{0123,amb,ann,pac,pos_packed,suffixarray_uint64,suffixarray_uint64_L0_PARAMETERS,suffixarray_uint64_L1_PARAMETERS,suffixarray_uint64_L2_PARAMETERS}" + +authors: + - "@ramprasadn" +maintainers: + - "@ramprasadn" diff --git a/modules/nf-core/bwameme/index/tests/main.nf.test b/modules/nf-core/bwameme/index/tests/main.nf.test new file mode 100644 index 00000000..b61f7660 --- /dev/null +++ b/modules/nf-core/bwameme/index/tests/main.nf.test @@ -0,0 +1,59 @@ +nextflow_process { + + name "Test Process BWAMEME_INDEX" + script "../main.nf" + process "BWAMEME_INDEX" + + tag "modules" + tag "modules_nfcore" + tag "bwameme" + tag "bwameme/index" + + config "./nextflow.config" + + test("BWAMEME index") { + + when { + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("BWAMEME index - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/bwameme/index/tests/main.nf.test.snap b/modules/nf-core/bwameme/index/tests/main.nf.test.snap new file mode 100644 index 00000000..e608af8b --- /dev/null +++ b/modules/nf-core/bwameme/index/tests/main.nf.test.snap @@ -0,0 +1,108 @@ +{ + "BWAMEME index - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "genome.fasta.0123:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.amb:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.ann:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.pac:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.pos_packed:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + "versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d" + ], + "index": [ + [ + { + "id": "test" + }, + [ + "genome.fasta.0123:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.amb:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.ann:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.pac:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.pos_packed:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions": [ + "versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T13:44:38.551252246" + }, + "BWAMEME index": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "genome.fasta.0123:md5,b02870de80106104abcb03cd9463e7d8", + "genome.fasta.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", + "genome.fasta.ann:md5,c32e11f6c859f166c7525a9c1d583567", + "genome.fasta.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66", + "genome.fasta.pos_packed:md5,3534bc04a547d02d6e4cb50908a40db9", + "genome.fasta.suffixarray_uint64:md5,51abb48f687661f88bf5bf5d370521e3", + "genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,ad6397d3d33bbb6a31b1320349e23274", + "genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,6c0d6dc7e733a7f373aa7b2730621aa4", + "genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,b2d4bad4e9f0e8960a0af12b7038ab1e" + ] + ] + ], + "1": [ + "versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d" + ], + "index": [ + [ + { + "id": "test" + }, + [ + "genome.fasta.0123:md5,b02870de80106104abcb03cd9463e7d8", + "genome.fasta.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", + "genome.fasta.ann:md5,c32e11f6c859f166c7525a9c1d583567", + "genome.fasta.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66", + "genome.fasta.pos_packed:md5,3534bc04a547d02d6e4cb50908a40db9", + "genome.fasta.suffixarray_uint64:md5,51abb48f687661f88bf5bf5d370521e3", + "genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,ad6397d3d33bbb6a31b1320349e23274", + "genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,6c0d6dc7e733a7f373aa7b2730621aa4", + "genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,b2d4bad4e9f0e8960a0af12b7038ab1e" + ] + ] + ], + "versions": [ + "versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T13:44:25.040725565" + } +} \ No newline at end of file diff --git a/modules/nf-core/bwameme/index/tests/nextflow.config b/modules/nf-core/bwameme/index/tests/nextflow.config new file mode 100644 index 00000000..5934b7d1 --- /dev/null +++ b/modules/nf-core/bwameme/index/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: BWAMEME_INDEX { + ext.args = '-a meme' + } + +} diff --git a/modules/nf-core/bwameme/index/tests/tags.yml b/modules/nf-core/bwameme/index/tests/tags.yml new file mode 100644 index 00000000..ddbcab04 --- /dev/null +++ b/modules/nf-core/bwameme/index/tests/tags.yml @@ -0,0 +1,2 @@ +bwameme/index: + - "modules/nf-core/bwameme/index/**" diff --git a/modules/nf-core/bwameme/mem/environment.yml b/modules/nf-core/bwameme/mem/environment.yml new file mode 100644 index 00000000..388eedd2 --- /dev/null +++ b/modules/nf-core/bwameme/mem/environment.yml @@ -0,0 +1,11 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "bwameme_mem" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::bwa-meme=1.0.6" + - "bioconda::mbuffer=20160228" + - "bioconda::samtools=1.20" diff --git a/modules/nf-core/bwameme/mem/main.nf b/modules/nf-core/bwameme/mem/main.nf new file mode 100644 index 00000000..db41316e --- /dev/null +++ b/modules/nf-core/bwameme/mem/main.nf @@ -0,0 +1,94 @@ +process BWAMEME_MEM { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mulled-v2-ed29b84fa94419f5a7bf6a841ddbcb964768825b:139b5e403886ad278b9ad139174967441c1c6ff3-0': + 'biocontainers/mulled-v2-ed29b84fa94419f5a7bf6a841ddbcb964768825b:139b5e403886ad278b9ad139174967441c1c6ff3-0' }" + + input: + tuple val(meta), path(reads) + tuple val(meta2), path(index) + tuple val(meta3), path(fasta) + val sort_bam + + output: + tuple val(meta), path("*.sam") , emit: sam , optional:true + tuple val(meta), path("*.bam") , emit: bam , optional:true + tuple val(meta), path("*.cram") , emit: cram, optional:true + tuple val(meta), path("*.crai") , emit: crai, optional:true + tuple val(meta), path("*.csi") , emit: csi , optional:true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def samtools_command = sort_bam ? 'sort' : 'view' + def mbuffer_mem = 3072 + if (!task.memory) { + log.info '[bwameme-mbuffer] Available memory not known - defaulting to 3GB for mbuffer. Specify process memory requirements to change this.' + } else { + mbuffer_mem = (task.memory.mega*0.5).intValue() + } + def mbuffer_command = sort_bam ? "| mbuffer -m ${mbuffer_mem}M" : "" + def mem_per_thread = sort_bam ? "-m "+ (mbuffer_mem/task.cpus).intValue()+"M" : "" + def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + def VERSION = '1.0.6' // WARN: Version information provided by tool on CLI is incorrect. Please update this string when bumping container versions. + """ + INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'` + + bwa-meme \\ + mem \\ + $args \\ + -t $task.cpus \\ + \$INDEX \\ + $reads \\ + $mbuffer_command \\ + | samtools $samtools_command $args2 $mem_per_thread -@ $task.cpus ${reference} -o ${prefix}.${extension} - + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bwameme: $VERSION + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS + """ + + stub: + + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def samtools_command = sort_bam ? 'sort' : 'view' + def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + + def create_index = "" + if (extension == "cram") { + create_index = "touch ${prefix}.crai" + } else if (extension == "bam") { + create_index = "touch ${prefix}.csi" + } + def VERSION = '1.0.6' // WARN: Version information provided by tool on CLI is incorrect. Please update this string when bumping container versions. + """ + touch ${prefix}.${extension} + ${create_index} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bwameme: $VERSION + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + END_VERSIONS + """ +} diff --git a/modules/nf-core/bwameme/mem/meta.yml b/modules/nf-core/bwameme/mem/meta.yml new file mode 100644 index 00000000..c7eb7b28 --- /dev/null +++ b/modules/nf-core/bwameme/mem/meta.yml @@ -0,0 +1,90 @@ +name: "bwameme_mem" +description: Performs fastq alignment to a fasta reference using BWA-MEME +keywords: + - mem + - bwa + - bwamem2 + - bwameme + - alignment + - map + - fastq + - bam + - sam + - cram +tools: + - "bwameme": + description: "Faster BWA-MEM2 using learned-index" + homepage: https://github.com/kaist-ina/BWA-MEME + documentation: https://github.com/kaist-ina/BWA-MEME#getting-started + doi: "10.1093/bioinformatics/btac137" + licence: ["MIT"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + - meta2: + type: map + description: | + Groovy Map containing reference/index information + e.g. [ id:'test' ] + - index: + type: file + description: BWA genome index files + pattern: "Directory containing BWA index *.{0132,amb,ann,bwt.2bit.64,pac}" + - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference genome in FASTA format + pattern: "*.{fa,fasta,fna}" + - sort_bam: + type: boolean + description: use samtools sort (true) or samtools view (false) + pattern: "true or false" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - sam: + type: file + description: Output SAM file containing read alignments + pattern: "*.{sam}" + - bam: + type: file + description: Output BAM file containing read alignments + pattern: "*.{bam}" + - cram: + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + - crai: + type: file + description: Index file for CRAM file + pattern: "*.{crai}" + - csi: + type: file + description: Index file for BAM file + pattern: "*.{csi}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@ramprasadn" +maintainers: + - "@ramprasadn" diff --git a/modules/nf-core/bwameme/mem/tests/main.nf.test b/modules/nf-core/bwameme/mem/tests/main.nf.test new file mode 100644 index 00000000..3b67b39e --- /dev/null +++ b/modules/nf-core/bwameme/mem/tests/main.nf.test @@ -0,0 +1,239 @@ +nextflow_process { + + name "Test Process BWAMEME_MEM" + script "../main.nf" + process "BWAMEME_MEM" + + tag "modules" + tag "modules_nfcore" + tag "bwameme" + tag "bwameme/mem" + tag "bwameme/index" + config "./nextflow.config" + + test("sarscov2 - fastq, index, fasta, false") { + + setup { + run("BWAMEME_INDEX") { + script "../../index/main.nf" + config "./nextflow.config" + process { + """ + input[0] = Channel.of([ + [:], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ]) + """ + } + } + } + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)] + ]) + input[1] = BWAMEME_INDEX.out.index + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastq, index, fasta, true") { + + setup { + run("BWAMEME_INDEX") { + script "../../index/main.nf" + config "./nextflow.config" + process { + """ + input[0] = Channel.of([ + [:], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ]) + """ + } + } + } + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)] + ]) + input[1] = BWAMEME_INDEX.out.index + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - [fastq1, fastq2], index, fasta, false") { + + setup { + run("BWAMEME_INDEX") { + script "../../index/main.nf" + config "./nextflow.config" + process { + """ + input[0] = Channel.of([ + [:], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ]) + """ + } + } + } + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = BWAMEME_INDEX.out.index + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - [fastq1, fastq2], index, fasta, true") { + + setup { + run("BWAMEME_INDEX") { + script "../../index/main.nf" + config "./nextflow.config" + process { + """ + input[0] = Channel.of([ + [:], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ]) + """ + } + } + } + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = BWAMEME_INDEX.out.index + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - [fastq1, fastq2], index, fasta, true - stub") { + + options "-stub" + + setup { + run("BWAMEME_INDEX") { + script "../../index/main.nf" + config "./nextflow.config" + process { + """ + input[0] = Channel.of([ + [:], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ]) + """ + } + } + } + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = BWAMEME_INDEX.out.index + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + process.out.versions + ).match() } + ) + } + + } +} \ No newline at end of file diff --git a/modules/nf-core/bwameme/mem/tests/main.nf.test.snap b/modules/nf-core/bwameme/mem/tests/main.nf.test.snap new file mode 100644 index 00000000..281011ae --- /dev/null +++ b/modules/nf-core/bwameme/mem/tests/main.nf.test.snap @@ -0,0 +1,67 @@ +{ + "sarscov2 - [fastq1, fastq2], index, fasta, false": { + "content": [ + "test.bam", + [ + "versions.yml:md5,700d57071f430eb29b3c67d0a199eb95" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T20:04:31.962017214" + }, + "sarscov2 - [fastq1, fastq2], index, fasta, true - stub": { + "content": [ + "test.bam", + [ + "versions.yml:md5,700d57071f430eb29b3c67d0a199eb95" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T19:28:46.895668666" + }, + "sarscov2 - [fastq1, fastq2], index, fasta, true": { + "content": [ + "test.bam", + [ + "versions.yml:md5,700d57071f430eb29b3c67d0a199eb95" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T20:44:56.510177191" + }, + "sarscov2 - fastq, index, fasta, false": { + "content": [ + "test.bam", + [ + "versions.yml:md5,700d57071f430eb29b3c67d0a199eb95" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T20:00:05.782384898" + }, + "sarscov2 - fastq, index, fasta, true": { + "content": [ + "test.bam", + [ + "versions.yml:md5,700d57071f430eb29b3c67d0a199eb95" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-05-15T20:44:05.2657749" + } +} \ No newline at end of file diff --git a/modules/nf-core/bwameme/mem/tests/nextflow.config b/modules/nf-core/bwameme/mem/tests/nextflow.config new file mode 100644 index 00000000..e7dd707e --- /dev/null +++ b/modules/nf-core/bwameme/mem/tests/nextflow.config @@ -0,0 +1,9 @@ +process { + + withName: BWAMEME_INDEX { + ext.args = '-a meme' + } + withName: BWAMEME_MEM { + ext.args = '-7' + } +} diff --git a/modules/nf-core/bwameme/mem/tests/tags.yml b/modules/nf-core/bwameme/mem/tests/tags.yml new file mode 100644 index 00000000..9e3a26cf --- /dev/null +++ b/modules/nf-core/bwameme/mem/tests/tags.yml @@ -0,0 +1,2 @@ +bwameme/mem: + - "modules/nf-core/bwameme/mem/**" diff --git a/modules/nf-core/cadd/environment.yml b/modules/nf-core/cadd/environment.yml index 6a21f71e..26f170e9 100644 --- a/modules/nf-core/cadd/environment.yml +++ b/modules/nf-core/cadd/environment.yml @@ -4,6 +4,6 @@ channels: - bioconda - defaults dependencies: - - bioconda::cadd-scripts=1.6 - - anaconda::conda=4.14.0 + - bioconda::cadd-scripts=1.6.post1 + - conda-forge::conda=4.14.0 - conda-forge::mamba=1.4.0 diff --git a/modules/nf-core/cadd/main.nf b/modules/nf-core/cadd/main.nf index d4fab1f4..0af87f6e 100644 --- a/modules/nf-core/cadd/main.nf +++ b/modules/nf-core/cadd/main.nf @@ -3,14 +3,12 @@ process CADD { label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-8d145e7b16a8ca4bf920e6ca464763df6f0a56a2:d4e457a2edecb2b10e915c01d8f46e29e236b648-0': - 'biocontainers/mulled-v2-8d145e7b16a8ca4bf920e6ca464763df6f0a56a2:d4e457a2edecb2b10e915c01d8f46e29e236b648-0' }" + container 'docker.io/biocontainers/cadd-scripts-with-envs:1.6.post1_cv1' containerOptions { (workflow.containerEngine == 'singularity') ? - "--writable -B ${annotation_dir}:/usr/local/share/cadd-scripts-1.6-1/data/annotations" : - "--privileged -v ${annotation_dir}:/usr/local/share/cadd-scripts-1.6-1/data/annotations" + "-B ${annotation_dir}:/opt/CADD-scripts-1.6.post1/data/annotations" : + "-v ${annotation_dir}:/opt/CADD-scripts-1.6.post1/data/annotations" } input: @@ -27,7 +25,7 @@ process CADD { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = "1.6" // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. + def VERSION = "1.6.post1" // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. """ cadd.sh \\ -o ${prefix}.tsv.gz \\ @@ -43,7 +41,7 @@ process CADD { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = "1.6" // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. + def VERSION = "1.6.post1" // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. """ touch ${prefix}.tsv.gz diff --git a/modules/nf-core/cadd/meta.yml b/modules/nf-core/cadd/meta.yml index df84d237..230ed9c0 100644 --- a/modules/nf-core/cadd/meta.yml +++ b/modules/nf-core/cadd/meta.yml @@ -11,7 +11,8 @@ tools: documentation: "https://github.com/kircherlab/CADD-scripts/blob/master/README.md" tool_dev_url: "https://github.com/kircherlab/CADD-scripts/" doi: "10.1093/nar/gky1016" - licence: "['Restricted. Free for non-commercial users.']" + licence: + - Restricted. Free for non-commercial users. input: - meta: type: map diff --git a/modules/nf-core/deepvariant/README.md b/modules/nf-core/deepvariant/README.md new file mode 100644 index 00000000..ca112a7d --- /dev/null +++ b/modules/nf-core/deepvariant/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/deepvariant/README.html) recipe is not fully working as expected + +Hence, we are using the docker container provided by the authors of the tool: + +- [google/deepvariant](https://hub.docker.com/r/google/deepvariant) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/deepvariant) for convenience. diff --git a/modules/nf-core/deepvariant/environment.yml b/modules/nf-core/deepvariant/environment.yml deleted file mode 100644 index 648a76de..00000000 --- a/modules/nf-core/deepvariant/environment.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: deepvariant -channels: - - conda-forge - - bioconda - - defaults diff --git a/modules/nf-core/deepvariant/main.nf b/modules/nf-core/deepvariant/main.nf index 2d5c480c..507b6c11 100644 --- a/modules/nf-core/deepvariant/main.nf +++ b/modules/nf-core/deepvariant/main.nf @@ -2,6 +2,7 @@ process DEEPVARIANT { tag "$meta.id" label 'process_high' + //Conda is not supported at the moment container "nf-core/deepvariant:1.5.0" input: diff --git a/modules/nf-core/deepvariant/tests/main.nf.test b/modules/nf-core/deepvariant/tests/main.nf.test new file mode 100644 index 00000000..91612c1e --- /dev/null +++ b/modules/nf-core/deepvariant/tests/main.nf.test @@ -0,0 +1,117 @@ +nextflow_process { + + name "Test Process DEEPVARIANT" + script "../main.nf" + process "DEEPVARIANT" + + tag "deepvariant" + tag "modules" + tag "modules_nfcore" + + test("homo_sapiens - [bam, bai] - fasta - fai") { + when { + config "./nextflow.config" + + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), + [] + ] + input[1] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ + [],[] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("homo_sapiens - [cram, crai, genome_bed] - fasta - fai") { + config "./nextflow-intervals.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.bed', checkIfExists: true) + ] + input[1] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ + [],[] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("homo_sapiens - [bam, bai] - fasta_gz - fasta_gz_fai") { + when { + config "./nextflow.config" + + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true), + [] + ] + input[1] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.gz', checkIfExists: true) + ] + input[2] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.gz.fai', checkIfExists: true) + ] + input[3] = [ + [ id:'genome'], + file(params.modules_testdata_base_path + '/genomics/homo_sapiens/genome/genome.fasta.gz.gzi', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} \ No newline at end of file diff --git a/modules/nf-core/deepvariant/tests/main.nf.test.snap b/modules/nf-core/deepvariant/tests/main.nf.test.snap new file mode 100644 index 00000000..6ad76ae4 --- /dev/null +++ b/modules/nf-core/deepvariant/tests/main.nf.test.snap @@ -0,0 +1,269 @@ +{ + "homo_sapiens - [bam, bai] - fasta_gz - fasta_gz_fai": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz:md5,7cba1516f7cf0888765d5ee8caf275f4" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz.tbi:md5,02a78562bc83520a51010a01fb06f217" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz:md5,8d6ac08997bfd848a0a4d9d295e76952" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz.tbi:md5,37e2d8f4cca0a21113cede608f54885a" + ] + ], + "4": [ + "versions.yml:md5,4678f778b58276933b165fe3e84afc6a" + ], + "gvcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz:md5,8d6ac08997bfd848a0a4d9d295e76952" + ] + ], + "gvcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz.tbi:md5,37e2d8f4cca0a21113cede608f54885a" + ] + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz:md5,7cba1516f7cf0888765d5ee8caf275f4" + ] + ], + "vcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz.tbi:md5,02a78562bc83520a51010a01fb06f217" + ] + ], + "versions": [ + "versions.yml:md5,4678f778b58276933b165fe3e84afc6a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T13:54:42.757335334" + }, + "homo_sapiens - [bam, bai] - fasta - fai": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz:md5,7cba1516f7cf0888765d5ee8caf275f4" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz.tbi:md5,02a78562bc83520a51010a01fb06f217" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz:md5,8d6ac08997bfd848a0a4d9d295e76952" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz.tbi:md5,37e2d8f4cca0a21113cede608f54885a" + ] + ], + "4": [ + "versions.yml:md5,4678f778b58276933b165fe3e84afc6a" + ], + "gvcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz:md5,8d6ac08997bfd848a0a4d9d295e76952" + ] + ], + "gvcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz.tbi:md5,37e2d8f4cca0a21113cede608f54885a" + ] + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz:md5,7cba1516f7cf0888765d5ee8caf275f4" + ] + ], + "vcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz.tbi:md5,02a78562bc83520a51010a01fb06f217" + ] + ], + "versions": [ + "versions.yml:md5,4678f778b58276933b165fe3e84afc6a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T13:54:18.409489045" + }, + "homo_sapiens - [cram, crai, genome_bed] - fasta - fai": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz:md5,7cba1516f7cf0888765d5ee8caf275f4" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz.tbi:md5,02a78562bc83520a51010a01fb06f217" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz:md5,8d6ac08997bfd848a0a4d9d295e76952" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz.tbi:md5,37e2d8f4cca0a21113cede608f54885a" + ] + ], + "4": [ + "versions.yml:md5,4678f778b58276933b165fe3e84afc6a" + ], + "gvcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz:md5,8d6ac08997bfd848a0a4d9d295e76952" + ] + ], + "gvcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.g.vcf.gz.tbi:md5,37e2d8f4cca0a21113cede608f54885a" + ] + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz:md5,7cba1516f7cf0888765d5ee8caf275f4" + ] + ], + "vcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test_out.vcf.gz.tbi:md5,02a78562bc83520a51010a01fb06f217" + ] + ], + "versions": [ + "versions.yml:md5,4678f778b58276933b165fe3e84afc6a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T13:54:30.523871801" + } +} diff --git a/modules/nf-core/deepvariant/tests/nextflow-intervals.config b/modules/nf-core/deepvariant/tests/nextflow-intervals.config new file mode 100644 index 00000000..6d135f9f --- /dev/null +++ b/modules/nf-core/deepvariant/tests/nextflow-intervals.config @@ -0,0 +1,8 @@ +process { + + withName: DEEPVARIANT { + ext.args = '--model_type=WGS ' + ext.prefix = { "${meta.id}_out" } + } + +} diff --git a/modules/nf-core/deepvariant/tests/nextflow.config b/modules/nf-core/deepvariant/tests/nextflow.config new file mode 100644 index 00000000..d335d30b --- /dev/null +++ b/modules/nf-core/deepvariant/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + + withName: DEEPVARIANT { + ext.args = ' --regions=\"chr22:0-40001\" --model_type=WGS ' + ext.prefix = { "${meta.id}_out" } + } + +} diff --git a/modules/nf-core/deepvariant/tests/tags.yml b/modules/nf-core/deepvariant/tests/tags.yml new file mode 100644 index 00000000..8e838c7b --- /dev/null +++ b/modules/nf-core/deepvariant/tests/tags.yml @@ -0,0 +1,2 @@ +deepvariant: + - modules/nf-core/deepvariant/** diff --git a/modules/nf-core/expansionhunter/environment.yml b/modules/nf-core/expansionhunter/environment.yml index 76edd1ef..90a3bfff 100644 --- a/modules/nf-core/expansionhunter/environment.yml +++ b/modules/nf-core/expansionhunter/environment.yml @@ -1,7 +1,10 @@ name: expansionhunter + channels: - conda-forge - bioconda - defaults + dependencies: - bioconda::expansionhunter=5.0.0 + - bioconda::htslib=1.18 diff --git a/modules/nf-core/expansionhunter/main.nf b/modules/nf-core/expansionhunter/main.nf index bea5916a..dbcb175f 100644 --- a/modules/nf-core/expansionhunter/main.nf +++ b/modules/nf-core/expansionhunter/main.nf @@ -40,7 +40,7 @@ process EXPANSIONHUNTER { cat <<-END_VERSIONS > versions.yml "${task.process}": - expansionhunter: \$( echo \$(ExpansionHunter --version 2>&1) | sed 's/^.*ExpansionHunter v//') + expansionhunter: \$( echo \$(ExpansionHunter --version 2>&1) | head -1 | sed 's/^.*ExpansionHunter v//') bgzip: \$(echo \$(bgzip -h 2>&1) | sed 's/^.*Version: //;s/Usage:.*//') END_VERSIONS """ @@ -48,13 +48,13 @@ process EXPANSIONHUNTER { stub: def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.vcf.gz - touch ${prefix}.json.gz + echo "" | gzip > ${prefix}.vcf.gz + echo "" | gzip > ${prefix}.json.gz touch ${prefix}_realigned.bam cat <<-END_VERSIONS > versions.yml "${task.process}": - expansionhunter: \$( echo \$(ExpansionHunter --version 2>&1) | sed 's/^.*ExpansionHunter v//') + expansionhunter: \$( echo \$(ExpansionHunter --version 2>&1) | head -1 | sed 's/^.*ExpansionHunter v//') bgzip: \$(echo \$(bgzip -h 2>&1) | sed 's/^.*Version: //;s/Usage:.*//') END_VERSIONS """ diff --git a/modules/nf-core/expansionhunter/tests/main.nf.test b/modules/nf-core/expansionhunter/tests/main.nf.test index 6204460a..ef15e133 100644 --- a/modules/nf-core/expansionhunter/tests/main.nf.test +++ b/modules/nf-core/expansionhunter/tests/main.nf.test @@ -7,7 +7,7 @@ nextflow_process { tag "modules_nfcore" tag "expansionhunter" - test("expansionhunter") { + test("homo_sapiens - [bam,bai], fasta, fai, cat") { when { process { @@ -25,10 +25,35 @@ nextflow_process { then { assertAll( - {assert process.success}, - {assert path(process.out.vcf.get(0).get(1)).linesGzip.size() == 8}, - {assert path(process.out.json.get(0).get(1)).linesGzip.size() == 27}, - {assert snapshot(process.out.bam).match()} + {assert process.success}, + {assert snapshot(process.out).match("expansionhunter")} + ) + } + + } + + test("homo_sapiens - [bam,bai], fasta, fai, cat - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true), + ] + input[1] = [[id:'fasta'],file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)] + input[2] = [[id:'fasta_fai'],file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)] + input[3] = [[id:'catalogue'],file(params.test_data['homo_sapiens']['genome']['repeat_expansions'], checkIfExists: true)] + """ + } + } + + then { + assertAll( + {assert process.success}, + {assert snapshot(process.out).match("stub")} ) } diff --git a/modules/nf-core/expansionhunter/tests/main.nf.test.snap b/modules/nf-core/expansionhunter/tests/main.nf.test.snap index a98fb599..a4e09f4c 100644 --- a/modules/nf-core/expansionhunter/tests/main.nf.test.snap +++ b/modules/nf-core/expansionhunter/tests/main.nf.test.snap @@ -1,15 +1,132 @@ { "expansionhunter": { "content": [ - [ - [ - { - "id": "test" - }, - "test_realigned.bam:md5,b37a72c0b97b45e63636a9758f3144d7" + { + "0": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,cfd4a1d35c0e469b99eb6aaa6d22de76" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.json.gz:md5,60d7dc4662c837bba2715d54b64a9bfe" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test_realigned.bam:md5,b37a72c0b97b45e63636a9758f3144d7" + ] + ], + "3": [ + "versions.yml:md5,056b525f67ba23c361f0c65f47256dca" + ], + "bam": [ + [ + { + "id": "test" + }, + "test_realigned.bam:md5,b37a72c0b97b45e63636a9758f3144d7" + ] + ], + "json": [ + [ + { + "id": "test" + }, + "test.json.gz:md5,60d7dc4662c837bba2715d54b64a9bfe" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,cfd4a1d35c0e469b99eb6aaa6d22de76" + ] + ], + "versions": [ + "versions.yml:md5,056b525f67ba23c361f0c65f47256dca" ] - ] + } ], - "timestamp": "2024-01-26T17:35:10.45442497" + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T12:20:15.18545069" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.json.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test_realigned.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,056b525f67ba23c361f0c65f47256dca" + ], + "bam": [ + [ + { + "id": "test" + }, + "test_realigned.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test" + }, + "test.json.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,056b525f67ba23c361f0c65f47256dca" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.03.0" + }, + "timestamp": "2024-05-03T12:20:28.430115" } } \ No newline at end of file diff --git a/modules/nf-core/fastp/main.nf b/modules/nf-core/fastp/main.nf index 2a3b679e..4fc19b74 100644 --- a/modules/nf-core/fastp/main.nf +++ b/modules/nf-core/fastp/main.nf @@ -29,7 +29,7 @@ process FASTP { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def adapter_list = adapter_fasta ? "--adapter_fasta ${adapter_fasta}" : "" - def fail_fastq = save_trimmed_fail && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : save_trimmed_fail && !meta.single_end ? "--unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : '' + def fail_fastq = save_trimmed_fail && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : save_trimmed_fail && !meta.single_end ? "--failed_out ${prefix}.paired.fail.fastq.gz --unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : '' // Added soft-links to original fastqs for consistent naming in MultiQC // Use single ended for interleaved. Add --interleaved_in in config. if ( task.ext.args?.contains('--interleaved_in') ) { diff --git a/modules/nf-core/fastp/tests/main.nf.test b/modules/nf-core/fastp/tests/main.nf.test index 9b3f9a38..6f1f4897 100644 --- a/modules/nf-core/fastp/tests/main.nf.test +++ b/modules/nf-core/fastp/tests/main.nf.test @@ -251,7 +251,8 @@ nextflow_process { } test("fastp test_fastp_interleaved") { - config './nextflow.config' + + config './nextflow.interleaved.config' when { params { outdir = "$outputDir" @@ -277,7 +278,7 @@ nextflow_process { def html_text = [ "Q20 bases:25.719000 K (93.033098%)", "paired end (151 cycles + 151 cycles)"] def log_text = [ "Q20 bases: 12922(92.9841%)", - "reads passed filter: 198"] + "reads passed filter: 162"] def read_lines = [ "@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads_fail.get(0).get(1).get(1)).linesGzip.contains(failed_read2_line) } + { assert path(process.out.reads_fail.get(0).get(1).get(2)).linesGzip.contains(failed_read2_line) } } }, { html_text.each { html_part -> diff --git a/modules/nf-core/fastp/tests/main.nf.test.snap b/modules/nf-core/fastp/tests/main.nf.test.snap index b4c0e1dd..3e876288 100644 --- a/modules/nf-core/fastp/tests/main.nf.test.snap +++ b/modules/nf-core/fastp/tests/main.nf.test.snap @@ -7,7 +7,7 @@ "id": "test", "single_end": true }, - "test.fastp.json:md5,168f516f7bd4b7b6c32da7cba87299a4" + "test.fastp.json:md5,b24e0624df5cc0b11cd5ba21b726fb22" ] ] ], @@ -15,7 +15,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-17T18:08:06.123035" + "timestamp": "2024-03-18T16:19:15.063001" }, "test_fastp_paired_end_merged-for_stub_match": { "content": [ @@ -65,7 +65,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-17T18:06:00.223817" + "timestamp": "2024-03-18T16:18:43.526412" }, "versions_paired_end": { "content": [ @@ -112,7 +112,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-01T12:03:37.827323085" + "timestamp": "2024-03-18T16:19:15.111894" }, "test_fastp_paired_end_merged_match": { "content": [ @@ -283,7 +283,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-01T11:57:30.791982648" + "timestamp": "2024-03-18T16:18:43.580336" }, "versions_paired_end_merged_adapterlist": { "content": [ diff --git a/modules/nf-core/fastp/tests/nextflow.interleaved.config b/modules/nf-core/fastp/tests/nextflow.interleaved.config new file mode 100644 index 00000000..4be8dbd2 --- /dev/null +++ b/modules/nf-core/fastp/tests/nextflow.interleaved.config @@ -0,0 +1,5 @@ +process { + withName: FASTP { + ext.args = "--interleaved_in -e 30" + } +} diff --git a/modules/nf-core/fastp/tests/nextflow.config b/modules/nf-core/fastp/tests/nextflow.save_failed.config similarity index 50% rename from modules/nf-core/fastp/tests/nextflow.config rename to modules/nf-core/fastp/tests/nextflow.save_failed.config index 0f7849ad..53b61b0c 100644 --- a/modules/nf-core/fastp/tests/nextflow.config +++ b/modules/nf-core/fastp/tests/nextflow.save_failed.config @@ -1,6 +1,5 @@ process { - withName: FASTP { - ext.args = "--interleaved_in" + ext.args = "-e 30" } } diff --git a/modules/nf-core/fastqc/main.nf b/modules/nf-core/fastqc/main.nf index 9e19a74c..d79f1c86 100644 --- a/modules/nf-core/fastqc/main.nf +++ b/modules/nf-core/fastqc/main.nf @@ -25,6 +25,11 @@ process FASTQC { def old_new_pairs = reads instanceof Path || reads.size() == 1 ? [[ reads, "${prefix}.${reads.extension}" ]] : reads.withIndex().collect { entry, index -> [ entry, "${prefix}_${index + 1}.${entry.extension}" ] } def rename_to = old_new_pairs*.join(' ').join(' ') def renamed_files = old_new_pairs.collect{ old_name, new_name -> new_name }.join(' ') + + def memory_in_mb = MemoryUnit.of("${task.memory}").toUnit('MB') + // FastQC memory value allowed range (100 - 10000) + def fastqc_memory = memory_in_mb > 10000 ? 10000 : (memory_in_mb < 100 ? 100 : memory_in_mb) + """ printf "%s %s\\n" $rename_to | while read old_name new_name; do [ -f "\${new_name}" ] || ln -s \$old_name \$new_name @@ -33,6 +38,7 @@ process FASTQC { fastqc \\ $args \\ --threads $task.cpus \\ + --memory $fastqc_memory \\ $renamed_files cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test new file mode 100644 index 00000000..2289f73f --- /dev/null +++ b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test @@ -0,0 +1,38 @@ +nextflow_process { + + name "Test Process GATK4_BEDTOINTERVALLIST" + script "../main.nf" + process "GATK4_BEDTOINTERVALLIST" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/bedtointervallist" + + test("test_gatk4_bedtointervallist") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + [file(params.modules_testdata_base_path + + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) ] + ] + input[1] = [ [ id:'dict' ], // meta map + [file(params.modules_testdata_base_path + + 'genomics/sarscov2/genome/genome.dict', checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap new file mode 100644 index 00000000..48c322fd --- /dev/null +++ b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "test_gatk4_bedtointervallist": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.interval_list:md5,e51101c9357fb2d59fd30e370eefa39c" + ] + ], + "1": [ + "versions.yml:md5,29a18c36f27584eb5a5f2f5457088b3b" + ], + "interval_list": [ + [ + { + "id": "test" + }, + "test.interval_list:md5,e51101c9357fb2d59fd30e370eefa39c" + ] + ], + "versions": [ + "versions.yml:md5,29a18c36f27584eb5a5f2f5457088b3b" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T14:20:12.168775" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/bedtointervallist/tests/tags.yml b/modules/nf-core/gatk4/bedtointervallist/tests/tags.yml new file mode 100644 index 00000000..b4d54f12 --- /dev/null +++ b/modules/nf-core/gatk4/bedtointervallist/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/bedtointervallist: + - "modules/nf-core/gatk4/bedtointervallist/**" diff --git a/modules/nf-core/gatk4/createsequencedictionary/tests/main.nf.test b/modules/nf-core/gatk4/createsequencedictionary/tests/main.nf.test new file mode 100644 index 00000000..a8a9c6d2 --- /dev/null +++ b/modules/nf-core/gatk4/createsequencedictionary/tests/main.nf.test @@ -0,0 +1,56 @@ +nextflow_process { + + name "Test Process GATK4_CREATESEQUENCEDICTIONARY" + script "../main.nf" + process "GATK4_CREATESEQUENCEDICTIONARY" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/createsequencedictionary" + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gatk4/createsequencedictionary/tests/main.nf.test.snap b/modules/nf-core/gatk4/createsequencedictionary/tests/main.nf.test.snap new file mode 100644 index 00000000..16735f95 --- /dev/null +++ b/modules/nf-core/gatk4/createsequencedictionary/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "genome.dict:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,e60dd34a71fc2029d81dc67ccb5d6be6" + ], + "dict": [ + [ + { + "id": "test" + }, + "genome.dict:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e60dd34a71fc2029d81dc67ccb5d6be6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-16T10:16:16.34453" + }, + "sarscov2 - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "genome.dict:md5,7362679f176e0f52add03c08f457f646" + ] + ], + "1": [ + "versions.yml:md5,e60dd34a71fc2029d81dc67ccb5d6be6" + ], + "dict": [ + [ + { + "id": "test" + }, + "genome.dict:md5,7362679f176e0f52add03c08f457f646" + ] + ], + "versions": [ + "versions.yml:md5,e60dd34a71fc2029d81dc67ccb5d6be6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-16T13:58:25.822068" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/createsequencedictionary/tests/tags.yml b/modules/nf-core/gatk4/createsequencedictionary/tests/tags.yml new file mode 100644 index 00000000..035c5e4c --- /dev/null +++ b/modules/nf-core/gatk4/createsequencedictionary/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/createsequencedictionary: + - "modules/nf-core/gatk4/createsequencedictionary/**" diff --git a/modules/nf-core/gatk4/determinegermlinecontigploidy/README.md b/modules/nf-core/gatk4/determinegermlinecontigploidy/README.md new file mode 100644 index 00000000..c6a45456 --- /dev/null +++ b/modules/nf-core/gatk4/determinegermlinecontigploidy/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. diff --git a/modules/nf-core/gatk4/filtermutectcalls/main.nf b/modules/nf-core/gatk4/filtermutectcalls/main.nf index 38dd44c7..0532ec02 100644 --- a/modules/nf-core/gatk4/filtermutectcalls/main.nf +++ b/modules/nf-core/gatk4/filtermutectcalls/main.nf @@ -59,7 +59,7 @@ process GATK4_FILTERMUTECTCALLS { stub: def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.vcf.gz + echo "" | gzip > ${prefix}.vcf.gz touch ${prefix}.vcf.gz.tbi touch ${prefix}.vcf.gz.filteringStats.tsv diff --git a/modules/nf-core/gatk4/filtermutectcalls/tests/main.nf.test b/modules/nf-core/gatk4/filtermutectcalls/tests/main.nf.test new file mode 100644 index 00000000..83c3703f --- /dev/null +++ b/modules/nf-core/gatk4/filtermutectcalls/tests/main.nf.test @@ -0,0 +1,176 @@ +nextflow_process { + + name "Test Process GATK4_FILTERMUTECTCALLS" + script "../main.nf" + process "GATK4_FILTERMUTECTCALLS" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/filtermutectcalls" + + test("human - vcf - base") { + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.stats', checkIfExists: true), + [], + [], + [], + [] + ] + + input[1] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) + ] + input[2] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match("versions_base") }, + { assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }, + { assert path(process.out.tbi.get(0).get(1)).linesGzip.toString().contains("TBI")}, + { assert snapshot(file(process.out.stats.get(0).get(1)).readLines()[0]).match() } + ) + } + + } + + test("human - vcf - with-files") { + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.stats', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test_test2_paired_mutect2_calls.artifact-prior.tar.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test_test2_paired.segmentation.table', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test_test2_paired.contamination.table', checkIfExists: true), + [] + ] + + input[1] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) + ] + input[2] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match("versions_with-files") }, + { assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }, + { assert path(process.out.tbi.get(0).get(1)).linesGzip.toString().contains("TBI")}, + { assert snapshot(file(process.out.stats.get(0).get(1)).readLines()[0..5]).match() } + ) + } + + } + + test("human - vcf - use-val") { + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.stats', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test_test2_paired_mutect2_calls.artifact-prior.tar.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/test_test2_paired.segmentation.table', checkIfExists: true), + [], + '20.0' + ] + + input[1] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) + ] + input[2] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match("versions_use-val") }, + { assert path(process.out.vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.2") }, + { assert path(process.out.tbi.get(0).get(1)).linesGzip.toString().contains("TBI")}, + { assert snapshot(file(process.out.stats.get(0).get(1)).readLines()[0]).match() } + ) + } + + } + + test("human - vcf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.tbi', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gatk/paired_mutect2_calls/test_test2_paired_mutect2_calls.vcf.gz.stats', checkIfExists: true), + [], + [], + [], + [] + ] + + input[1] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) + ] + input[2] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.dict', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gatk4/filtermutectcalls/tests/main.nf.test.snap b/modules/nf-core/gatk4/filtermutectcalls/tests/main.nf.test.snap new file mode 100644 index 00000000..1c39e3b5 --- /dev/null +++ b/modules/nf-core/gatk4/filtermutectcalls/tests/main.nf.test.snap @@ -0,0 +1,140 @@ +{ + "human - vcf - use-val": { + "content": [ + "#Ln prior of deletion of length 10=-20.72326583694641" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:46:03.887912" + }, + "versions_with-files": { + "content": [ + [ + "versions.yml:md5,1e86368bd682668a6777ccf2cfd90689" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:45:43.679571" + }, + "human - vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.filtered.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.filtered.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.filtered.vcf.gz.filteringStats.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,1e86368bd682668a6777ccf2cfd90689" + ], + "stats": [ + [ + { + "id": "test" + }, + "test.filtered.vcf.gz.filteringStats.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tbi": [ + [ + { + "id": "test" + }, + "test.filtered.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.filtered.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,1e86368bd682668a6777ccf2cfd90689" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:46:32.666273" + }, + "versions_use-val": { + "content": [ + [ + "versions.yml:md5,1e86368bd682668a6777ccf2cfd90689" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:46:03.876073" + }, + "versions_base": { + "content": [ + [ + "versions.yml:md5,1e86368bd682668a6777ccf2cfd90689" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:47:39.930795" + }, + "human - vcf - with-files": { + "content": [ + [ + "#Ln prior of deletion of length 10=-20.72326583694641", + "#Ln prior of deletion of length 9=-20.72326583694641", + "#Ln prior of deletion of length 8=-20.72326583694641", + "#Ln prior of deletion of length 7=-20.72326583694641", + "#Ln prior of deletion of length 6=-20.72326583694641", + "#Ln prior of deletion of length 5=-20.72326583694641" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:45:43.699286" + }, + "human - vcf - base": { + "content": [ + "#Ln prior of deletion of length 10=-20.72326583694641" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-05-15T12:47:39.949405" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/filtermutectcalls/tests/nextflow.config b/modules/nf-core/gatk4/filtermutectcalls/tests/nextflow.config new file mode 100644 index 00000000..12fa58fb --- /dev/null +++ b/modules/nf-core/gatk4/filtermutectcalls/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: GATK4_FILTERMUTECTCALLS { + ext.prefix = { "${meta.id}.filtered" } + } +} diff --git a/modules/nf-core/gatk4/filtermutectcalls/tests/tags.yml b/modules/nf-core/gatk4/filtermutectcalls/tests/tags.yml new file mode 100644 index 00000000..44731031 --- /dev/null +++ b/modules/nf-core/gatk4/filtermutectcalls/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/filtermutectcalls: + - "modules/nf-core/gatk4/filtermutectcalls/**" diff --git a/modules/nf-core/gatk4/germlinecnvcaller/README.md b/modules/nf-core/gatk4/germlinecnvcaller/README.md new file mode 100644 index 00000000..c6a45456 --- /dev/null +++ b/modules/nf-core/gatk4/germlinecnvcaller/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. diff --git a/modules/nf-core/gatk4/germlinecnvcaller/gatk4-germlinecnvcaller.diff b/modules/nf-core/gatk4/germlinecnvcaller/gatk4-germlinecnvcaller.diff deleted file mode 100644 index c501e50e..00000000 --- a/modules/nf-core/gatk4/germlinecnvcaller/gatk4-germlinecnvcaller.diff +++ /dev/null @@ -1,14 +0,0 @@ -Changes in module 'nf-core/gatk4/germlinecnvcaller' ---- modules/nf-core/gatk4/germlinecnvcaller/main.nf -+++ modules/nf-core/gatk4/germlinecnvcaller/main.nf -@@ -36,7 +36,7 @@ - avail_mem = (task.memory.mega*0.8).intValue() - } - """ -- gatk --java-options "-Xmx${avail_mem}g" GermlineCNVCaller \\ -+ gatk --java-options "-Xmx${avail_mem}M" GermlineCNVCaller \\ - $input_list \\ - $ploidy_command \\ - $output_command \\ - -************************************************************ diff --git a/modules/nf-core/gatk4/germlinecnvcaller/main.nf b/modules/nf-core/gatk4/germlinecnvcaller/main.nf index 535b14c5..cd1916ec 100644 --- a/modules/nf-core/gatk4/germlinecnvcaller/main.nf +++ b/modules/nf-core/gatk4/germlinecnvcaller/main.nf @@ -39,7 +39,7 @@ process GATK4_GERMLINECNVCALLER { """ export THEANO_FLAGS="base_compiledir=\$PWD" - gatk --java-options "-Xmx${avail_mem}g -XX:-UsePerfData" \\ + gatk --java-options "-Xmx${avail_mem}M -XX:-UsePerfData" \\ GermlineCNVCaller \\ $input_list \\ $ploidy_command \\ diff --git a/modules/nf-core/gatk4/intervallisttools/tests/main.nf.test b/modules/nf-core/gatk4/intervallisttools/tests/main.nf.test new file mode 100644 index 00000000..2891bf9e --- /dev/null +++ b/modules/nf-core/gatk4/intervallisttools/tests/main.nf.test @@ -0,0 +1,72 @@ +nextflow_process { + + name "Test Process GATK4_INTERVALLISTTOOLS" + script "../main.nf" + process "GATK4_INTERVALLISTTOOLS" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/bedtointervallist" + tag "gatk4/intervallisttools" + + setup { + run("GATK4_BEDTOINTERVALLIST") { + script "../../bedtointervallist/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true)] + ] + input[1] = [ + [ id:'dict' ], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.dict', checkIfExists: true)] + ] + """ + } + } + } + + test("test_gatk4_intervallisttools") { + + when { + process { + """ + input[0] = GATK4_BEDTOINTERVALLIST.out.interval_list + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("test_gatk4_intervallisttools -stub") { + + options "-stub" + + when { + process { + """ + input[0] = GATK4_BEDTOINTERVALLIST.out.interval_list + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + +} diff --git a/modules/nf-core/gatk4/intervallisttools/tests/main.nf.test.snap b/modules/nf-core/gatk4/intervallisttools/tests/main.nf.test.snap new file mode 100644 index 00000000..7718ed00 --- /dev/null +++ b/modules/nf-core/gatk4/intervallisttools/tests/main.nf.test.snap @@ -0,0 +1,88 @@ +{ + "test_gatk4_intervallisttools": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "1scattered.interval_list:md5,64f6665f9fbd257e4a300ec602f4e995", + "2scattered.interval_list:md5,f515c3da0c6accfd8e7dc33df50855c5", + "3scattered.interval_list:md5,7a918e8c9211b54334587793e8cbae53", + "4scattered.interval_list:md5,1b93105227a7dc81f07101a1efd31498" + ] + ] + ], + "1": [ + "versions.yml:md5,ff682cc9ad70d65a80280df57b316b03" + ], + "interval_list": [ + [ + { + "id": "test" + }, + [ + "1scattered.interval_list:md5,64f6665f9fbd257e4a300ec602f4e995", + "2scattered.interval_list:md5,f515c3da0c6accfd8e7dc33df50855c5", + "3scattered.interval_list:md5,7a918e8c9211b54334587793e8cbae53", + "4scattered.interval_list:md5,1b93105227a7dc81f07101a1efd31498" + ] + ] + ], + "versions": [ + "versions.yml:md5,ff682cc9ad70d65a80280df57b316b03" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-05-22T21:26:22.252885" + }, + "test_gatk4_intervallisttools -stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "1scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e", + "2scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e", + "3scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e", + "4scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + "versions.yml:md5,ff682cc9ad70d65a80280df57b316b03" + ], + "interval_list": [ + [ + { + "id": "test" + }, + [ + "1scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e", + "2scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e", + "3scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e", + "4scattered.interval_list:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions": [ + "versions.yml:md5,ff682cc9ad70d65a80280df57b316b03" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-05-22T22:15:11.772344" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/intervallisttools/tests/nextflow.config b/modules/nf-core/gatk4/intervallisttools/tests/nextflow.config new file mode 100644 index 00000000..b24b20db --- /dev/null +++ b/modules/nf-core/gatk4/intervallisttools/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: GATK4_INTERVALLISTTOOLS { + ext.args = '--SCATTER_COUNT 6 --SUBDIVISION_MODE BALANCING_WITHOUT_INTERVAL_SUBDIVISION_WITH_OVERFLOW --UNIQUE true --SORT true' + } +} diff --git a/modules/nf-core/gatk4/intervallisttools/tests/tags.yml b/modules/nf-core/gatk4/intervallisttools/tests/tags.yml new file mode 100644 index 00000000..bf85ff5f --- /dev/null +++ b/modules/nf-core/gatk4/intervallisttools/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/intervallisttools: + - "modules/nf-core/gatk4/intervallisttools/**" diff --git a/modules/nf-core/gatk4/mutect2/tests/f1r2.config b/modules/nf-core/gatk4/mutect2/tests/f1r2.config new file mode 100644 index 00000000..2d3c8a17 --- /dev/null +++ b/modules/nf-core/gatk4/mutect2/tests/f1r2.config @@ -0,0 +1,3 @@ +process { + ext.args = { "--normal-sample $meta.normal_id --f1r2-tar-gz ${meta.id}.f1r2.tar.gz" } +} diff --git a/modules/nf-core/gatk4/mutect2/tests/main.nf.test b/modules/nf-core/gatk4/mutect2/tests/main.nf.test new file mode 100644 index 00000000..d247ee35 --- /dev/null +++ b/modules/nf-core/gatk4/mutect2/tests/main.nf.test @@ -0,0 +1,360 @@ +nextflow_process { + + name "Test Process GATK4_MUTECT2" + script "../main.nf" + process "GATK4_MUTECT2" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/mutect2" + + test("tumor_normal_pair") { + config "./pair.config" + when { + process { + """ + input[0] = [ + [ + id:'test', + normal_id:'normal', + tumor_id:'tumour' + ], + [ + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam'], checkIfExists: true) + ], + [ + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true) + ], + [] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + ] + input[4] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz'], checkIfExists: true) + input[5] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz_tbi'], checkIfExists: true) + input[6] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz'], checkIfExists: true) + input[7] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz_tbi'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2, + process.out.versions, + ).match() + } + ) + } + } + + test("tumor_normal_pair_f1r2") { + config "./f1r2.config" + when { + process { + """ + input[0] = [ + [ + id:'test', + normal_id:'normal', + tumor_id:'tumour' + ], + [ + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam'], checkIfExists: true) + ], + [ + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true) + ], + [] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + ] + input[4] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz'], checkIfExists: true) + input[5] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz_tbi'], checkIfExists: true) + input[6] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz'], checkIfExists: true) + input[7] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz_tbi'], checkIfExists: true) + """ + } + } + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2.collect { file(it[1]).getName() }, + process.out.versions + ).match() + } + ) + } + } + test("tumor_single"){ + when { + process { + """ + input[0] = [ + [ id:'test'], + [ file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam'], checkIfExists: true)], + [ file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true)], + [] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + ] + input[4] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz'], checkIfExists: true) + input[5] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz_tbi'], checkIfExists: true) + input[6] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz'], checkIfExists: true) + input[7] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz_tbi'], checkIfExists: true) + """ + } + } + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2, + process.out.versions + ).match() + } + ) + } + } + test("cram_input"){ + when { + process{ + """ + input[0] = [ + [ id:'test'], + [ file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_cram'], checkIfExists: true)], + [ file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true)], + [] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + ] + input[4] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz'], checkIfExists: true) + input[5] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz_tbi'], checkIfExists: true) + input[6] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz'], checkIfExists: true) + input[7] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz_tbi'], checkIfExists: true) + """ + } + } + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2, + process.out.versions + ).match() + } + ) + } + } + + test("generate_pon") { + when { + process { + """ + input[0] = [ + [ id:'test'], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam'], checkIfExists: true)], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true)], + [] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + ] + input[4] = [] + input[5] = [] + input[6] = [] + input[7] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2, + process.out.versions + ).match() + } + ) + } + } + + test("mitochondria"){ + when { + process { + """ + input[0] = [ + [ id:'test'], + [ file(params.test_data['homo_sapiens']['illumina']['mitochon_standin_recalibrated_sorted_bam'], checkIfExists: true)], + [ file(params.test_data['homo_sapiens']['illumina']['mitochon_standin_recalibrated_sorted_bam_bai'], checkIfExists: true)], + [ file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true)] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true) + ] + input[4] = [] + input[5] = [] + input[6] = [] + input[7] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats, + process.out.f1r2, + process.out.versions + ).match() + } + ) + } + } + + test("tumor_normal_pair_f1r2_stubs"){ + options "-stub-run" + when { + process { + """ + input[0] = [ + [ + id:'test', + normal_id:'normal', + tumor_id:'tumour' + ], + [ + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam'], checkIfExists: true) + ], + [ + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam_bai'], checkIfExists: true) + ], + [] + ] + input[1] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + ] + input[4] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz'], checkIfExists: true) + input[5] = file(params.test_data['homo_sapiens']['genome']['gnomad_r2_1_1_21_vcf_gz_tbi'], checkIfExists: true) + input[6] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz'], checkIfExists: true) + input[7] = file(params.test_data['homo_sapiens']['genome']['mills_and_1000g_indels_21_vcf_gz_tbi'], checkIfExists: true) + """ + } + } + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.stats.collect { file(it[1]).getName() }, + process.out.f1r2.collect { file(it[1]).getName() }, + process.out.versions.collect { file(it[1]).getName() } + ).match() + } + ) + } + + } + +} diff --git a/modules/nf-core/gatk4/mutect2/tests/main.nf.test.snap b/modules/nf-core/gatk4/mutect2/tests/main.nf.test.snap new file mode 100644 index 00000000..f047af19 --- /dev/null +++ b/modules/nf-core/gatk4/mutect2/tests/main.nf.test.snap @@ -0,0 +1,204 @@ +{ + "tumor_normal_pair_f1r2_stubs": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + "test.vcf.gz.stats" + ], + [ + "test.f1r2.tar.gz" + ], + [ + "h" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-21T10:14:45.599103891" + }, + "generate_pon": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,b569ce66bbffe9588b3d221e821023ee" + ] + ], + [ + + ], + [ + "versions.yml:md5,d94731c50c20569fe9896235a843f382" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-20T15:57:18.264453766" + }, + "mitochondria": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,4f77301a125913170b8e9e7828b4ca3f" + ] + ], + [ + + ], + [ + "versions.yml:md5,d94731c50c20569fe9896235a843f382" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-20T16:05:47.668766905" + }, + "cram_input": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,55ed641e16089afb33cdbc478e202d3d" + ] + ], + [ + + ], + [ + "versions.yml:md5,d94731c50c20569fe9896235a843f382" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-20T15:52:27.894730554" + }, + "tumor_single": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + [ + { + "id": "test" + }, + "test.vcf.gz.stats:md5,55ed641e16089afb33cdbc478e202d3d" + ] + ], + [ + + ], + [ + "versions.yml:md5,d94731c50c20569fe9896235a843f382" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-20T15:43:28.935723443" + }, + "tumor_normal_pair": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + [ + { + "id": "test", + "normal_id": "normal", + "tumor_id": "tumour" + }, + "test.vcf.gz.stats:md5,17d2091015d04cbd4a26b7a67dc659e6" + ] + ], + [ + + ], + [ + "versions.yml:md5,d94731c50c20569fe9896235a843f382" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-20T15:31:31.913366311" + }, + "tumor_normal_pair_f1r2": { + "content": [ + [ + "test.vcf.gz" + ], + [ + "test.vcf.gz.tbi" + ], + [ + [ + { + "id": "test", + "normal_id": "normal", + "tumor_id": "tumour" + }, + "test.vcf.gz.stats:md5,17d2091015d04cbd4a26b7a67dc659e6" + ] + ], + [ + "test.f1r2.tar.gz" + ], + [ + "versions.yml:md5,d94731c50c20569fe9896235a843f382" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-03-21T09:45:52.321385704" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/mutect2/tests/mito.config b/modules/nf-core/gatk4/mutect2/tests/mito.config new file mode 100644 index 00000000..de61d3e2 --- /dev/null +++ b/modules/nf-core/gatk4/mutect2/tests/mito.config @@ -0,0 +1,3 @@ +process { + ext.args = { "--mitochondria-mode" } +} diff --git a/modules/nf-core/gatk4/mutect2/tests/pair.config b/modules/nf-core/gatk4/mutect2/tests/pair.config new file mode 100644 index 00000000..2a812b82 --- /dev/null +++ b/modules/nf-core/gatk4/mutect2/tests/pair.config @@ -0,0 +1,3 @@ +process { + ext.args = { "--normal-sample $meta.normal_id" } +} diff --git a/modules/nf-core/gatk4/mutect2/tests/tags.yml b/modules/nf-core/gatk4/mutect2/tests/tags.yml new file mode 100644 index 00000000..46187927 --- /dev/null +++ b/modules/nf-core/gatk4/mutect2/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/mutect2: + - "modules/nf-core/gatk4/mutect2/**" diff --git a/modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md new file mode 100644 index 00000000..c6a45456 --- /dev/null +++ b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. diff --git a/modules/nf-core/gatk4/postprocessgermlinecnvcalls/gatk4-postprocessgermlinecnvcalls.diff b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/gatk4-postprocessgermlinecnvcalls.diff deleted file mode 100644 index b922c53d..00000000 --- a/modules/nf-core/gatk4/postprocessgermlinecnvcalls/gatk4-postprocessgermlinecnvcalls.diff +++ /dev/null @@ -1,14 +0,0 @@ -Changes in module 'nf-core/gatk4/postprocessgermlinecnvcalls' ---- modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf -+++ modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf -@@ -35,7 +35,7 @@ - avail_mem = (task.memory.mega*0.8).intValue() - } - """ -- gatk --java-options "-Xmx${avail_mem}g" PostprocessGermlineCNVCalls \\ -+ gatk --java-options "-Xmx${avail_mem}M" PostprocessGermlineCNVCalls \\ - $calls_command \\ - $model_command \\ - $ploidy_command \\ - -************************************************************ diff --git a/modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf index 31db78bc..73d4a715 100644 --- a/modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf +++ b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/main.nf @@ -37,7 +37,7 @@ process GATK4_POSTPROCESSGERMLINECNVCALLS { """ export THEANO_FLAGS="base_compiledir=\$PWD" - gatk --java-options "-Xmx${avail_mem}g -XX:-UsePerfData" \\ + gatk --java-options "-Xmx${avail_mem}M -XX:-UsePerfData" \\ PostprocessGermlineCNVCalls \\ $calls_command \\ $model_command \\ diff --git a/modules/nf-core/gatk4/variantfiltration/tests/main.nf.test b/modules/nf-core/gatk4/variantfiltration/tests/main.nf.test new file mode 100644 index 00000000..36b7438d --- /dev/null +++ b/modules/nf-core/gatk4/variantfiltration/tests/main.nf.test @@ -0,0 +1,87 @@ +nextflow_process { + + name "Test Process GATK4_VARIANTFILTRATION" + script "../main.nf" + process "GATK4_VARIANTFILTRATION" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/variantfiltration" + + test("test_gatk4_variantfiltration_vcf_input") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.idx', checkIfExists: true) + ] + input[1] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions, + file(process.out.vcf.get(0).get(1)).name, + file(process.out.tbi.get(0).get(1)).name).match() }, + ) + } + + } + + test("test_gatk4_variantfiltration_gz_input") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true) + ] + input[1] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + input[2] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.dict', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions, + file(process.out.vcf.get(0).get(1)).name, + file(process.out.tbi.get(0).get(1)).name).match() }, + ) + } + + } + +} + diff --git a/modules/nf-core/gatk4/variantfiltration/tests/main.nf.test.snap b/modules/nf-core/gatk4/variantfiltration/tests/main.nf.test.snap new file mode 100644 index 00000000..36c03f7c --- /dev/null +++ b/modules/nf-core/gatk4/variantfiltration/tests/main.nf.test.snap @@ -0,0 +1,30 @@ +{ + "test_gatk4_variantfiltration_gz_input": { + "content": [ + [ + "versions.yml:md5,96943659275ba62de1f0d283a2f6e97b" + ], + "test.vcf.gz", + "test.vcf.gz.tbi" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-05-22T22:43:27.609784" + }, + "test_gatk4_variantfiltration_vcf_input": { + "content": [ + [ + "versions.yml:md5,96943659275ba62de1f0d283a2f6e97b" + ], + "test.vcf.gz", + "test.vcf.gz.tbi" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.2" + }, + "timestamp": "2024-05-22T22:42:55.316294" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/variantfiltration/tests/tags.yml b/modules/nf-core/gatk4/variantfiltration/tests/tags.yml new file mode 100644 index 00000000..4818037d --- /dev/null +++ b/modules/nf-core/gatk4/variantfiltration/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/variantfiltration: + - "modules/nf-core/gatk4/variantfiltration/**" diff --git a/modules/nf-core/manta/germline/main.nf b/modules/nf-core/manta/germline/main.nf index 5d5666c6..c1b339a9 100644 --- a/modules/nf-core/manta/germline/main.nf +++ b/modules/nf-core/manta/germline/main.nf @@ -66,11 +66,11 @@ process MANTA_GERMLINE { stub: def prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix}.candidate_small_indels.vcf.gz + echo "" | gzip > ${prefix}.candidate_small_indels.vcf.gz touch ${prefix}.candidate_small_indels.vcf.gz.tbi - touch ${prefix}.candidate_sv.vcf.gz + echo "" | gzip > ${prefix}.candidate_sv.vcf.gz touch ${prefix}.candidate_sv.vcf.gz.tbi - touch ${prefix}.diploid_sv.vcf.gz + echo "" | gzip > ${prefix}.diploid_sv.vcf.gz touch ${prefix}.diploid_sv.vcf.gz.tbi cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/manta/germline/tests/main.nf.test b/modules/nf-core/manta/germline/tests/main.nf.test new file mode 100644 index 00000000..1d49ad23 --- /dev/null +++ b/modules/nf-core/manta/germline/tests/main.nf.test @@ -0,0 +1,162 @@ +nextflow_process { + + name "Test Process MANTA_GERMLINE" + script "../main.nf" + process "MANTA_GERMLINE" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "manta" + tag "manta/germline" + + test("human - cram") { + + when { + process { + """ + input[0] = [ [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true), + [],[] + ] + // fasta + input[1] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + // fai + input[2] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + // config + input[3] = Channel.of("[manta]", "enableRemoteReadRetrievalForInsertionsInGermlineCallingModes = 0") + .collectFile(name:"manta_options.ini", newLine:true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.candidate_small_indels_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert path(process.out.candidate_sv_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert path(process.out.diploid_sv_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert snapshot(process.out.version).match("version") } + ) + } + + } + + test("human - cram - bed") { + + when { + process { + """ + input[0] = [ [ id:'bed_test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed.gz.tbi', checkIfExists: true) + ] + // fasta + input[1] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + // fai + input[2] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + // config + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.candidate_small_indels_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert path(process.out.candidate_sv_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert path(process.out.diploid_sv_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert snapshot(process.out.version).match("bed_version") } + ) + } + + } + + test("human - cram - bed - jointcalling") { + + when { + process { + """ + input[0] = [ [ id:'bed_test', single_end:false ], // meta map + [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test2.paired_end.sorted.cram', checkIfExists: true) + ], + [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test2.paired_end.sorted.cram.crai', checkIfExists: true) + ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed.gz.tbi', checkIfExists: true) + ] + // fasta + input[1] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + // fai + input[2] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + // config + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.candidate_small_indels_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert path(process.out.candidate_sv_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert path(process.out.diploid_sv_vcf.get(0).get(1)).linesGzip.contains("##fileformat=VCFv4.1") }, + { assert snapshot(process.out.version).match("joint_version") } + ) + } + + } + test("human - cram - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true), + [],[] + ] + // fasta + input[1] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + // fai + input[2] = [ [id:'genome'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) + ] + // config + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/manta/germline/tests/main.nf.test.snap b/modules/nf-core/manta/germline/tests/main.nf.test.snap new file mode 100644 index 00000000..79d5541e --- /dev/null +++ b/modules/nf-core/manta/germline/tests/main.nf.test.snap @@ -0,0 +1,139 @@ +{ + "human - cram - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.candidate_small_indels.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.candidate_small_indels.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.candidate_sv.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "test.candidate_sv.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test" + }, + "test.diploid_sv.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "5": [ + [ + { + "id": "test" + }, + "test.diploid_sv.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + "versions.yml:md5,18070b443a26855ef64dafa179dfba01" + ], + "candidate_small_indels_vcf": [ + [ + { + "id": "test" + }, + "test.candidate_small_indels.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "candidate_small_indels_vcf_tbi": [ + [ + { + "id": "test" + }, + "test.candidate_small_indels.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "candidate_sv_vcf": [ + [ + { + "id": "test" + }, + "test.candidate_sv.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "candidate_sv_vcf_tbi": [ + [ + { + "id": "test" + }, + "test.candidate_sv.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "diploid_sv_vcf": [ + [ + { + "id": "test" + }, + "test.diploid_sv.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "diploid_sv_vcf_tbi": [ + [ + { + "id": "test" + }, + "test.diploid_sv.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,18070b443a26855ef64dafa179dfba01" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-21T17:54:09.788372" + }, + "joint_version": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T15:03:07.745972" + }, + "bed_version": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-21T13:49:38.745653" + }, + "version": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-21T13:49:14.885769" + } +} \ No newline at end of file diff --git a/modules/nf-core/manta/germline/tests/nextflow.config b/modules/nf-core/manta/germline/tests/nextflow.config new file mode 100644 index 00000000..22acb242 --- /dev/null +++ b/modules/nf-core/manta/germline/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: MANTA_GERMLINE { + ext.args = '--exome ' + } +} diff --git a/modules/nf-core/manta/germline/tests/tags.yml b/modules/nf-core/manta/germline/tests/tags.yml new file mode 100644 index 00000000..99d1a73c --- /dev/null +++ b/modules/nf-core/manta/germline/tests/tags.yml @@ -0,0 +1,2 @@ +manta/germline: + - "modules/nf-core/manta/germline/**" diff --git a/modules/nf-core/ngsbits/samplegender/meta.yml b/modules/nf-core/ngsbits/samplegender/meta.yml index 997bc06e..961462b3 100644 --- a/modules/nf-core/ngsbits/samplegender/meta.yml +++ b/modules/nf-core/ngsbits/samplegender/meta.yml @@ -12,7 +12,7 @@ tools: homepage: "https://github.com/imgag/ngs-bits" documentation: "https://github.com/imgag/ngs-bits" tool_dev_url: "https://github.com/imgag/ngs-bits" - licence: "['MIT license']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/ngsbits/samplegender/tests/main.nf.test b/modules/nf-core/ngsbits/samplegender/tests/main.nf.test new file mode 100644 index 00000000..2cf4757b --- /dev/null +++ b/modules/nf-core/ngsbits/samplegender/tests/main.nf.test @@ -0,0 +1,47 @@ +nextflow_process { + + name "Test Process NGSBITS_SAMPLEGENDER" + script "../main.nf" + process "NGSBITS_SAMPLEGENDER" + + tag "modules" + tag "modules_nfcore" + tag "ngsbits" + tag "ngsbits/samplegender" + + // Only a stub test here because the modules needs the full chrX and chrY + test("homo_sapiens - bam, bai, [], [], sry - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) + ] + input[1] = [ + [ id:'reference'], // meta map + [] + ] + input[2] = [ + [ id:'reference'], // meta map + [] + ] + input[3] = "sry" + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ngsbits/samplegender/tests/main.nf.test.snap b/modules/nf-core/ngsbits/samplegender/tests/main.nf.test.snap new file mode 100644 index 00000000..48fd8af9 --- /dev/null +++ b/modules/nf-core/ngsbits/samplegender/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "homo_sapiens - bam, bai, [], [], sry - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,72f3e70be3e6a734bf39d1a6bf6d604b" + ], + "tsv": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,72f3e70be3e6a734bf39d1a6bf6d604b" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T15:36:37.639882564" + } +} \ No newline at end of file diff --git a/modules/nf-core/ngsbits/samplegender/tests/tags.yml b/modules/nf-core/ngsbits/samplegender/tests/tags.yml new file mode 100644 index 00000000..8b7a0da9 --- /dev/null +++ b/modules/nf-core/ngsbits/samplegender/tests/tags.yml @@ -0,0 +1,2 @@ +ngsbits/samplegender: + - "modules/nf-core/ngsbits/samplegender/**" diff --git a/modules/nf-core/picard/addorreplacereadgroups/main.nf b/modules/nf-core/picard/addorreplacereadgroups/main.nf index dc1a387d..4300ba7f 100644 --- a/modules/nf-core/picard/addorreplacereadgroups/main.nf +++ b/modules/nf-core/picard/addorreplacereadgroups/main.nf @@ -8,12 +8,15 @@ process PICARD_ADDORREPLACEREADGROUPS { 'biocontainers/picard:3.1.1--hdfd78af_0' }" input: - tuple val(meta), path(bam) + tuple val(meta), path(reads) + tuple val(meta2), path(fasta) + tuple val(meta3), path(fasta_index) output: - tuple val(meta), path("*.bam"), emit: bam - tuple val(meta), path("*.bai"), emit: bai, optional: true - path "versions.yml" , emit: versions + tuple val(meta), path("*.bam") , emit: bam, optional: true + tuple val(meta), path("*.bai") , emit: bai, optional: true + tuple val(meta), path("*.cram"), emit: cram, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -21,6 +24,8 @@ process PICARD_ADDORREPLACEREADGROUPS { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "${reads.getExtension()}" + def reference = fasta ? "--REFERENCE_SEQUENCE ${fasta}" : "" def avail_mem = 3072 if (!task.memory) { log.info '[Picard AddOrReplaceReadGroups] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' @@ -28,15 +33,16 @@ process PICARD_ADDORREPLACEREADGROUPS { avail_mem = (task.memory.mega*0.8).intValue() } - if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + if ("$reads" == "${prefix}.${suffix}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" """ picard \\ -Xmx${avail_mem}M \\ AddOrReplaceReadGroups \\ $args \\ - --INPUT ${bam} \\ - --OUTPUT ${prefix}.bam + $reference \\ + --INPUT ${reads} \\ + --OUTPUT ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -46,10 +52,10 @@ process PICARD_ADDORREPLACEREADGROUPS { stub: def prefix = task.ext.prefix ?: "${meta.id}" - - if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + def suffix = task.ext.suffix ?: "${reads.getExtension()}" + if ("$reads" == "${prefix}.${suffix}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" """ - touch ${prefix}.bam + touch ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/picard/addorreplacereadgroups/meta.yml b/modules/nf-core/picard/addorreplacereadgroups/meta.yml index ab573ac8..efd5b86d 100644 --- a/modules/nf-core/picard/addorreplacereadgroups/meta.yml +++ b/modules/nf-core/picard/addorreplacereadgroups/meta.yml @@ -20,10 +20,28 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - bam: + - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: type: file - description: Input BAM file - pattern: "*.{bam}" + description: Sequence reads file, can be SAM/BAM/CRAM format + pattern: "*.{bam,cram,sam}" + - fasta: + type: file + description: Reference genome file + pattern: "*.{fasta,fa,fasta.gz,fa.gz}" + - fasta_index: + type: file + description: Reference genome index file + pattern: "*.{fai,fasta.fai,fa.fai,fasta.gz.fai,fa.gz.fai}" output: - meta: type: map @@ -40,8 +58,12 @@ output: pattern: "*.{bam}" - bai: type: file - description: BAM index file + description: An optional BAM index file pattern: "*.{bai}" + - cram: + type: file + description: Output CRAM file + pattern: "*.{cram}" authors: - "@sateeshperi" - "@mjcipriano" diff --git a/modules/nf-core/picard/addorreplacereadgroups/tests/bam.config b/modules/nf-core/picard/addorreplacereadgroups/tests/bam.config new file mode 100644 index 00000000..3f37c2fd --- /dev/null +++ b/modules/nf-core/picard/addorreplacereadgroups/tests/bam.config @@ -0,0 +1,13 @@ +process { + withName: 'PICARD_ADDORREPLACEREADGROUPS'{ + ext.prefix = { "${meta.id}.replaced"} + ext.args = {[ + "--CREATE_INDEX", + "-LB ${meta.id}", + "-PL ILLUMINA", + "-PU bc1", + "-SM ${meta.id}" + ].join(' ').trim()} + } + +} diff --git a/modules/nf-core/picard/addorreplacereadgroups/tests/cram.config b/modules/nf-core/picard/addorreplacereadgroups/tests/cram.config new file mode 100644 index 00000000..966c14d7 --- /dev/null +++ b/modules/nf-core/picard/addorreplacereadgroups/tests/cram.config @@ -0,0 +1,13 @@ +process { + withName: 'PICARD_ADDORREPLACEREADGROUPS'{ + ext.prefix = { "${meta.id}.replaced"} + ext.args = {[ + "-LB ${meta.id}", + "-PL ILLUMINA", + "-PU bc1", + "-SM ${meta.id}" + ].join(' ').trim()} + ext.suffix = { "cram" } + } + +} diff --git a/modules/nf-core/picard/addorreplacereadgroups/tests/main.nf.test b/modules/nf-core/picard/addorreplacereadgroups/tests/main.nf.test new file mode 100644 index 00000000..9c029354 --- /dev/null +++ b/modules/nf-core/picard/addorreplacereadgroups/tests/main.nf.test @@ -0,0 +1,93 @@ + +nextflow_process { + + name "Test Process PICARD_ADDORREPLACEREADGROUPS" + script "../main.nf" + process "PICARD_ADDORREPLACEREADGROUPS" + + tag "modules" + tag "modules_nfcore" + tag "picard" + tag "picard/addorreplacereadgroups" + + test("sarscov2 - bam") { + config "./bam.config" + + when { + process { + """ + input[0] = [ [:], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ] + input[1] = [ [:], [] ] + input[2] = [ [:], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + file(process.out.bai[0][1]).name, + process.out.versions + ).match() + }, + ) + } + + } + + test("homo_sapiens - cram") { + config "./cram.config" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), ] + ] + input[1] = [ [:], file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ] + input[2] = [ [:], file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.cram[0][1]).name, + process.out.versions + ).match() + }, + ) + } + + } + + test("sarscov2 - bam - stub") { + config "./bam.config" + options "-stub" + + when { + process { + """ + input[0] = [ [:], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ] + input[1] = [ [:], [] ] + input[2] = [ [:], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/picard/addorreplacereadgroups/tests/main.nf.test.snap b/modules/nf-core/picard/addorreplacereadgroups/tests/main.nf.test.snap new file mode 100644 index 00000000..63a55843 --- /dev/null +++ b/modules/nf-core/picard/addorreplacereadgroups/tests/main.nf.test.snap @@ -0,0 +1,74 @@ +{ + "homo_sapiens - cram": { + "content": [ + "test.replaced.cram", + [ + "versions.yml:md5,0a6f049f94501dcf23aabfbc0e272891" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T12:05:47.668865" + }, + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + + }, + "null.replaced.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,0a6f049f94501dcf23aabfbc0e272891" + ], + "bai": [ + + ], + "bam": [ + [ + { + + }, + "null.replaced.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "cram": [ + + ], + "versions": [ + "versions.yml:md5,0a6f049f94501dcf23aabfbc0e272891" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T10:51:24.530553" + }, + "sarscov2 - bam": { + "content": [ + "null.replaced.bam", + "null.replaced.bai", + [ + "versions.yml:md5,0a6f049f94501dcf23aabfbc0e272891" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T12:05:29.696728" + } +} \ No newline at end of file diff --git a/modules/nf-core/picard/addorreplacereadgroups/tests/tags.yml b/modules/nf-core/picard/addorreplacereadgroups/tests/tags.yml new file mode 100644 index 00000000..733010d6 --- /dev/null +++ b/modules/nf-core/picard/addorreplacereadgroups/tests/tags.yml @@ -0,0 +1,2 @@ +picard/addorreplacereadgroups: + - "modules/nf-core/picard/addorreplacereadgroups/**" diff --git a/modules/nf-core/picard/markduplicates/main.nf b/modules/nf-core/picard/markduplicates/main.nf index 80930cc4..ad0b2963 100644 --- a/modules/nf-core/picard/markduplicates/main.nf +++ b/modules/nf-core/picard/markduplicates/main.nf @@ -8,13 +8,14 @@ process PICARD_MARKDUPLICATES { 'biocontainers/picard:3.1.1--hdfd78af_0' }" input: - tuple val(meta), path(bam) + tuple val(meta), path(reads) tuple val(meta2), path(fasta) tuple val(meta3), path(fai) output: - tuple val(meta), path("*.bam") , emit: bam - tuple val(meta), path("*.bai") , optional:true, emit: bai + tuple val(meta), path("*.bam") , emit: bam, optional: true + tuple val(meta), path("*.bai") , emit: bai, optional: true + tuple val(meta), path("*.cram"), emit: cram, optional: true tuple val(meta), path("*.metrics.txt"), emit: metrics path "versions.yml" , emit: versions @@ -24,6 +25,8 @@ process PICARD_MARKDUPLICATES { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "${reads.getExtension()}" + def reference = fasta ? "--REFERENCE_SEQUENCE ${fasta}" : "" def avail_mem = 3072 if (!task.memory) { log.info '[Picard MarkDuplicates] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' @@ -31,16 +34,16 @@ process PICARD_MARKDUPLICATES { avail_mem = (task.memory.mega*0.8).intValue() } - if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + if ("$reads" == "${prefix}.${suffix}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" """ picard \\ -Xmx${avail_mem}M \\ MarkDuplicates \\ $args \\ - --INPUT $bam \\ - --OUTPUT ${prefix}.bam \\ - --REFERENCE_SEQUENCE $fasta \\ + --INPUT $reads \\ + --OUTPUT ${prefix}.${suffix} \\ + $reference \\ --METRICS_FILE ${prefix}.MarkDuplicates.metrics.txt cat <<-END_VERSIONS > versions.yml @@ -51,10 +54,10 @@ process PICARD_MARKDUPLICATES { stub: def prefix = task.ext.prefix ?: "${meta.id}" - if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + def suffix = task.ext.suffix ?: "${reads.getExtension()}" + if ("$reads" == "${prefix}.${suffix}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" """ - touch ${prefix}.bam - touch ${prefix}.bam.bai + touch ${prefix}.${suffix} touch ${prefix}.MarkDuplicates.metrics.txt cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/picard/markduplicates/meta.yml b/modules/nf-core/picard/markduplicates/meta.yml index 1ab90c07..1f0ffe16 100644 --- a/modules/nf-core/picard/markduplicates/meta.yml +++ b/modules/nf-core/picard/markduplicates/meta.yml @@ -21,9 +21,9 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - bam: + - reads: type: file - description: BAM file + description: Sequence reads file, can be SAM/BAM/CRAM format pattern: "*.{bam,cram,sam}" - meta2: type: map @@ -32,7 +32,7 @@ input: e.g. [ id:'genome' ] - fasta: type: file - description: Reference genome fasta file + description: Reference genome fasta file, required for CRAM input pattern: "*.{fasta,fa}" - meta3: type: map @@ -57,6 +57,10 @@ output: type: file description: An optional BAM index file. If desired, --CREATE_INDEX must be passed as a flag pattern: "*.{bai}" + - cram: + type: file + description: Output CRAM file + pattern: "*.{cram}" - metrics: type: file description: Duplicate metrics file generated by picard diff --git a/modules/nf-core/picard/markduplicates/tests/main.nf.test b/modules/nf-core/picard/markduplicates/tests/main.nf.test index c5a29b4b..e3e97f6c 100644 --- a/modules/nf-core/picard/markduplicates/tests/main.nf.test +++ b/modules/nf-core/picard/markduplicates/tests/main.nf.test @@ -18,14 +18,8 @@ nextflow_process { [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) ]) - input[1] = Channel.of([ - [ id:'genome' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) - ]) - input[2] = Channel.of([ - [ id:'genome' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) - ]) + input[1] = [ [:], [] ] + input[2] = [ [:], [] ] """ } } @@ -49,14 +43,8 @@ nextflow_process { [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ]) - input[1] = Channel.of([ - [ id:'genome' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) - ]) - input[2] = Channel.of([ - [ id:'genome' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) - ]) + input[1] = [ [:], [] ] + input[2] = [ [:], [] ] """ } } @@ -95,7 +83,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(file(process.out.bam[0][1]).name).match("cram_name") }, + { assert snapshot(file(process.out.cram[0][1]).name).match("cram_name") }, { assert snapshot(path(process.out.metrics.get(0).get(1)).readLines()[0..2]).match("cram_metrics") }, { assert snapshot(process.out.versions).match("cram_versions") } ) diff --git a/modules/nf-core/picard/markduplicates/tests/main.nf.test.snap b/modules/nf-core/picard/markduplicates/tests/main.nf.test.snap index 31c9130d..eb17111e 100644 --- a/modules/nf-core/picard/markduplicates/tests/main.nf.test.snap +++ b/modules/nf-core/picard/markduplicates/tests/main.nf.test.snap @@ -5,39 +5,59 @@ "versions.yml:md5,b699af51b1956f3810f8a7c066e0ab17" ] ], - "timestamp": "2024-01-19T10:26:45.092349" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T15:31:50.928021" }, "unsorted_bam_name": { "content": [ "test.marked.bam" ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, "timestamp": "2024-01-19T10:26:28.100755" }, "cram_metrics": { "content": [ [ "## htsjdk.samtools.metrics.StringHeader", - "# MarkDuplicates --INPUT test.paired_end.sorted.cram --OUTPUT test.marked.bam --METRICS_FILE test.marked.MarkDuplicates.metrics.txt --ASSUME_SORT_ORDER queryname --REFERENCE_SEQUENCE genome.fasta --MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP 50000 --MAX_FILE_HANDLES_FOR_READ_ENDS_MAP 8000 --SORTING_COLLECTION_SIZE_RATIO 0.25 --TAG_DUPLICATE_SET_MEMBERS false --REMOVE_SEQUENCING_DUPLICATES false --TAGGING_POLICY DontTag --CLEAR_DT true --DUPLEX_UMI false --FLOW_MODE false --FLOW_QUALITY_SUM_STRATEGY false --USE_END_IN_UNPAIRED_READS false --USE_UNPAIRED_CLIPPED_END false --UNPAIRED_END_UNCERTAINTY 0 --FLOW_SKIP_FIRST_N_FLOWS 0 --FLOW_Q_IS_KNOWN_END false --FLOW_EFFECTIVE_QUALITY_THRESHOLD 15 --ADD_PG_TAG_TO_READS true --REMOVE_DUPLICATES false --ASSUME_SORTED false --DUPLICATE_SCORING_STRATEGY SUM_OF_BASE_QUALITIES --PROGRAM_RECORD_ID MarkDuplicates --PROGRAM_GROUP_NAME MarkDuplicates --READ_NAME_REGEX --OPTICAL_DUPLICATE_PIXEL_DISTANCE 100 --MAX_OPTICAL_DUPLICATE_SET_SIZE 300000 --VERBOSITY INFO --QUIET false --VALIDATION_STRINGENCY STRICT --COMPRESSION_LEVEL 5 --MAX_RECORDS_IN_RAM 500000 --CREATE_INDEX false --CREATE_MD5_FILE false --help false --version false --showHidden false --USE_JDK_DEFLATER false --USE_JDK_INFLATER false", + "# MarkDuplicates --INPUT test.paired_end.sorted.cram --OUTPUT test.marked.cram --METRICS_FILE test.marked.MarkDuplicates.metrics.txt --ASSUME_SORT_ORDER queryname --REFERENCE_SEQUENCE genome.fasta --MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP 50000 --MAX_FILE_HANDLES_FOR_READ_ENDS_MAP 8000 --SORTING_COLLECTION_SIZE_RATIO 0.25 --TAG_DUPLICATE_SET_MEMBERS false --REMOVE_SEQUENCING_DUPLICATES false --TAGGING_POLICY DontTag --CLEAR_DT true --DUPLEX_UMI false --FLOW_MODE false --FLOW_QUALITY_SUM_STRATEGY false --USE_END_IN_UNPAIRED_READS false --USE_UNPAIRED_CLIPPED_END false --UNPAIRED_END_UNCERTAINTY 0 --FLOW_SKIP_FIRST_N_FLOWS 0 --FLOW_Q_IS_KNOWN_END false --FLOW_EFFECTIVE_QUALITY_THRESHOLD 15 --ADD_PG_TAG_TO_READS true --REMOVE_DUPLICATES false --ASSUME_SORTED false --DUPLICATE_SCORING_STRATEGY SUM_OF_BASE_QUALITIES --PROGRAM_RECORD_ID MarkDuplicates --PROGRAM_GROUP_NAME MarkDuplicates --READ_NAME_REGEX --OPTICAL_DUPLICATE_PIXEL_DISTANCE 100 --MAX_OPTICAL_DUPLICATE_SET_SIZE 300000 --VERBOSITY INFO --QUIET false --VALIDATION_STRINGENCY STRICT --COMPRESSION_LEVEL 5 --MAX_RECORDS_IN_RAM 500000 --CREATE_INDEX false --CREATE_MD5_FILE false --help false --version false --showHidden false --USE_JDK_DEFLATER false --USE_JDK_INFLATER false", "## htsjdk.samtools.metrics.StringHeader" ] ], - "timestamp": "2024-01-19T10:27:03.253071" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T15:25:47.518152" }, "sorted_bam_metrics": { "content": [ [ "## htsjdk.samtools.metrics.StringHeader", - "# MarkDuplicates --INPUT test.paired_end.sorted.bam --OUTPUT test.marked.bam --METRICS_FILE test.marked.MarkDuplicates.metrics.txt --ASSUME_SORT_ORDER queryname --REFERENCE_SEQUENCE genome.fasta --MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP 50000 --MAX_FILE_HANDLES_FOR_READ_ENDS_MAP 8000 --SORTING_COLLECTION_SIZE_RATIO 0.25 --TAG_DUPLICATE_SET_MEMBERS false --REMOVE_SEQUENCING_DUPLICATES false --TAGGING_POLICY DontTag --CLEAR_DT true --DUPLEX_UMI false --FLOW_MODE false --FLOW_QUALITY_SUM_STRATEGY false --USE_END_IN_UNPAIRED_READS false --USE_UNPAIRED_CLIPPED_END false --UNPAIRED_END_UNCERTAINTY 0 --FLOW_SKIP_FIRST_N_FLOWS 0 --FLOW_Q_IS_KNOWN_END false --FLOW_EFFECTIVE_QUALITY_THRESHOLD 15 --ADD_PG_TAG_TO_READS true --REMOVE_DUPLICATES false --ASSUME_SORTED false --DUPLICATE_SCORING_STRATEGY SUM_OF_BASE_QUALITIES --PROGRAM_RECORD_ID MarkDuplicates --PROGRAM_GROUP_NAME MarkDuplicates --READ_NAME_REGEX --OPTICAL_DUPLICATE_PIXEL_DISTANCE 100 --MAX_OPTICAL_DUPLICATE_SET_SIZE 300000 --VERBOSITY INFO --QUIET false --VALIDATION_STRINGENCY STRICT --COMPRESSION_LEVEL 5 --MAX_RECORDS_IN_RAM 500000 --CREATE_INDEX false --CREATE_MD5_FILE false --help false --version false --showHidden false --USE_JDK_DEFLATER false --USE_JDK_INFLATER false", + "# MarkDuplicates --INPUT test.paired_end.sorted.bam --OUTPUT test.marked.bam --METRICS_FILE test.marked.MarkDuplicates.metrics.txt --ASSUME_SORT_ORDER queryname --MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP 50000 --MAX_FILE_HANDLES_FOR_READ_ENDS_MAP 8000 --SORTING_COLLECTION_SIZE_RATIO 0.25 --TAG_DUPLICATE_SET_MEMBERS false --REMOVE_SEQUENCING_DUPLICATES false --TAGGING_POLICY DontTag --CLEAR_DT true --DUPLEX_UMI false --FLOW_MODE false --FLOW_QUALITY_SUM_STRATEGY false --USE_END_IN_UNPAIRED_READS false --USE_UNPAIRED_CLIPPED_END false --UNPAIRED_END_UNCERTAINTY 0 --FLOW_SKIP_FIRST_N_FLOWS 0 --FLOW_Q_IS_KNOWN_END false --FLOW_EFFECTIVE_QUALITY_THRESHOLD 15 --ADD_PG_TAG_TO_READS true --REMOVE_DUPLICATES false --ASSUME_SORTED false --DUPLICATE_SCORING_STRATEGY SUM_OF_BASE_QUALITIES --PROGRAM_RECORD_ID MarkDuplicates --PROGRAM_GROUP_NAME MarkDuplicates --READ_NAME_REGEX --OPTICAL_DUPLICATE_PIXEL_DISTANCE 100 --MAX_OPTICAL_DUPLICATE_SET_SIZE 300000 --VERBOSITY INFO --QUIET false --VALIDATION_STRINGENCY STRICT --COMPRESSION_LEVEL 5 --MAX_RECORDS_IN_RAM 500000 --CREATE_INDEX false --CREATE_MD5_FILE false --help false --version false --showHidden false --USE_JDK_DEFLATER false --USE_JDK_INFLATER false", "## htsjdk.samtools.metrics.StringHeader" ] ], - "timestamp": "2024-01-19T10:26:45.086503" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T11:39:10.318331" }, "cram_name": { "content": [ - "test.marked.bam" + "test.marked.cram" ], - "timestamp": "2024-01-19T10:27:03.241617" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T15:25:47.459663" }, "cram_versions": { "content": [ @@ -45,6 +65,10 @@ "versions.yml:md5,b699af51b1956f3810f8a7c066e0ab17" ] ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, "timestamp": "2024-01-19T10:27:03.26989" }, "unsorted_bam_versions": { @@ -53,22 +77,34 @@ "versions.yml:md5,b699af51b1956f3810f8a7c066e0ab17" ] ], - "timestamp": "2024-01-19T10:26:28.159071" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T15:31:24.040403" }, "unsorted_bam_metrics": { "content": [ [ "## htsjdk.samtools.metrics.StringHeader", - "# MarkDuplicates --INPUT test.paired_end.bam --OUTPUT test.marked.bam --METRICS_FILE test.marked.MarkDuplicates.metrics.txt --ASSUME_SORT_ORDER queryname --REFERENCE_SEQUENCE genome.fasta --MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP 50000 --MAX_FILE_HANDLES_FOR_READ_ENDS_MAP 8000 --SORTING_COLLECTION_SIZE_RATIO 0.25 --TAG_DUPLICATE_SET_MEMBERS false --REMOVE_SEQUENCING_DUPLICATES false --TAGGING_POLICY DontTag --CLEAR_DT true --DUPLEX_UMI false --FLOW_MODE false --FLOW_QUALITY_SUM_STRATEGY false --USE_END_IN_UNPAIRED_READS false --USE_UNPAIRED_CLIPPED_END false --UNPAIRED_END_UNCERTAINTY 0 --FLOW_SKIP_FIRST_N_FLOWS 0 --FLOW_Q_IS_KNOWN_END false --FLOW_EFFECTIVE_QUALITY_THRESHOLD 15 --ADD_PG_TAG_TO_READS true --REMOVE_DUPLICATES false --ASSUME_SORTED false --DUPLICATE_SCORING_STRATEGY SUM_OF_BASE_QUALITIES --PROGRAM_RECORD_ID MarkDuplicates --PROGRAM_GROUP_NAME MarkDuplicates --READ_NAME_REGEX --OPTICAL_DUPLICATE_PIXEL_DISTANCE 100 --MAX_OPTICAL_DUPLICATE_SET_SIZE 300000 --VERBOSITY INFO --QUIET false --VALIDATION_STRINGENCY STRICT --COMPRESSION_LEVEL 5 --MAX_RECORDS_IN_RAM 500000 --CREATE_INDEX false --CREATE_MD5_FILE false --help false --version false --showHidden false --USE_JDK_DEFLATER false --USE_JDK_INFLATER false", + "# MarkDuplicates --INPUT test.paired_end.bam --OUTPUT test.marked.bam --METRICS_FILE test.marked.MarkDuplicates.metrics.txt --ASSUME_SORT_ORDER queryname --MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP 50000 --MAX_FILE_HANDLES_FOR_READ_ENDS_MAP 8000 --SORTING_COLLECTION_SIZE_RATIO 0.25 --TAG_DUPLICATE_SET_MEMBERS false --REMOVE_SEQUENCING_DUPLICATES false --TAGGING_POLICY DontTag --CLEAR_DT true --DUPLEX_UMI false --FLOW_MODE false --FLOW_QUALITY_SUM_STRATEGY false --USE_END_IN_UNPAIRED_READS false --USE_UNPAIRED_CLIPPED_END false --UNPAIRED_END_UNCERTAINTY 0 --FLOW_SKIP_FIRST_N_FLOWS 0 --FLOW_Q_IS_KNOWN_END false --FLOW_EFFECTIVE_QUALITY_THRESHOLD 15 --ADD_PG_TAG_TO_READS true --REMOVE_DUPLICATES false --ASSUME_SORTED false --DUPLICATE_SCORING_STRATEGY SUM_OF_BASE_QUALITIES --PROGRAM_RECORD_ID MarkDuplicates --PROGRAM_GROUP_NAME MarkDuplicates --READ_NAME_REGEX --OPTICAL_DUPLICATE_PIXEL_DISTANCE 100 --MAX_OPTICAL_DUPLICATE_SET_SIZE 300000 --VERBOSITY INFO --QUIET false --VALIDATION_STRINGENCY STRICT --COMPRESSION_LEVEL 5 --MAX_RECORDS_IN_RAM 500000 --CREATE_INDEX false --CREATE_MD5_FILE false --help false --version false --showHidden false --USE_JDK_DEFLATER false --USE_JDK_INFLATER false", "## htsjdk.samtools.metrics.StringHeader" ] ], - "timestamp": "2024-01-19T10:26:28.143979" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T10:51:12.831787" }, "sorted_bam_name": { "content": [ "test.marked.bam" ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, "timestamp": "2024-01-19T10:26:45.080116" } } \ No newline at end of file diff --git a/modules/nf-core/samtools/faidx/environment.yml b/modules/nf-core/samtools/faidx/environment.yml index 3e95dd71..9c24eb0a 100644 --- a/modules/nf-core/samtools/faidx/environment.yml +++ b/modules/nf-core/samtools/faidx/environment.yml @@ -1,8 +1,10 @@ name: samtools_faidx + channels: - conda-forge - bioconda - defaults + dependencies: - - bioconda::samtools=1.19.2 - bioconda::htslib=1.19.1 + - bioconda::samtools=1.19.2 diff --git a/modules/nf-core/samtools/faidx/meta.yml b/modules/nf-core/samtools/faidx/meta.yml index e189af28..f3c25de2 100644 --- a/modules/nf-core/samtools/faidx/meta.yml +++ b/modules/nf-core/samtools/faidx/meta.yml @@ -39,6 +39,10 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - fa: + type: file + description: FASTA file + pattern: "*.{fa}" - fai: type: file description: FASTA index file diff --git a/modules/nf-core/samtools/faidx/tests/main.nf.test b/modules/nf-core/samtools/faidx/tests/main.nf.test new file mode 100644 index 00000000..17244ef2 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/main.nf.test @@ -0,0 +1,122 @@ +nextflow_process { + + name "Test Process SAMTOOLS_FAIDX" + script "../main.nf" + process "SAMTOOLS_FAIDX" + + tag "modules" + tag "modules_nfcore" + tag "samtools" + tag "samtools/faidx" + + test("test_samtools_faidx") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] + + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_bgzip") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true)] + + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_fasta") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] + + input[1] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_stub_fasta") { + + config "./nextflow2.config" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] + + input[1] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_samtools_faidx_stub_fai") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] + + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/samtools/faidx/tests/main.nf.test.snap b/modules/nf-core/samtools/faidx/tests/main.nf.test.snap new file mode 100644 index 00000000..3e651ef6 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/main.nf.test.snap @@ -0,0 +1,249 @@ +{ + "test_samtools_faidx": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + + ], + "fai": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:22:39.412601" + }, + "test_samtools_faidx_bgzip": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.gzi:md5,7dea362b3fac8e00956a4952a3d4f474" + ] + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + + ], + "fai": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "gzi": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.gz.gzi:md5,7dea362b3fac8e00956a4952a3d4f474" + ] + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:23:22.427966" + }, + "test_samtools_faidx_fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,6a0774a0ad937ba0bfd2ac7457d90f36" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,6a0774a0ad937ba0bfd2ac7457d90f36" + ] + ], + "fai": [ + + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:24:04.107537" + }, + "test_samtools_faidx_stub_fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + [ + { + "id": "test", + "single_end": false + }, + "extract.fa:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "fai": [ + + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:24:45.868463" + }, + "test_samtools_faidx_stub_fai": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ], + "fa": [ + + ], + "fai": [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.fai:md5,9da2a56e2853dc8c0b86a9e7229c9fe5" + ] + ], + "gzi": [ + + ], + "versions": [ + "versions.yml:md5,4870fc0a88c616aa937f8325a2db0c3c" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T16:25:27.550554" + } +} \ No newline at end of file diff --git a/modules/nf-core/samtools/faidx/tests/nextflow.config b/modules/nf-core/samtools/faidx/tests/nextflow.config new file mode 100644 index 00000000..f76a3ba0 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: SAMTOOLS_FAIDX { + ext.args = 'MT192765.1 -o extract.fa' + } + +} diff --git a/modules/nf-core/samtools/faidx/tests/nextflow2.config b/modules/nf-core/samtools/faidx/tests/nextflow2.config new file mode 100644 index 00000000..33ebbd5d --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/nextflow2.config @@ -0,0 +1,6 @@ +process { + + withName: SAMTOOLS_FAIDX { + ext.args = '-o extract.fa' + } +} diff --git a/modules/nf-core/samtools/faidx/tests/tags.yml b/modules/nf-core/samtools/faidx/tests/tags.yml new file mode 100644 index 00000000..e4a83948 --- /dev/null +++ b/modules/nf-core/samtools/faidx/tests/tags.yml @@ -0,0 +1,2 @@ +samtools/faidx: + - modules/nf-core/samtools/faidx/** diff --git a/modules/nf-core/samtools/sort/main.nf b/modules/nf-core/samtools/sort/main.nf index cdd8305d..fc374f98 100644 --- a/modules/nf-core/samtools/sort/main.nf +++ b/modules/nf-core/samtools/sort/main.nf @@ -8,11 +8,14 @@ process SAMTOOLS_SORT { 'biocontainers/samtools:1.19.2--h50ea8bc_0' }" input: - tuple val(meta), path(bam) + tuple val(meta) , path(bam) + tuple val(meta2), path(fasta) output: - tuple val(meta), path("*.bam"), emit: bam - tuple val(meta), path("*.csi"), emit: csi, optional: true + tuple val(meta), path("*.bam"), emit: bam, optional: true + tuple val(meta), path("*.cram"), emit: cram, optional: true + tuple val(meta), path("*.crai"), emit: crai, optional: true + tuple val(meta), path("*.csi"), emit: csi, optional: true path "versions.yml" , emit: versions when: @@ -21,14 +24,24 @@ process SAMTOOLS_SORT { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def extension = args.contains("--output-fmt sam") ? "sam" : + args.contains("--output-fmt cram") ? "cram" : + "bam" + def reference = fasta ? "--reference ${fasta}" : "" if ("$bam" == "${prefix}.bam") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + """ + samtools cat \\ + --threads $task.cpus \\ + ${bam} \\ + | \\ samtools sort \\ $args \\ - -@ $task.cpus \\ - -o ${prefix}.bam \\ - -T $prefix \\ - $bam + -T ${prefix} \\ + --threads $task.cpus \\ + ${reference} \\ + -o ${prefix}.${extension} \\ + - cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -40,6 +53,7 @@ process SAMTOOLS_SORT { def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.bam + touch ${prefix}.bam.csi cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/samtools/sort/meta.yml b/modules/nf-core/samtools/sort/meta.yml index 2200de72..341a7d0e 100644 --- a/modules/nf-core/samtools/sort/meta.yml +++ b/modules/nf-core/samtools/sort/meta.yml @@ -23,8 +23,18 @@ input: e.g. [ id:'test', single_end:false ] - bam: type: file - description: BAM/CRAM/SAM file + description: BAM/CRAM/SAM file(s) pattern: "*.{bam,cram,sam}" + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference genome FASTA file + pattern: "*.{fa,fasta,fna}" + optional: true output: - meta: type: map @@ -33,19 +43,29 @@ output: e.g. [ id:'test', single_end:false ] - bam: type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - - versions: + description: Sorted BAM file + pattern: "*.{bam}" + - cram: type: file - description: File containing software versions - pattern: "versions.yml" + description: Sorted CRAM file + pattern: "*.{cram}" + - crai: + type: file + description: CRAM index file (optional) + pattern: "*.crai" - csi: type: file description: BAM index file (optional) pattern: "*.csi" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" authors: - "@drpatelh" - "@ewels" + - "@matthdsm" maintainers: - "@drpatelh" - "@ewels" + - "@matthdsm" diff --git a/modules/nf-core/samtools/sort/tests/main.nf.test b/modules/nf-core/samtools/sort/tests/main.nf.test index 31e24b88..8360e2b1 100644 --- a/modules/nf-core/samtools/sort/tests/main.nf.test +++ b/modules/nf-core/samtools/sort/tests/main.nf.test @@ -13,15 +13,43 @@ nextflow_process { config "./nextflow.config" when { - params { - outdir = "$outputDir" + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) + ]) + input[1] = Channel.of([ + [ id:'fasta' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + """ } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("cram") { + + config "./nextflow.config" + + when { process { """ input[0] = Channel.of([ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) ]) + input[1] = Channel.of([ + [ id:'fasta' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } @@ -37,7 +65,7 @@ nextflow_process { test("bam_stub") { config "./nextflow.config" - options "-stub-run" + options "-stub" when { params { @@ -49,6 +77,10 @@ nextflow_process { [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.bam', checkIfExists: true) ]) + input[1] = Channel.of([ + [ id:'fasta' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } diff --git a/modules/nf-core/samtools/sort/tests/main.nf.test.snap b/modules/nf-core/samtools/sort/tests/main.nf.test.snap index a7cf0210..38477656 100644 --- a/modules/nf-core/samtools/sort/tests/main.nf.test.snap +++ b/modules/nf-core/samtools/sort/tests/main.nf.test.snap @@ -1,4 +1,69 @@ { + "cram": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "4": [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "versions": [ + "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-04T15:08:00.830294" + }, "bam_stub_bam": { "content": [ "test.sorted.bam" @@ -30,13 +95,25 @@ "id": "test", "single_end": false }, - "test.sorted.bam:md5,c6ea1346ec4aae007eb40b708935088c" + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" ] ], "1": [ ], "2": [ + + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] + ], + "4": [ "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" ], "bam": [ @@ -45,11 +122,23 @@ "id": "test", "single_end": false }, - "test.sorted.bam:md5,c6ea1346ec4aae007eb40b708935088c" + "test.sorted.bam:md5,bc0b7c25da26384a006ed84cc9e4da23" ] ], - "csi": [ + "crai": [ + + ], + "cram": [ + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sorted.bam.csi:md5,8d4e836c2fed6c0bf874d5e8cdba5831" + ] ], "versions": [ "versions.yml:md5,e6d43fefc9a8bff91c2ce6e3a1716eca" @@ -58,8 +147,8 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-13T16:14:52.736359271" + "timestamp": "2024-03-04T15:07:48.773803" } } \ No newline at end of file diff --git a/modules/nf-core/samtools/sort/tests/nextflow.config b/modules/nf-core/samtools/sort/tests/nextflow.config index d0f35086..f642771f 100644 --- a/modules/nf-core/samtools/sort/tests/nextflow.config +++ b/modules/nf-core/samtools/sort/tests/nextflow.config @@ -1,7 +1,8 @@ process { withName: SAMTOOLS_SORT { - ext.prefix = { "${meta.id}.sorted" } + ext.prefix = { "${meta.id}.sorted" } + ext.args = "--write-index" } } diff --git a/modules/nf-core/sentieon/bwaindex/environment.yml b/modules/nf-core/sentieon/bwaindex/environment.yml index ce0a85e4..c806ed0e 100644 --- a/modules/nf-core/sentieon/bwaindex/environment.yml +++ b/modules/nf-core/sentieon/bwaindex/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/bwaindex/main.nf b/modules/nf-core/sentieon/bwaindex/main.nf index e36dcc34..f5e8b582 100644 --- a/modules/nf-core/sentieon/bwaindex/main.nf +++ b/modules/nf-core/sentieon/bwaindex/main.nf @@ -5,8 +5,8 @@ process SENTIEON_BWAINDEX { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(fasta) diff --git a/modules/nf-core/sentieon/bwamem/environment.yml b/modules/nf-core/sentieon/bwamem/environment.yml index c090bfa5..f03db6f8 100644 --- a/modules/nf-core/sentieon/bwamem/environment.yml +++ b/modules/nf-core/sentieon/bwamem/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/bwamem/main.nf b/modules/nf-core/sentieon/bwamem/main.nf index 230297d0..62693851 100644 --- a/modules/nf-core/sentieon/bwamem/main.nf +++ b/modules/nf-core/sentieon/bwamem/main.nf @@ -7,8 +7,8 @@ process SENTIEON_BWAMEM { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(reads) diff --git a/modules/nf-core/sentieon/datametrics/environment.yml b/modules/nf-core/sentieon/datametrics/environment.yml index df094207..b5ea91f6 100644 --- a/modules/nf-core/sentieon/datametrics/environment.yml +++ b/modules/nf-core/sentieon/datametrics/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/datametrics/main.nf b/modules/nf-core/sentieon/datametrics/main.nf index d1678187..bc55d275 100644 --- a/modules/nf-core/sentieon/datametrics/main.nf +++ b/modules/nf-core/sentieon/datametrics/main.nf @@ -7,8 +7,8 @@ process SENTIEON_DATAMETRICS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(bam), path(bai) diff --git a/modules/nf-core/sentieon/dedup/environment.yml b/modules/nf-core/sentieon/dedup/environment.yml index 622cf739..e29cfff3 100644 --- a/modules/nf-core/sentieon/dedup/environment.yml +++ b/modules/nf-core/sentieon/dedup/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/dedup/main.nf b/modules/nf-core/sentieon/dedup/main.nf index fbcd595f..5f19ab56 100644 --- a/modules/nf-core/sentieon/dedup/main.nf +++ b/modules/nf-core/sentieon/dedup/main.nf @@ -7,8 +7,8 @@ process SENTIEON_DEDUP { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(bam), path(bai) diff --git a/modules/nf-core/sentieon/dnamodelapply/environment.yml b/modules/nf-core/sentieon/dnamodelapply/environment.yml index 6d27d44a..a2f88193 100644 --- a/modules/nf-core/sentieon/dnamodelapply/environment.yml +++ b/modules/nf-core/sentieon/dnamodelapply/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/dnamodelapply/main.nf b/modules/nf-core/sentieon/dnamodelapply/main.nf index b728a5ec..9a0c70dc 100644 --- a/modules/nf-core/sentieon/dnamodelapply/main.nf +++ b/modules/nf-core/sentieon/dnamodelapply/main.nf @@ -7,8 +7,8 @@ process SENTIEON_DNAMODELAPPLY { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(vcf), path(idx) diff --git a/modules/nf-core/sentieon/dnascope/environment.yml b/modules/nf-core/sentieon/dnascope/environment.yml index 45c2116c..e6da2dde 100644 --- a/modules/nf-core/sentieon/dnascope/environment.yml +++ b/modules/nf-core/sentieon/dnascope/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/dnascope/main.nf b/modules/nf-core/sentieon/dnascope/main.nf index 6adea35e..0671307b 100644 --- a/modules/nf-core/sentieon/dnascope/main.nf +++ b/modules/nf-core/sentieon/dnascope/main.nf @@ -7,8 +7,8 @@ process SENTIEON_DNASCOPE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(bam), path(bai), path(intervals) diff --git a/modules/nf-core/sentieon/readwriter/environment.yml b/modules/nf-core/sentieon/readwriter/environment.yml index 67dd1505..423de42d 100644 --- a/modules/nf-core/sentieon/readwriter/environment.yml +++ b/modules/nf-core/sentieon/readwriter/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/readwriter/main.nf b/modules/nf-core/sentieon/readwriter/main.nf index 0bace538..c12ca2f9 100644 --- a/modules/nf-core/sentieon/readwriter/main.nf +++ b/modules/nf-core/sentieon/readwriter/main.nf @@ -7,8 +7,8 @@ process SENTIEON_READWRITER { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(input), path(index) diff --git a/modules/nf-core/sentieon/wgsmetrics/environment.yml b/modules/nf-core/sentieon/wgsmetrics/environment.yml index 24878e29..a33a3fcc 100644 --- a/modules/nf-core/sentieon/wgsmetrics/environment.yml +++ b/modules/nf-core/sentieon/wgsmetrics/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::sentieon=202308.01 + - bioconda::sentieon=202308.02 diff --git a/modules/nf-core/sentieon/wgsmetrics/main.nf b/modules/nf-core/sentieon/wgsmetrics/main.nf index a028e4a1..811c0077 100644 --- a/modules/nf-core/sentieon/wgsmetrics/main.nf +++ b/modules/nf-core/sentieon/wgsmetrics/main.nf @@ -7,8 +7,8 @@ process SENTIEON_WGSMETRICS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sentieon:202308.01--h43eeafb_0' : - 'biocontainers/sentieon:202308.01--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/sentieon:202308.02--h43eeafb_0' : + 'biocontainers/sentieon:202308.02--h43eeafb_0' }" input: tuple val(meta), path(bam), path(bai) diff --git a/modules/nf-core/tiddit/sv/main.nf b/modules/nf-core/tiddit/sv/main.nf index 0f4bc7cb..f350e314 100644 --- a/modules/nf-core/tiddit/sv/main.nf +++ b/modules/nf-core/tiddit/sv/main.nf @@ -31,6 +31,7 @@ process TIDDIT_SV { tiddit \\ --sv \\ $args \\ + --threads $task.cpus \\ --bam $input \\ --ref $fasta \\ -o $prefix diff --git a/modules/nf-core/tiddit/sv/meta.yml b/modules/nf-core/tiddit/sv/meta.yml index b13ae5cd..bfcbc4e3 100644 --- a/modules/nf-core/tiddit/sv/meta.yml +++ b/modules/nf-core/tiddit/sv/meta.yml @@ -21,14 +21,24 @@ input: type: file description: BAM/CRAM file pattern: "*.{bam,cram}" - - index: + - input_index: type: file description: BAM/CRAM index file pattern: "*.{bai,crai}" + - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test_fasta']` - fasta: type: file description: Input FASTA file pattern: "*.{fasta,fa}" + - meta3: + type: map + description: | + Groovy Map containing sample information from bwa index + e.g. `[ id:'test_bwa-index' ]` - bwa_index: type: file description: BWA genome index files diff --git a/modules/nf-core/tiddit/sv/tests/main.nf.test b/modules/nf-core/tiddit/sv/tests/main.nf.test new file mode 100644 index 00000000..6e32b9e1 --- /dev/null +++ b/modules/nf-core/tiddit/sv/tests/main.nf.test @@ -0,0 +1,193 @@ +nextflow_process { + + name "Test Process TIDDIT_SV" + script "../main.nf" + process "TIDDIT_SV" + + tag "modules" + tag "modules_nfcore" + tag "tiddit" + tag "tiddit/sv" + tag "bwa/index" + + test("sarscov2 - bam - bwa") { + + setup { + + run("BWA_INDEX") { + script "../../../../nf-core/bwa/index/main.nf" + process { + """ + input[0] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + // fasta + input[1] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + // bwa_index + input[2] = BWA_INDEX.out.index + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") }, + { assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") }, + { assert snapshot(process.out.versions).match("bam_bwa_version") } + ) + } + + } + + test("sarscov2 - bam - no_bwa") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + // fasta + input[1] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + // bwa_index + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") }, + { assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") }, + { assert snapshot(process.out.versions).match("bam_version") } + ) + } + + } + + test("human - cram - bwa") { + + setup { + + run("BWA_INDEX") { + script "../../../../nf-core/bwa/index/main.nf" + process { + """ + input[0] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true) + ] + // fasta + input[1] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + // bwa_index + input[2] = BWA_INDEX.out.index + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") }, + { assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") }, + { assert snapshot(process.out.versions).match("cram_bwa_version") }) + } + + } + + test("human - cram - no_bwa") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/cram/test.paired_end.sorted.cram.crai', checkIfExists: true) + ] + // fasta + input[1] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ] + // bwa_index + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.1") }, + { assert path(process.out.ploidy.get(0).get(1)).readLines().contains("Chromosome Ploidy Ploidy_rounded Mean_coverage") }, + { assert snapshot(process.out.versions).match("cram_version") }) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + // fasta + input[1] = [ [id: 'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + // bwa_index + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/tiddit/sv/tests/main.nf.test.snap b/modules/nf-core/tiddit/sv/tests/main.nf.test.snap new file mode 100644 index 00000000..541c48bb --- /dev/null +++ b/modules/nf-core/tiddit/sv/tests/main.nf.test.snap @@ -0,0 +1,99 @@ +{ + "cram_bwa_version": { + "content": [ + [ + "versions.yml:md5,0ffcce416e40bcc98da2243f1d7e348a" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-22T10:33:01.300519" + }, + "cram_version": { + "content": [ + [ + "versions.yml:md5,0ffcce416e40bcc98da2243f1d7e348a" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-22T10:27:12.52902" + }, + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.ploidies.tab:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,0ffcce416e40bcc98da2243f1d7e348a" + ], + "ploidy": [ + [ + { + "id": "test" + }, + "test.ploidies.tab:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,0ffcce416e40bcc98da2243f1d7e348a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-22T10:21:51.950503" + }, + "bam_bwa_version": { + "content": [ + [ + "versions.yml:md5,0ffcce416e40bcc98da2243f1d7e348a" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-22T10:31:40.918479" + }, + "bam_version": { + "content": [ + [ + "versions.yml:md5,0ffcce416e40bcc98da2243f1d7e348a" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-22T10:21:38.449053" + } +} \ No newline at end of file diff --git a/modules/nf-core/tiddit/sv/tests/nextflow.config b/modules/nf-core/tiddit/sv/tests/nextflow.config new file mode 100644 index 00000000..9bbd0bee --- /dev/null +++ b/modules/nf-core/tiddit/sv/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: 'TIDDIT_SV' { + ext.args = '--skip_assembly' + } +} diff --git a/modules/nf-core/tiddit/sv/tests/tags.yml b/modules/nf-core/tiddit/sv/tests/tags.yml new file mode 100644 index 00000000..aac5351e --- /dev/null +++ b/modules/nf-core/tiddit/sv/tests/tags.yml @@ -0,0 +1,2 @@ +tiddit/sv: + - "modules/nf-core/tiddit/sv/**" diff --git a/nextflow.config b/nextflow.config index 2df0fde4..928d3a8c 100644 --- a/nextflow.config +++ b/nextflow.config @@ -22,7 +22,9 @@ params { // Main options analysis_type = 'wgs' + bwa_as_fallback = false bait_padding = 100 + run_mt_for_wes = false run_rtgvcfeval = false save_mapped_as_cram = false skip_eklipse = false @@ -32,6 +34,7 @@ params { skip_germlinecnvcaller = false skip_haplocheck = false skip_peddy = false + skip_me_calling = false skip_me_annotation = false skip_mt_annotation = false skip_qualimap = false @@ -77,15 +80,16 @@ params { multiqc_methods_description = null // Boilerplate options - outdir = 'results' - publish_dir_mode = 'copy' - email = null - email_on_fail = null - plaintext_email = false - monochrome_logs = false - hook_url = null - help = false - version = false + outdir = null + publish_dir_mode = 'copy' + email = null + email_on_fail = null + plaintext_email = false + monochrome_logs = false + hook_url = null + help = false + version = false + pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/' // Config options config_profile_name = null @@ -128,95 +132,102 @@ try { } profiles { debug { - dumpHashes = true - process.beforeScript = 'echo $HOSTNAME' - cleanup = false + dumpHashes = true + process.beforeScript = 'echo $HOSTNAME' + cleanup = false nextflow.enable.configProcessNamesValidation = true } conda { - conda.enabled = true - docker.enabled = false - singularity.enabled = false - podman.enabled = false - shifter.enabled = false - charliecloud.enabled = false - channels = ['conda-forge', 'bioconda', 'defaults'] - apptainer.enabled = false + conda.enabled = true + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + conda.channels = ['conda-forge', 'bioconda', 'defaults'] + apptainer.enabled = false } mamba { - conda.enabled = true - conda.useMamba = true - docker.enabled = false - singularity.enabled = false - podman.enabled = false - shifter.enabled = false - charliecloud.enabled = false - apptainer.enabled = false + conda.enabled = true + conda.useMamba = true + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + apptainer.enabled = false } docker { - docker.enabled = true - conda.enabled = false - singularity.enabled = false - podman.enabled = false - shifter.enabled = false - charliecloud.enabled = false - apptainer.enabled = false - docker.runOptions = '-u $(id -u):$(id -g)' + docker.enabled = true + conda.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + apptainer.enabled = false + docker.runOptions = '-u $(id -u):$(id -g)' } arm { - docker.runOptions = '-u $(id -u):$(id -g) --platform=linux/amd64' + docker.runOptions = '-u $(id -u):$(id -g) --platform=linux/amd64' } singularity { - singularity.enabled = true - singularity.autoMounts = true - conda.enabled = false - docker.enabled = false - podman.enabled = false - shifter.enabled = false - charliecloud.enabled = false - apptainer.enabled = false + singularity.enabled = true + singularity.autoMounts = true + conda.enabled = false + docker.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + apptainer.enabled = false } podman { - podman.enabled = true - conda.enabled = false - docker.enabled = false - singularity.enabled = false - shifter.enabled = false - charliecloud.enabled = false - apptainer.enabled = false + podman.enabled = true + conda.enabled = false + docker.enabled = false + singularity.enabled = false + shifter.enabled = false + charliecloud.enabled = false + apptainer.enabled = false } shifter { - shifter.enabled = true - conda.enabled = false - docker.enabled = false - singularity.enabled = false - podman.enabled = false - charliecloud.enabled = false - apptainer.enabled = false + shifter.enabled = true + conda.enabled = false + docker.enabled = false + singularity.enabled = false + podman.enabled = false + charliecloud.enabled = false + apptainer.enabled = false } charliecloud { - charliecloud.enabled = true - conda.enabled = false - docker.enabled = false - singularity.enabled = false - podman.enabled = false - shifter.enabled = false - apptainer.enabled = false + charliecloud.enabled = true + conda.enabled = false + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + apptainer.enabled = false } apptainer { - apptainer.enabled = true - apptainer.autoMounts = true - conda.enabled = false - docker.enabled = false - singularity.enabled = false - podman.enabled = false - shifter.enabled = false - charliecloud.enabled = false + apptainer.enabled = true + apptainer.autoMounts = true + conda.enabled = false + docker.enabled = false + singularity.enabled = false + podman.enabled = false + shifter.enabled = false + charliecloud.enabled = false + } + wave { + apptainer.ociAutoPull = true + singularity.ociAutoPull = true + wave.enabled = true + wave.freeze = true + wave.strategy = 'conda,container' } gitpod { - executor.name = 'local' - executor.cpus = 4 - executor.memory = 8.GB + executor.name = 'local' + executor.cpus = 4 + executor.memory = 8.GB } test { includeConfig 'conf/test.config' } test_full { includeConfig 'conf/test_full.config' } @@ -293,7 +304,7 @@ manifest { description = """call and score variants from WGS/WES of rare disease patients""" mainScript = 'main.nf' nextflowVersion = '!>=23.04.0' - version = '2.0.1' + version = '2.1.0' doi = '' } @@ -316,7 +327,7 @@ includeConfig 'conf/modules/qc_bam.config' includeConfig 'conf/modules/rank_variants.config' includeConfig 'conf/modules/scatter_genome.config' includeConfig 'conf/modules/align_MT.config' -includeConfig 'conf/modules/align_bwa_bwamem2.config' +includeConfig 'conf/modules/align_bwa_bwamem2_bwameme.config' includeConfig 'conf/modules/align_sentieon.config' includeConfig 'conf/modules/annotate_cadd.config' includeConfig 'conf/modules/call_snv_MT.config' diff --git a/nextflow_schema.json b/nextflow_schema.json index 6e2fbc81..80cdfd11 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -27,8 +27,7 @@ "type": "string", "format": "directory-path", "description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.", - "fa_icon": "fas fa-folder-open", - "default": "results" + "fa_icon": "fas fa-folder-open" }, "email": { "type": "string", @@ -75,6 +74,14 @@ "help_text": "If none provided, will be generated automatically from the FASTA reference.", "fa_icon": "fas fa-folder-open" }, + "bwameme": { + "type": "string", + "exists": true, + "format": "directory-path", + "description": "Directory for pre-built bwameme's learned index.", + "help_text": "If none provided, will be generated automatically from the FASTA reference.", + "fa_icon": "fas fa-folder-open" + }, "cadd_resources": { "type": "string", "exists": true, @@ -466,6 +473,12 @@ "fa_icon": "fas fa-align-center", "enum": ["wgs", "wes", "mito"] }, + "bwa_as_fallback": { + "type": "boolean", + "description": "Specifies whether or not to use bwa as a fallback aligner in case bwamem2 throws an error.", + "help_text": "errorStrategy needs to be set to ignore for the bwamem2 process for the fallback to work. Turned off by default.", + "fa_icon": "fas fa-toggle-on" + }, "platform": { "type": "string", "default": "illumina", @@ -480,6 +493,11 @@ "fa_icon": "fas fa-align-center", "enum": ["xy", "hetx", "sry"] }, + "run_mt_for_wes": { + "type": "boolean", + "description": "Specifies whether to run mitochondrial analysis for wes samples", + "fa_icon": "fas fa-toggle-on" + }, "run_rtgvcfeval": { "type": "boolean", "description": "Specifies whether to run rtgtools' vcfeval", @@ -530,9 +548,14 @@ "description": "Specifies whether or not to skip Qualimap.", "fa_icon": "fas fa-toggle-on" }, + "skip_me_calling": { + "type": "boolean", + "description": "Specifies whether or not to skip calling mobile elements, and the subsequent annotation step.", + "fa_icon": "fas fa-toggle-on" + }, "skip_me_annotation": { "type": "boolean", - "description": "Specifies whether or not to skip annotation of mobile_elements.", + "description": "Specifies whether or not to skip annotation of mobile elements.", "fa_icon": "fas fa-toggle-on" }, "skip_mt_annotation": { @@ -580,7 +603,7 @@ "default": "bwamem2", "description": "Specifies the alignment algorithm to use - available options are 'bwamem2' and 'sentieon'.", "fa_icon": "fas fa-align-center", - "enum": ["bwa", "bwamem2", "sentieon"] + "enum": ["bwa", "bwamem2", "bwameme", "sentieon"] }, "min_trimmed_length": { "type": "integer", @@ -876,6 +899,13 @@ "description": "Validation of parameters in lenient more.", "hidden": true, "help_text": "Allows string values that are parseable as numbers or booleans. For further information see [JSONSchema docs](https://github.com/everit-org/json-schema#lenient-mode)." + }, + "pipelines_testdata_base_path": { + "type": "string", + "fa_icon": "far fa-check-circle", + "description": "Base URL or local path to location of pipeline test dataset files", + "default": "https://raw.githubusercontent.com/nf-core/test-datasets/", + "hidden": true } } } diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 56110621..00000000 --- a/pyproject.toml +++ /dev/null @@ -1,15 +0,0 @@ -# Config file for Python. Mostly used to configure linting of bin/*.py with Ruff. -# Should be kept the same as nf-core/tools to avoid fighting with template synchronisation. -[tool.ruff] -line-length = 120 -target-version = "py38" -cache-dir = "~/.cache/ruff" - -[tool.ruff.lint] -select = ["I", "E1", "E4", "E7", "E9", "F", "UP", "N"] - -[tool.ruff.lint.isort] -known-first-party = ["nf_core"] - -[tool.ruff.lint.per-file-ignores] -"__init__.py" = ["E402", "F401"] diff --git a/subworkflows/local/align.nf b/subworkflows/local/align.nf index 51bbf3fb..8822d1cb 100644 --- a/subworkflows/local/align.nf +++ b/subworkflows/local/align.nf @@ -3,7 +3,7 @@ // include { FASTP } from '../../modules/nf-core/fastp/main' -include { ALIGN_BWA_BWAMEM2 } from './alignment/align_bwa_bwamem2' +include { ALIGN_BWA_BWAMEM2_BWAMEME } from './alignment/align_bwa_bwamem2_bwameme' include { ALIGN_SENTIEON } from './alignment/align_sentieon' include { SAMTOOLS_VIEW } from '../../modules/nf-core/samtools/view/main' include { ALIGN_MT } from './alignment/align_MT' @@ -17,21 +17,29 @@ workflow ALIGN { ch_genome_fai // channel: [mandatory] [ val(meta), path(fai) ] ch_genome_bwaindex // channel: [mandatory] [ val(meta), path(index) ] ch_genome_bwamem2index // channel: [mandatory] [ val(meta), path(index) ] + ch_genome_bwamemeindex // channel: [mandatory] [ val(meta), path(index) ] ch_genome_dictionary // channel: [mandatory] [ val(meta), path(dict) ] ch_mtshift_bwaindex // channel: [mandatory] [ val(meta), path(index) ] ch_mtshift_bwamem2index // channel: [mandatory] [ val(meta), path(index) ] + ch_mtshift_bwamemeindex // channel: [mandatory] [ val(meta), path(index) ] ch_mtshift_fasta // channel: [mandatory] [ val(meta), path(fasta) ] ch_mtshift_dictionary // channel: [mandatory] [ val(meta), path(dict) ] ch_mtshift_fai // channel: [mandatory] [ val(meta), path(fai) ] val_platform // string: [mandatory] illumina or a different technology main: - ch_versions = Channel.empty() - ch_fastp_json = Channel.empty() - ch_bwamem2_bam = Channel.empty() - ch_sentieon_bam = Channel.empty() - ch_bwamem2_bai = Channel.empty() - ch_sentieon_bai = Channel.empty() + ch_bwamem2_bam = Channel.empty() + ch_bwamem2_bai = Channel.empty() + ch_fastp_json = Channel.empty() + ch_mt_bam_bai = Channel.empty() + ch_mt_marked_bam = Channel.empty() + ch_mt_marked_bai = Channel.empty() + ch_mtshift_bam_bai = Channel.empty() + ch_mtshift_marked_bam = Channel.empty() + ch_mtshift_marked_bai = Channel.empty() + ch_sentieon_bam = Channel.empty() + ch_sentieon_bai = Channel.empty() + ch_versions = Channel.empty() if (!params.skip_fastp) { FASTP (ch_reads, [], false, false) @@ -40,18 +48,19 @@ workflow ALIGN { ch_fastp_json = FASTP.out.json } - if (params.aligner.equals("bwamem2") || params.aligner.equals("bwa")) { - ALIGN_BWA_BWAMEM2 ( // Triggered when params.aligner is set as bwamem2 or bwa + if (params.aligner.matches("bwamem2|bwa|bwameme")) { + ALIGN_BWA_BWAMEM2_BWAMEME ( // Triggered when params.aligner is set as bwamem2 or bwa or bwameme ch_reads, ch_genome_bwaindex, ch_genome_bwamem2index, + ch_genome_bwamemeindex, ch_genome_fasta, ch_genome_fai, val_platform ) - ch_bwamem2_bam = ALIGN_BWA_BWAMEM2.out.marked_bam - ch_bwamem2_bai = ALIGN_BWA_BWAMEM2.out.marked_bai - ch_versions = ch_versions.mix(ALIGN_BWA_BWAMEM2.out.versions) + ch_bwamem2_bam = ALIGN_BWA_BWAMEM2_BWAMEME.out.marked_bam + ch_bwamem2_bai = ALIGN_BWA_BWAMEM2_BWAMEME.out.marked_bai + ch_versions = ch_versions.mix(ALIGN_BWA_BWAMEM2_BWAMEME.out.versions) } else if (params.aligner.equals("sentieon")) { ALIGN_SENTIEON ( // Triggered when params.aligner is set as sentieon ch_reads, @@ -62,7 +71,7 @@ workflow ALIGN { ) ch_sentieon_bam = ALIGN_SENTIEON.out.marked_bam ch_sentieon_bai = ALIGN_SENTIEON.out.marked_bai - ch_versions = ch_versions.mix(ALIGN_SENTIEON.out.versions) + ch_versions = ch_versions.mix(ALIGN_SENTIEON.out.versions) } ch_genome_marked_bam = Channel.empty().mix(ch_bwamem2_bam, ch_sentieon_bam) @@ -70,48 +79,52 @@ workflow ALIGN { ch_genome_bam_bai = ch_genome_marked_bam.join(ch_genome_marked_bai, failOnMismatch:true, failOnDuplicate:true) // PREPARING READS FOR MT ALIGNMENT - CONVERT_MT_BAM_TO_FASTQ ( - ch_genome_bam_bai, - ch_genome_fasta, - ch_genome_fai, - ch_genome_dictionary - ) - ALIGN_MT ( - CONVERT_MT_BAM_TO_FASTQ.out.fastq, - CONVERT_MT_BAM_TO_FASTQ.out.bam, - ch_genome_bwaindex, - ch_genome_bwamem2index, - ch_genome_fasta, - ch_genome_dictionary, - ch_genome_fai - ) + if (params.analysis_type.equals("wgs") || params.run_mt_for_wes) { + CONVERT_MT_BAM_TO_FASTQ ( + ch_genome_bam_bai, + ch_genome_fasta, + ch_genome_fai, + ch_genome_dictionary + ) - ALIGN_MT_SHIFT ( - CONVERT_MT_BAM_TO_FASTQ.out.fastq, - CONVERT_MT_BAM_TO_FASTQ.out.bam, - ch_mtshift_bwaindex, - ch_mtshift_bwamem2index, - ch_mtshift_fasta, - ch_mtshift_dictionary, - ch_mtshift_fai - ) + ALIGN_MT ( + CONVERT_MT_BAM_TO_FASTQ.out.fastq, + CONVERT_MT_BAM_TO_FASTQ.out.bam, + ch_genome_bwaindex, + ch_genome_bwamem2index, + ch_genome_bwamemeindex, + ch_genome_fasta, + ch_genome_dictionary, + ch_genome_fai + ) - ch_mt_marked_bam = ALIGN_MT.out.marked_bam - ch_mt_marked_bai = ALIGN_MT.out.marked_bai - ch_mt_bam_bai = ch_mt_marked_bam.join(ch_mt_marked_bai, failOnMismatch:true, failOnDuplicate:true) + ALIGN_MT_SHIFT ( + CONVERT_MT_BAM_TO_FASTQ.out.fastq, + CONVERT_MT_BAM_TO_FASTQ.out.bam, + ch_mtshift_bwaindex, + ch_mtshift_bwamem2index, + ch_mtshift_bwamemeindex, + ch_mtshift_fasta, + ch_mtshift_dictionary, + ch_mtshift_fai + ) - ch_mtshift_marked_bam = ALIGN_MT_SHIFT.out.marked_bam - ch_mtshift_marked_bai = ALIGN_MT_SHIFT.out.marked_bai - ch_mtshift_bam_bai = ch_mtshift_marked_bam.join(ch_mtshift_marked_bai, failOnMismatch:true, failOnDuplicate:true) + ch_mt_marked_bam = ALIGN_MT.out.marked_bam + ch_mt_marked_bai = ALIGN_MT.out.marked_bai + ch_mt_bam_bai = ch_mt_marked_bam.join(ch_mt_marked_bai, failOnMismatch:true, failOnDuplicate:true) + ch_mtshift_marked_bam = ALIGN_MT_SHIFT.out.marked_bam + ch_mtshift_marked_bai = ALIGN_MT_SHIFT.out.marked_bai + ch_mtshift_bam_bai = ch_mtshift_marked_bam.join(ch_mtshift_marked_bai, failOnMismatch:true, failOnDuplicate:true) + ch_versions = ch_versions.mix(ALIGN_MT.out.versions, + ALIGN_MT_SHIFT.out.versions, + CONVERT_MT_BAM_TO_FASTQ.out.versions) + } if (params.save_mapped_as_cram) { SAMTOOLS_VIEW( ch_genome_bam_bai, ch_genome_fasta, [] ) ch_versions = ch_versions.mix(SAMTOOLS_VIEW.out.versions) } - ch_versions = ch_versions.mix(ALIGN_MT.out.versions, - ALIGN_MT_SHIFT.out.versions, - CONVERT_MT_BAM_TO_FASTQ.out.versions) emit: fastp_json = ch_fastp_json // channel: [ val(meta), path(json) ] diff --git a/subworkflows/local/alignment/align_MT.nf b/subworkflows/local/alignment/align_MT.nf index 8f7930c7..d2a9581d 100644 --- a/subworkflows/local/alignment/align_MT.nf +++ b/subworkflows/local/alignment/align_MT.nf @@ -5,6 +5,7 @@ include { BWA_MEM as BWA_MEM_MT } from '../../../modules/nf-core/bwa/mem/main' include { SENTIEON_BWAMEM as SENTIEON_BWAMEM_MT } from '../../../modules/nf-core/sentieon/bwamem/main' include { BWAMEM2_MEM as BWAMEM2_MEM_MT } from '../../../modules/nf-core/bwamem2/mem/main' +include { BWAMEME_MEM as BWAMEME_MEM_MT } from '../../../modules/nf-core/bwameme/mem/main' include { GATK4_MERGEBAMALIGNMENT as GATK4_MERGEBAMALIGNMENT_MT } from '../../../modules/nf-core/gatk4/mergebamalignment/main' include { PICARD_ADDORREPLACEREADGROUPS as PICARD_ADDORREPLACEREADGROUPS_MT } from '../../../modules/nf-core/picard/addorreplacereadgroups/main' include { PICARD_MARKDUPLICATES as PICARD_MARKDUPLICATES_MT } from '../../../modules/nf-core/picard/markduplicates/main' @@ -17,41 +18,42 @@ workflow ALIGN_MT { ch_ubam // channel: [mandatory] [ val(meta), path(bam) ] ch_bwaindex // channel: [mandatory for sentieon] [ val(meta), path(index) ] ch_bwamem2index // channel: [mandatory for bwamem2] [ val(meta), path(index) ] + ch_bwamemeindex // channel: [mandatory for bwameme] [ val(meta), path(index) ] ch_fasta // channel: [mandatory] [ val(meta), path(fasta) ] ch_dict // channel: [mandatory] [ val(meta), path(dict) ] ch_fai // channel: [mandatory] [ val(meta), path(fai) ] main: ch_versions = Channel.empty() - ch_bwa_bam = Channel.empty() - ch_bwamem2_bam = Channel.empty() - ch_sentieon_bam = Channel.empty() if (params.aligner.equals("bwamem2")) { - BWAMEM2_MEM_MT (ch_fastq, ch_bwamem2index, true) - ch_bwamem2_bam = BWAMEM2_MEM_MT.out.bam + BWAMEM2_MEM_MT (ch_fastq, ch_bwamem2index, ch_fasta, true) + ch_align = BWAMEM2_MEM_MT.out.bam ch_versions = ch_versions.mix(BWAMEM2_MEM_MT.out.versions.first()) } else if (params.aligner.equals("sentieon")) { SENTIEON_BWAMEM_MT ( ch_fastq, ch_bwaindex, ch_fasta, ch_fai ) - ch_sentieon_bam = SENTIEON_BWAMEM_MT.out.bam_and_bai.map{ meta, bam, bai -> [meta, bam] } - ch_versions = ch_versions.mix(SENTIEON_BWAMEM_MT.out.versions.first()) + ch_align = SENTIEON_BWAMEM_MT.out.bam_and_bai.map{ meta, bam, bai -> [meta, bam] } + ch_versions = ch_versions.mix(SENTIEON_BWAMEM_MT.out.versions.first()) } else if (params.aligner.equals("bwa")) { - BWA_MEM_MT ( ch_fastq, ch_bwaindex, true ) - ch_bwa_bam = BWA_MEM_MT.out.bam - ch_versions = ch_versions.mix(BWA_MEM_MT.out.versions.first()) + BWA_MEM_MT ( ch_fastq, ch_bwaindex, ch_fasta, true ) + ch_align = BWA_MEM_MT.out.bam + ch_versions = ch_versions.mix(BWA_MEM_MT.out.versions.first()) + } else if (params.aligner.equals("bwameme")) { + BWAMEME_MEM_MT (ch_fastq, ch_bwamemeindex, ch_fasta, true) + ch_align = BWAMEME_MEM_MT.out.bam + ch_versions = ch_versions.mix(BWAMEME_MEM_MT.out.versions.first()) } - Channel.empty() - .mix(ch_bwamem2_bam, ch_sentieon_bam, ch_bwa_bam) + ch_align .join(ch_ubam, failOnMismatch:true, failOnDuplicate:true) .set {ch_bam_ubam} GATK4_MERGEBAMALIGNMENT_MT (ch_bam_ubam, ch_fasta, ch_dict) - PICARD_ADDORREPLACEREADGROUPS_MT (GATK4_MERGEBAMALIGNMENT_MT.out.bam) + PICARD_ADDORREPLACEREADGROUPS_MT (GATK4_MERGEBAMALIGNMENT_MT.out.bam, [[:],[]], [[:],[]]) PICARD_MARKDUPLICATES_MT (PICARD_ADDORREPLACEREADGROUPS_MT.out.bam, ch_fasta, ch_fai) - SAMTOOLS_SORT_MT (PICARD_MARKDUPLICATES_MT.out.bam) + SAMTOOLS_SORT_MT (PICARD_MARKDUPLICATES_MT.out.bam, [[:],[]]) SAMTOOLS_INDEX_MT(SAMTOOLS_SORT_MT.out.bam) diff --git a/subworkflows/local/alignment/align_bwa_bwamem2.nf b/subworkflows/local/alignment/align_bwa_bwamem2_bwameme.nf similarity index 67% rename from subworkflows/local/alignment/align_bwa_bwamem2.nf rename to subworkflows/local/alignment/align_bwa_bwamem2_bwameme.nf index 10537898..7d635d51 100644 --- a/subworkflows/local/alignment/align_bwa_bwamem2.nf +++ b/subworkflows/local/alignment/align_bwa_bwamem2_bwameme.nf @@ -2,8 +2,10 @@ // Map to reference, fetch stats for each demultiplexed read pair, merge, mark duplicates, and index. // -include { BWA_MEM } from '../../../modules/nf-core/bwa/mem/main' +include { BWA_MEM as BWA } from '../../../modules/nf-core/bwa/mem/main' +include { BWA_MEM as BWAMEM_FALLBACK } from '../../../modules/nf-core/bwa/mem/main' include { BWAMEM2_MEM } from '../../../modules/nf-core/bwamem2/mem/main' +include { BWAMEME_MEM } from '../../../modules/nf-core/bwameme/mem/main' include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_ALIGN } from '../../../modules/nf-core/samtools/index/main' include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_MARKDUP } from '../../../modules/nf-core/samtools/index/main' include { SAMTOOLS_STATS } from '../../../modules/nf-core/samtools/stats/main' @@ -11,11 +13,12 @@ include { SAMTOOLS_MERGE } from '../../../modules/nf-c include { PICARD_MARKDUPLICATES as MARKDUPLICATES } from '../../../modules/nf-core/picard/markduplicates/main' -workflow ALIGN_BWA_BWAMEM2 { +workflow ALIGN_BWA_BWAMEM2_BWAMEME { take: ch_reads_input // channel: [mandatory] [ val(meta), path(reads_input) ] ch_bwa_index // channel: [mandatory] [ val(meta), path(bwamem2_index) ] ch_bwamem2_index // channel: [mandatory] [ val(meta), path(bwamem2_index) ] + ch_bwameme_index // channel: [mandatory] [ val(meta), path(bwamem2_index) ] ch_genome_fasta // channel: [mandatory] [ val(meta), path(fasta) ] ch_genome_fai // channel: [mandatory] [ val(meta), path(fai) ] val_platform // string: [mandatory] default: illumina @@ -25,13 +28,33 @@ workflow ALIGN_BWA_BWAMEM2 { // Map, sort, and index if (params.aligner.equals("bwa")) { - BWA_MEM ( ch_reads_input, ch_bwa_index, true ) - ch_align = BWA_MEM.out.bam - ch_versions = ch_versions.mix(BWA_MEM.out.versions.first()) + BWA ( ch_reads_input, ch_bwa_index, ch_genome_fasta, true ) + ch_align = BWA.out.bam + ch_versions = ch_versions.mix(BWA.out.versions.first()) + } else if (params.aligner.equals("bwameme")) { + BWAMEME_MEM ( ch_reads_input, ch_bwameme_index, ch_genome_fasta, true ) + ch_align = BWAMEME_MEM.out.bam + ch_versions = ch_versions.mix(BWAMEME_MEM.out.versions.first()) } else { - BWAMEM2_MEM ( ch_reads_input, ch_bwamem2_index, true ) - ch_align = BWAMEM2_MEM.out.bam + BWAMEM2_MEM ( ch_reads_input, ch_bwamem2_index, ch_genome_fasta, true ) + ch_align = BWAMEM2_MEM.out.bam ch_versions = ch_versions.mix(BWAMEM2_MEM.out.versions.first()) + + if (params.bwa_as_fallback) { + ch_reads_input + .join(BWAMEM2_MEM.out.bam, remainder: true) + .branch { it -> + ERROR: it[2].equals(null) + return [it[0], it[1]] // return reads + SUCCESS: !it[2].equals(null) + return [it[0], it[2]] // return bam + } + .set { ch_fallback } + + BWAMEM_FALLBACK ( ch_fallback.ERROR, ch_bwa_index, ch_genome_fasta, true ) + ch_align = ch_fallback.SUCCESS.mix(BWAMEM_FALLBACK.out.bam) + ch_versions = ch_versions.mix(BWAMEM_FALLBACK.out.versions.first()) + } } SAMTOOLS_INDEX_ALIGN ( ch_align ) @@ -44,7 +67,7 @@ workflow ALIGN_BWA_BWAMEM2 { ch_align .map{ meta, bam -> new_id = meta.sample - new_meta = meta + [id:new_id, read_group:"\'@RG\\tID:" + new_id + "\\tPL:" + val_platform + "\\tSM:" + new_id + "\'"] + new_meta = meta + [id:new_id, read_group:"\'@RG\\tID:" + new_id + "\\tPL:" + val_platform + "\\tSM:" + new_id + "\'"] - meta.subMap('lane') [groupKey(new_meta, new_meta.num_lanes), bam] } .groupTuple() diff --git a/subworkflows/local/alignment/align_sentieon.nf b/subworkflows/local/alignment/align_sentieon.nf index 366f6cd9..792d9c34 100644 --- a/subworkflows/local/alignment/align_sentieon.nf +++ b/subworkflows/local/alignment/align_sentieon.nf @@ -23,7 +23,7 @@ workflow ALIGN_SENTIEON { .bam_and_bai .map{ meta, bam, bai -> new_id = meta.sample - new_meta = meta + [id:new_id, read_group:"\'@RG\\tID:" + new_id + "\\tPL:" + val_platform + "\\tSM:" + new_id + "\'"] + new_meta = meta + [id:new_id, read_group:"\'@RG\\tID:" + new_id + "\\tPL:" + val_platform + "\\tSM:" + new_id + "\'"] - meta.subMap('lane') [groupKey(new_meta, new_meta.num_lanes), bam, bai] } .groupTuple() diff --git a/subworkflows/local/annotate_mobile_elements.nf b/subworkflows/local/annotate_mobile_elements.nf index 0d22cd80..cfd66de9 100644 --- a/subworkflows/local/annotate_mobile_elements.nf +++ b/subworkflows/local/annotate_mobile_elements.nf @@ -7,8 +7,6 @@ include { ENSEMBLVEP_VEP as ENSEMBLVEP_ME } from '../../modules/nf-core/en include { PICARD_SORTVCF } from '../../modules/nf-core/picard/sortvcf/main' include { SVDB_QUERY as SVDB_QUERY_DB } from '../../modules/nf-core/svdb/query/main' -include { ANNOTATE_CSQ_PLI as ANNOTATE_CSQ_PLI_ME } from '../../subworkflows/local/annotate_consequence_pli.nf' -include { GENERATE_CLINICAL_SET as GENERATE_CLINICAL_SET_ME } from '../../subworkflows/local/generate_clinical_set.nf' workflow ANNOTATE_MOBILE_ELEMENTS { @@ -18,8 +16,6 @@ workflow ANNOTATE_MOBILE_ELEMENTS { ch_genome_fasta // channel: [mandatory] [ val(meta), path(fasta) ] ch_genome_dictionary // channel: [mandatory] [ val(meta), path(dict) ] ch_vep_cache // channel: [mandatory] [ path(cache) ] - ch_variant_consequences // channel: [mandatory] [ path(consequences) ] - ch_hgnc_ids // channel: [mandatory] [ val(hgnc_ids) ] val_vep_genome // string: [mandatory] GRCh37 or GRCh38 val_vep_cache_version // string: [mandatory] default: 107 ch_vep_extra_files // channel: [mandatory] [ path(files) ] @@ -76,25 +72,12 @@ workflow ANNOTATE_MOBILE_ELEMENTS { BCFTOOLS_VIEW_FILTER( ch_bcftools_filter_input, [], [], [] ) - GENERATE_CLINICAL_SET_ME( - BCFTOOLS_VIEW_FILTER.out.vcf, - ch_hgnc_ids - ) - - ANNOTATE_CSQ_PLI_ME( - GENERATE_CLINICAL_SET_ME.out.vcf, - ch_variant_consequences - ) - ch_versions = ch_versions.mix( SVDB_QUERY_DB.out.versions ) ch_versions = ch_versions.mix( PICARD_SORTVCF.out.versions ) ch_versions = ch_versions.mix( ENSEMBLVEP_ME.out.versions ) ch_versions = ch_versions.mix( BCFTOOLS_VIEW_FILTER.out.versions ) - ch_versions = ch_versions.mix( GENERATE_CLINICAL_SET_ME.out.versions ) - ch_versions = ch_versions.mix( ANNOTATE_CSQ_PLI_ME.out.versions ) emit: - vcf = ANNOTATE_CSQ_PLI_ME.out.vcf_ann // channel: [ val(meta), path(vcf) ] - tbi = ANNOTATE_CSQ_PLI_ME.out.tbi_ann // channel: [ val(meta), path(tbi) ] + vcf = BCFTOOLS_VIEW_FILTER.out.vcf // channel: [ val(meta), path(vcf) ] versions = ch_versions // channel: [ path(versions.yml) ] } diff --git a/subworkflows/local/annotate_mt_snvs.nf b/subworkflows/local/annotate_mt_snvs.nf index 917893b4..02554461 100644 --- a/subworkflows/local/annotate_mt_snvs.nf +++ b/subworkflows/local/annotate_mt_snvs.nf @@ -3,12 +3,13 @@ // include { REPLACE_SPACES_IN_VCFINFO } from '../../modules/local/replace_spaces_in_vcfinfo' -include { TABIX_TABIX as TABIX_TABIX_MT } from '../../modules/nf-core/tabix/tabix/main' +include { TABIX_TABIX as TABIX_TABIX_VEP_MT } from '../../modules/nf-core/tabix/tabix/main' +include { TABIX_BGZIPTABIX as ZIP_TABIX_HMTNOTE_MT } from '../../modules/nf-core/tabix/bgziptabix/main' include { ENSEMBLVEP_VEP as ENSEMBLVEP_MT } from '../../modules/nf-core/ensemblvep/vep/main' include { HAPLOGREP2_CLASSIFY as HAPLOGREP2_CLASSIFY_MT } from '../../modules/nf-core/haplogrep2/classify/main' include { VCFANNO as VCFANNO_MT } from '../../modules/nf-core/vcfanno/main' include { ANNOTATE_CADD } from './annotation/annotate_cadd' -include { TABIX_BGZIPTABIX as ZIP_TABIX_HMTNOTE } from '../../modules/nf-core/tabix/bgziptabix/main' +include { TABIX_BGZIPTABIX as ZIP_TABIX_VCFANNO_MT } from '../../modules/nf-core/tabix/bgziptabix/main' include { HMTNOTE_ANNOTATE } from '../../modules/nf-core/hmtnote/annotate/main' workflow ANNOTATE_MT_SNVS { @@ -27,29 +28,53 @@ workflow ANNOTATE_MT_SNVS { ch_vep_extra_files // channel: [mandatory] [ path(files) ] main: - ch_cadd_vcf = Channel.empty() ch_versions = Channel.empty() + // add prefix to meta + ch_mt_vcf + .map { it -> + return [it[0]+ [prefix: it[1].simpleName + "_hmtnote"], it[1]] + } + .set { ch_hmtnote_in } + + // HMTNOTE ANNOTATE + HMTNOTE_ANNOTATE(ch_hmtnote_in) + REPLACE_SPACES_IN_VCFINFO(HMTNOTE_ANNOTATE.out.vcf) + ZIP_TABIX_HMTNOTE_MT(REPLACE_SPACES_IN_VCFINFO.out.vcf) + + // Vcfanno + ZIP_TABIX_HMTNOTE_MT.out.gz_tbi + .map { meta, vcf, tbi -> return [meta + [prefix: meta.prefix + "_vcfanno"], vcf, tbi, []]} + .set { ch_in_vcfanno } + + VCFANNO_MT(ch_in_vcfanno, ch_vcfanno_toml, [], ch_vcfanno_resources) + ZIP_TABIX_VCFANNO_MT(VCFANNO_MT.out.vcf) + + ch_vcfanno_vcf = ZIP_TABIX_VCFANNO_MT.out.gz_tbi.map{meta, vcf, tbi -> return [meta, vcf]} + ch_vcfanno_tbi = ZIP_TABIX_VCFANNO_MT.out.gz_tbi.map{meta, vcf, tbi -> return [meta, tbi]} + // Annotating with CADD if (params.cadd_resources != null) { ANNOTATE_CADD ( - ch_mt_vcf, - ch_mt_tbi, + ch_vcfanno_vcf, + ch_vcfanno_tbi, ch_cadd_header, ch_cadd_resources ) ch_cadd_vcf = ANNOTATE_CADD.out.vcf ch_versions = ch_versions.mix(ANNOTATE_CADD.out.versions) + } else { + ch_cadd_vcf = Channel.empty() } // Pick input for vep - ch_mt_vcf + ch_vcfanno_vcf .join(ch_cadd_vcf, remainder: true) // If CADD is not run then the third element in this channel will be `null` .branch { it -> // If CADD is run, then "it" will be [[meta],selvar.vcf,cadd.vcf], else [[meta],selvar.vcf,null] merged: it[2].equals(null) - return [it[0]+ [prefix: it[1].simpleName + "_vep"], it[1]] + return [it[0]+ [prefix: it[0].prefix + "_vep"], it[1]] cadd: !(it[2].equals(null)) - return [it[0] + [prefix: it[1].simpleName + "_cadd_vep"], it[2]] + return [it[0] + [prefix: it[0].prefix + "_cadd_vep"], it[2]] } .set { ch_for_mix } @@ -58,7 +83,6 @@ workflow ANNOTATE_MT_SNVS { .map { meta, vcf -> return [meta, vcf, []] } .set { ch_vep_in } - // Annotating with ensembl Vep ENSEMBLVEP_MT( ch_vep_in, @@ -70,41 +94,24 @@ workflow ANNOTATE_MT_SNVS { ch_vep_extra_files ) - // Running vcfanno - TABIX_TABIX_MT(ENSEMBLVEP_MT.out.vcf) - ENSEMBLVEP_MT.out.vcf - .join(TABIX_TABIX_MT.out.tbi, failOnMismatch:true, failOnDuplicate:true) - .map { meta, vcf, tbi -> return [meta + [prefix: meta.prefix + "_vcfanno"], vcf, tbi, []]} - .set { ch_in_vcfanno } - - VCFANNO_MT(ch_in_vcfanno, ch_vcfanno_toml, [], ch_vcfanno_resources).vcf - .map { meta, vcf -> return [meta + [prefix: meta.prefix + "_hmtnote"], vcf]} - .set {ch_hmtnote_in} - - // HMTNOTE ANNOTATE - HMTNOTE_ANNOTATE(ch_hmtnote_in) - REPLACE_SPACES_IN_VCFINFO(HMTNOTE_ANNOTATE.out.vcf) - ZIP_TABIX_HMTNOTE(REPLACE_SPACES_IN_VCFINFO.out.vcf) - - // Prepare output - ch_vcf_out = ZIP_TABIX_HMTNOTE.out.gz_tbi.map{meta, vcf, tbi -> return [meta, vcf] } - ch_tbi_out = ZIP_TABIX_HMTNOTE.out.gz_tbi.map{meta, vcf, tbi -> return [meta, tbi] } + TABIX_TABIX_VEP_MT(ENSEMBLVEP_MT.out.vcf) // Running haplogrep2 HAPLOGREP2_CLASSIFY_MT(ch_haplogrep_in, "vcf.gz") ch_versions = ch_versions.mix(ENSEMBLVEP_MT.out.versions) - ch_versions = ch_versions.mix(TABIX_TABIX_MT.out.versions) + ch_versions = ch_versions.mix(TABIX_TABIX_VEP_MT.out.versions) ch_versions = ch_versions.mix(VCFANNO_MT.out.versions) ch_versions = ch_versions.mix(HMTNOTE_ANNOTATE.out.versions) ch_versions = ch_versions.mix(HAPLOGREP2_CLASSIFY_MT.out.versions) - ch_versions = ch_versions.mix(ZIP_TABIX_HMTNOTE.out.versions) + ch_versions = ch_versions.mix(ZIP_TABIX_VCFANNO_MT.out.versions) + ch_versions = ch_versions.mix(ZIP_TABIX_HMTNOTE_MT.out.versions) ch_versions = ch_versions.mix(REPLACE_SPACES_IN_VCFINFO.out.versions) emit: haplog = HAPLOGREP2_CLASSIFY_MT.out.txt // channel: [ val(meta), path(txt) ] - vcf_ann = ch_vcf_out // channel: [ val(meta), path(vcf) ] - tbi = ch_tbi_out // channel: [ val(meta), path(tbi) ] + vcf_ann = ENSEMBLVEP_MT.out.vcf // channel: [ val(meta), path(vcf) ] + tbi = TABIX_TABIX_VEP_MT.out.tbi // channel: [ val(meta), path(tbi) ] report = ENSEMBLVEP_MT.out.report // channel: [ path(html) ] versions = ch_versions // channel: [ path(versions.yml) ] } diff --git a/subworkflows/local/annotation/annotate_rhocallviz.nf b/subworkflows/local/annotation/annotate_rhocallviz.nf index c01eda52..87d3b6bd 100644 --- a/subworkflows/local/annotation/annotate_rhocallviz.nf +++ b/subworkflows/local/annotation/annotate_rhocallviz.nf @@ -2,7 +2,7 @@ // A subworkflow to plot binned zygosity and RHO-regions. // -include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view/main' +include { BCFTOOLS_VIEW as BCFTOOLS_VIEW_RHOCALL } from '../../../modules/nf-core/bcftools/view/main' include { TABIX_TABIX } from '../../../modules/nf-core/tabix/tabix/main' include { BCFTOOLS_ROH } from '../../../modules/nf-core/bcftools/roh/main' include { BCFTOOLS_VIEW as BCFTOOLS_VIEW_UNCOMPRESS } from '../../../modules/nf-core/bcftools/view/main' @@ -25,11 +25,11 @@ workflow ANNOTATE_RHOCALLVIZ { .map {meta, vcf, tbi, meta2 -> return [meta2,vcf,tbi]} .set { ch_rhocall_viz } - BCFTOOLS_VIEW(ch_rhocall_viz, [],[],[]) + BCFTOOLS_VIEW_RHOCALL(ch_rhocall_viz, [],[],[]) - TABIX_TABIX(BCFTOOLS_VIEW.out.vcf) + TABIX_TABIX(BCFTOOLS_VIEW_RHOCALL.out.vcf) - BCFTOOLS_VIEW.out.vcf + BCFTOOLS_VIEW_RHOCALL.out.vcf .join(TABIX_TABIX.out.tbi) .set {ch_roh_in } @@ -43,7 +43,7 @@ workflow ANNOTATE_RHOCALLVIZ { UCSC_WIGTOBIGWIG(RHOCALL_VIZ.out.wig, ch_genome_chrsizes) - ch_versions = ch_versions.mix(BCFTOOLS_VIEW.out.versions.first()) + ch_versions = ch_versions.mix(BCFTOOLS_VIEW_RHOCALL.out.versions.first()) ch_versions = ch_versions.mix(CHROMOGRAPH_AUTOZYG.out.versions.first()) ch_versions = ch_versions.mix(TABIX_TABIX.out.versions.first()) ch_versions = ch_versions.mix(BCFTOOLS_ROH.out.versions.first()) diff --git a/subworkflows/local/call_repeat_expansions.nf b/subworkflows/local/call_repeat_expansions.nf index 65437480..130b7a5b 100644 --- a/subworkflows/local/call_repeat_expansions.nf +++ b/subworkflows/local/call_repeat_expansions.nf @@ -33,7 +33,7 @@ workflow CALL_REPEAT_EXPANSIONS { ) // Sort and index realigned bam - SAMTOOLS_SORT(EXPANSIONHUNTER.out.bam) + SAMTOOLS_SORT(EXPANSIONHUNTER.out.bam, [[:],[]]) SAMTOOLS_INDEX(SAMTOOLS_SORT.out.bam) // Fix header and rename sample diff --git a/subworkflows/local/call_snv.nf b/subworkflows/local/call_snv.nf index 3e76ab91..48bc500a 100644 --- a/subworkflows/local/call_snv.nf +++ b/subworkflows/local/call_snv.nf @@ -38,6 +38,8 @@ workflow CALL_SNV { ch_deepvar_tbi = Channel.empty() ch_deepvar_gvcf = Channel.empty() ch_deepvar_gtbi = Channel.empty() + ch_mt_vcf = Channel.empty() + ch_mt_tabix = Channel.empty() ch_sentieon_vcf = Channel.empty() ch_sentieon_tbi = Channel.empty() ch_sentieon_gvcf = Channel.empty() @@ -74,7 +76,7 @@ workflow CALL_SNV { ch_sentieon_vcf = CALL_SNV_SENTIEON.out.vcf ch_sentieon_tbi = CALL_SNV_SENTIEON.out.tabix ch_sentieon_gvcf = CALL_SNV_SENTIEON.out.gvcf - ch_sentieon_gtbi = CALL_SNV_SENTIEON.out.gtbi + ch_sentieon_gtbi = CALL_SNV_SENTIEON.out.gvcf_tbi ch_versions = ch_versions.mix(CALL_SNV_SENTIEON.out.versions) } @@ -93,46 +95,49 @@ workflow CALL_SNV { ch_genome_tabix = GATK4_SELECTVARIANTS.out.tbi ch_genome_vcf_tabix = ch_genome_vcf.join(ch_genome_tabix, failOnMismatch:true, failOnDuplicate:true) - CALL_SNV_MT( - ch_mt_bam_bai, - ch_genome_fasta, - ch_genome_fai, - ch_genome_dictionary, - ch_mt_intervals - ) - - CALL_SNV_MT_SHIFT( - ch_mtshift_bam_bai, - ch_mtshift_fasta, - ch_mtshift_fai, - ch_mtshift_dictionary, - ch_mtshift_intervals - ) + if (params.analysis_type.equals("wgs") || params.run_mt_for_wes) { + CALL_SNV_MT( + ch_mt_bam_bai, + ch_genome_fasta, + ch_genome_fai, + ch_genome_dictionary, + ch_mt_intervals + ) - POSTPROCESS_MT_CALLS( - CALL_SNV_MT.out.vcf, - CALL_SNV_MT_SHIFT.out.vcf, - ch_genome_fasta, - ch_genome_dictionary, - ch_genome_fai, - ch_mtshift_backchain, - ch_case_info, - ch_foundin_header, - ch_genome_chrsizes - ) + CALL_SNV_MT_SHIFT( + ch_mtshift_bam_bai, + ch_mtshift_fasta, + ch_mtshift_fai, + ch_mtshift_dictionary, + ch_mtshift_intervals + ) - ch_versions = ch_versions.mix(CALL_SNV_MT.out.versions) - ch_versions = ch_versions.mix(CALL_SNV_MT_SHIFT.out.versions) - ch_versions = ch_versions.mix(POSTPROCESS_MT_CALLS.out.versions) - ch_versions = ch_versions.mix(GATK4_SELECTVARIANTS.out.versions) + POSTPROCESS_MT_CALLS( + CALL_SNV_MT.out.vcf, + CALL_SNV_MT_SHIFT.out.vcf, + ch_genome_fasta, + ch_genome_dictionary, + ch_genome_fai, + ch_mtshift_backchain, + ch_case_info, + ch_foundin_header, + ch_genome_chrsizes + ) + ch_mt_vcf = POSTPROCESS_MT_CALLS.out.vcf + ch_mt_tabix = POSTPROCESS_MT_CALLS.out.tbi + ch_versions = ch_versions.mix(CALL_SNV_MT.out.versions) + ch_versions = ch_versions.mix(CALL_SNV_MT_SHIFT.out.versions) + ch_versions = ch_versions.mix(POSTPROCESS_MT_CALLS.out.versions) + ch_versions = ch_versions.mix(GATK4_SELECTVARIANTS.out.versions) + } emit: - genome_vcf = ch_genome_vcf // channel: [ val(meta), path(vcf) ] - genome_tabix = ch_genome_tabix // channel: [ val(meta), path(tbi) ] - genome_vcf_tabix = ch_genome_vcf_tabix // channel: [ val(meta), path(vcf), path(tbi) ] - genome_gvcf = ch_gvcf // channel: [ val(meta), path(gvcf) ] - genome_gtabix = ch_gtabix // channel: [ val(meta), path(gtbi) ] - mt_vcf = POSTPROCESS_MT_CALLS.out.vcf // channel: [ val(meta), path(vcf) ] - mt_tabix = POSTPROCESS_MT_CALLS.out.tbi // channel: [ val(meta), path(tbi) ] - versions = ch_versions // channel: [ path(versions.yml) ] + genome_vcf = ch_genome_vcf // channel: [ val(meta), path(vcf) ] + genome_tabix = ch_genome_tabix // channel: [ val(meta), path(tbi) ] + genome_vcf_tabix = ch_genome_vcf_tabix // channel: [ val(meta), path(vcf), path(tbi) ] + genome_gvcf = ch_gvcf // channel: [ val(meta), path(gvcf) ] + genome_gtabix = ch_gtabix // channel: [ val(meta), path(gtbi) ] + mt_vcf = ch_mt_vcf // channel: [ val(meta), path(vcf) ] + mt_tabix = ch_mt_tabix // channel: [ val(meta), path(tbi) ] + versions = ch_versions // channel: [ path(versions.yml) ] } diff --git a/subworkflows/local/call_structural_variants.nf b/subworkflows/local/call_structural_variants.nf index f590bb60..76f40af5 100644 --- a/subworkflows/local/call_structural_variants.nf +++ b/subworkflows/local/call_structural_variants.nf @@ -57,7 +57,10 @@ workflow CALL_STRUCTURAL_VARIANTS { .collect{it[1]} .set { cnvnator_vcf } - CALL_SV_MT (ch_mt_bam_bai, ch_genome_fasta) + if (params.analysis_type.equals("wgs") || params.run_mt_for_wes) { + CALL_SV_MT (ch_mt_bam_bai, ch_genome_fasta) + ch_versions = ch_versions.mix(CALL_SV_MT.out.versions) + } //merge if (params.skip_germlinecnvcaller) { @@ -85,7 +88,6 @@ workflow CALL_STRUCTURAL_VARIANTS { ch_versions = ch_versions.mix(CALL_SV_CNVNATOR.out.versions) ch_versions = ch_versions.mix(CALL_SV_MANTA.out.versions) - ch_versions = ch_versions.mix(CALL_SV_MT.out.versions) ch_versions = ch_versions.mix(CALL_SV_TIDDIT.out.versions) ch_versions = ch_versions.mix(TABIX_TABIX.out.versions) ch_versions = ch_versions.mix(SVDB_MERGE.out.versions) diff --git a/subworkflows/local/generate_clinical_set.nf b/subworkflows/local/generate_clinical_set.nf index 87250ff9..3e71e6b0 100644 --- a/subworkflows/local/generate_clinical_set.nf +++ b/subworkflows/local/generate_clinical_set.nf @@ -15,19 +15,17 @@ workflow GENERATE_CLINICAL_SET { ch_versions = Channel.empty() ch_vcf - .combine(ch_hgnc_ids) - .multiMap { meta, vcf, ids -> - clinical: [ meta + [ set: "clinical", hgnc_ids:ids ], vcf ] + .multiMap { meta, vcf -> + clinical: [ meta + [ set: "clinical" ], vcf ] research: [ meta + [ set: "research" ], vcf ] } .set { ch_clin_research_vcf } ENSEMBLVEP_FILTERVEP( ch_clin_research_vcf.clinical, - [] + ch_hgnc_ids ) .output - .map {meta, vcf -> [ meta - meta.subMap('hgnc_ids'), vcf ]} .set { ch_filtervep_out } TABIX_BGZIP( ch_filtervep_out ) diff --git a/subworkflows/local/gens.nf b/subworkflows/local/gens.nf index 93f1ac0a..36c0ede5 100644 --- a/subworkflows/local/gens.nf +++ b/subworkflows/local/gens.nf @@ -36,8 +36,8 @@ workflow GENS { COLLECTREADCOUNTS.out.hdf5 .branch { meta, counts -> - female: meta.sex.equals(2) || meta.sex.equals(0) - male: meta.sex.equals(1) + female: meta.sex.matches('2|other') + male: meta.sex.equals('1') } .set { ch_denoisereadcounts_in } diff --git a/subworkflows/local/prepare_references.nf b/subworkflows/local/prepare_references.nf index 64d33248..2bd4b6dd 100644 --- a/subworkflows/local/prepare_references.nf +++ b/subworkflows/local/prepare_references.nf @@ -6,6 +6,8 @@ include { BWA_INDEX as BWA_INDEX_GENOME } from '../../modul include { BWA_INDEX as BWA_INDEX_MT_SHIFT } from '../../modules/nf-core/bwa/index/main' include { BWAMEM2_INDEX as BWAMEM2_INDEX_GENOME } from '../../modules/nf-core/bwamem2/index/main' include { BWAMEM2_INDEX as BWAMEM2_INDEX_MT_SHIFT } from '../../modules/nf-core/bwamem2/index/main' +include { BWAMEME_INDEX as BWAMEME_INDEX_GENOME } from '../../modules/nf-core/bwameme/index/main' +include { BWAMEME_INDEX as BWAMEME_INDEX_MT_SHIFT } from '../../modules/nf-core/bwameme/index/main' include { CAT_CAT as CAT_CAT_BAIT } from '../../modules/nf-core/cat/cat/main' include { GATK4_BEDTOINTERVALLIST as GATK_BILT } from '../../modules/nf-core/gatk4/bedtointervallist/main' include { GATK4_CREATESEQUENCEDICTIONARY as GATK_SD } from '../../modules/nf-core/gatk4/createsequencedictionary/main' @@ -45,24 +47,27 @@ workflow PREPARE_REFERENCES { ch_sentieonbwa = Channel.empty() // Genome indices - BWA_INDEX_GENOME(ch_genome_fasta).index.set{ch_bwa} - BWAMEM2_INDEX_GENOME(ch_genome_fasta) - SENTIEON_BWAINDEX_GENOME(ch_genome_fasta).index.set{ch_sentieonbwa} SAMTOOLS_FAIDX_GENOME(ch_genome_fasta, [[],[]]) GATK_SD(ch_genome_fasta) ch_fai = Channel.empty().mix(ch_genome_fai, SAMTOOLS_FAIDX_GENOME.out.fai).collect() GET_CHROM_SIZES( ch_fai ) - ch_genome_fasta.map { meta, fasta -> return [meta, fasta, [], [] ] } - .set {ch_rtgformat_in} - RTGTOOLS_FORMAT(ch_rtgformat_in) - // MT indices + // Genome alignment indices + BWA_INDEX_GENOME(ch_genome_fasta).index.set{ch_bwa} + BWAMEM2_INDEX_GENOME(ch_genome_fasta) + BWAMEME_INDEX_GENOME(ch_genome_fasta) + SENTIEON_BWAINDEX_GENOME(ch_genome_fasta).index.set{ch_sentieonbwa} + + // MT genome indices SAMTOOLS_EXTRACT_MT(ch_genome_fasta, ch_fai) ch_mt_fasta_in = Channel.empty().mix(ch_mt_fasta, SAMTOOLS_EXTRACT_MT.out.fa).collect() SAMTOOLS_FAIDX_MT_SHIFT(ch_mt_fasta_in, [[],[]]) GATK_SD_MT_SHIFT(ch_mt_fasta_in) GATK_SHIFTFASTA(ch_mt_fasta_in, SAMTOOLS_FAIDX_MT_SHIFT.out.fai, GATK_SD_MT_SHIFT.out.dict) + + // MT alignment indices BWAMEM2_INDEX_MT_SHIFT(GATK_SHIFTFASTA.out.shift_fa) + BWAMEME_INDEX_MT_SHIFT(GATK_SHIFTFASTA.out.shift_fa) BWA_INDEX_MT_SHIFT(GATK_SHIFTFASTA.out.shift_fa) SENTIEON_BWAINDEX_MT_SHIFT(GATK_SHIFTFASTA.out.shift_fa) ch_bwa_mtshift = Channel.empty().mix(SENTIEON_BWAINDEX_MT_SHIFT.out.index, BWA_INDEX_MT_SHIFT.out.index).collect() @@ -79,7 +84,6 @@ workflow PREPARE_REFERENCES { // Vcf, tab and bed indices TABIX_DBSNP(ch_known_dbsnp) - ch_versions = ch_versions.mix(TABIX_DBSNP.out.versions) TABIX_GNOMAD_AF(ch_gnomad_af_tab) TABIX_PT(ch_target_bed).tbi.set { ch_tbi } TABIX_PBT(ch_target_bed).gz_tbi.set { ch_bgzip_tbi } @@ -101,9 +105,15 @@ workflow PREPARE_REFERENCES { GATK_PREPROCESS_WGS (ch_genome_fasta, ch_fai, GATK_SD.out.dict, [[],[]], [[],[]]).set {ch_preprocwgs} GATK_PREPROCESS_WES (ch_genome_fasta, ch_fai, GATK_SD.out.dict, GATK_BILT.out.interval_list, [[],[]]).set {ch_preprocwes} + // RTG tools + ch_genome_fasta.map { meta, fasta -> return [meta, fasta, [], [] ] } + .set {ch_rtgformat_in} + RTGTOOLS_FORMAT(ch_rtgformat_in) + // Gather versions ch_versions = ch_versions.mix(BWA_INDEX_GENOME.out.versions) ch_versions = ch_versions.mix(BWAMEM2_INDEX_GENOME.out.versions) + ch_versions = ch_versions.mix(BWAMEME_INDEX_GENOME.out.versions) ch_versions = ch_versions.mix(SENTIEON_BWAINDEX_GENOME.out.versions) ch_versions = ch_versions.mix(SAMTOOLS_FAIDX_GENOME.out.versions) ch_versions = ch_versions.mix(GATK_SD.out.versions) @@ -112,12 +122,14 @@ workflow PREPARE_REFERENCES { ch_versions = ch_versions.mix(SAMTOOLS_FAIDX_MT_SHIFT.out.versions) ch_versions = ch_versions.mix(GATK_SD_MT_SHIFT.out.versions) ch_versions = ch_versions.mix(GATK_SHIFTFASTA.out.versions) + ch_versions = ch_versions.mix(BWAMEME_INDEX_MT_SHIFT.out.versions) ch_versions = ch_versions.mix(BWAMEM2_INDEX_MT_SHIFT.out.versions) ch_versions = ch_versions.mix(BWA_INDEX_MT_SHIFT.out.versions) ch_versions = ch_versions.mix(SENTIEON_BWAINDEX_MT_SHIFT.out.versions) ch_versions = ch_versions.mix(TABIX_GNOMAD_AF.out.versions) ch_versions = ch_versions.mix(TABIX_PT.out.versions) ch_versions = ch_versions.mix(TABIX_PBT.out.versions) + ch_versions = ch_versions.mix(TABIX_DBSNP.out.versions) ch_versions = ch_versions.mix(GATK_BILT.out.versions) ch_versions = ch_versions.mix(GATK_ILT.out.versions) ch_versions = ch_versions.mix(CAT_CAT_BAIT.out.versions) @@ -129,6 +141,7 @@ workflow PREPARE_REFERENCES { emit: genome_bwa_index = Channel.empty().mix(ch_bwa, ch_sentieonbwa).collect() // channel: [ val(meta), path(index) ] genome_bwamem2_index = BWAMEM2_INDEX_GENOME.out.index.collect() // channel: [ val(meta), path(index) ] + genome_bwameme_index = BWAMEME_INDEX_GENOME.out.index.collect() // channel: [ val(meta), path(index) ] genome_chrom_sizes = GET_CHROM_SIZES.out.sizes.collect() // channel: [ path(sizes) ] genome_fai = ch_fai // channel: [ val(meta), path(fai) ] genome_dict = GATK_SD.out.dict.collect() // channel: [ path(dict) ] @@ -143,6 +156,7 @@ workflow PREPARE_REFERENCES { mtshift_dict = GATK_SHIFTFASTA.out.dict.collect() // channel: [ path(dict) ] mtshift_bwa_index = ch_bwa_mtshift // channel: [ val(meta), path(index) ] mtshift_bwamem2_index = BWAMEM2_INDEX_MT_SHIFT.out.index.collect() // channel: [ val(meta), path(index) ] + mtshift_bwameme_index = BWAMEME_INDEX_MT_SHIFT.out.index.collect() // channel: [ val(meta), path(index) ] gnomad_af_idx = TABIX_GNOMAD_AF.out.tbi.collect() // channel: [ val(meta), path(fasta) ] known_dbsnp_tbi = TABIX_DBSNP.out.tbi.collect() // channel: [ val(meta), path(fasta) ] diff --git a/subworkflows/local/qc_bam.nf b/subworkflows/local/qc_bam.nf index b1ce5141..26c4fa75 100644 --- a/subworkflows/local/qc_bam.nf +++ b/subworkflows/local/qc_bam.nf @@ -2,18 +2,18 @@ // A quality check subworkflow for processed bams. // -include { PICARD_COLLECTMULTIPLEMETRICS } from '../../modules/nf-core/picard/collectmultiplemetrics/main' -include { PICARD_COLLECTHSMETRICS } from '../../modules/nf-core/picard/collecthsmetrics/main' -include { CHROMOGRAPH as CHROMOGRAPH_COV } from '../../modules/nf-core/chromograph/main' -include { QUALIMAP_BAMQC } from '../../modules/nf-core/qualimap/bamqc/main' -include { TIDDIT_COV } from '../../modules/nf-core/tiddit/cov/main' -include { MOSDEPTH } from '../../modules/nf-core/mosdepth/main' -include { UCSC_WIGTOBIGWIG } from '../../modules/nf-core/ucsc/wigtobigwig/main' -include { PICARD_COLLECTWGSMETRICS as PICARD_COLLECTWGSMETRICS } from '../../modules/nf-core/picard/collectwgsmetrics/main' -include { PICARD_COLLECTWGSMETRICS as PICARD_COLLECTWGSMETRICS_Y } from '../../modules/nf-core/picard/collectwgsmetrics/main' -include { SENTIEON_WGSMETRICS } from '../../modules/nf-core/sentieon/wgsmetrics/main' -include { SENTIEON_WGSMETRICS as SENTIEON_WGSMETRICS_Y } from '../../modules/nf-core/sentieon/wgsmetrics/main' -include { NGSBITS_SAMPLEGENDER } from '../../modules/nf-core/ngsbits/samplegender/main' +include { PICARD_COLLECTMULTIPLEMETRICS } from '../../modules/nf-core/picard/collectmultiplemetrics/main' +include { PICARD_COLLECTHSMETRICS } from '../../modules/nf-core/picard/collecthsmetrics/main' +include { CHROMOGRAPH as CHROMOGRAPH_COV } from '../../modules/nf-core/chromograph/main' +include { QUALIMAP_BAMQC } from '../../modules/nf-core/qualimap/bamqc/main' +include { TIDDIT_COV } from '../../modules/nf-core/tiddit/cov/main' +include { MOSDEPTH } from '../../modules/nf-core/mosdepth/main' +include { UCSC_WIGTOBIGWIG } from '../../modules/nf-core/ucsc/wigtobigwig/main' +include { PICARD_COLLECTWGSMETRICS as PICARD_COLLECTWGSMETRICS_WG } from '../../modules/nf-core/picard/collectwgsmetrics/main' +include { PICARD_COLLECTWGSMETRICS as PICARD_COLLECTWGSMETRICS_Y } from '../../modules/nf-core/picard/collectwgsmetrics/main' +include { SENTIEON_WGSMETRICS as SENTIEON_WGSMETRICS_WG } from '../../modules/nf-core/sentieon/wgsmetrics/main' +include { SENTIEON_WGSMETRICS as SENTIEON_WGSMETRICS_Y } from '../../modules/nf-core/sentieon/wgsmetrics/main' +include { NGSBITS_SAMPLEGENDER } from '../../modules/nf-core/ngsbits/samplegender/main' workflow QC_BAM { @@ -31,6 +31,8 @@ workflow QC_BAM { ngsbits_samplegender_method // channel [val(method)] main: + ch_cov = Channel.empty() + ch_cov_y = Channel.empty() ch_versions = Channel.empty() ch_qualimap = Channel.empty() @@ -58,17 +60,19 @@ workflow QC_BAM { MOSDEPTH (ch_mosdepth_in, ch_genome_fasta) // COLLECT WGS METRICS - PICARD_COLLECTWGSMETRICS ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_wgs ) - PICARD_COLLECTWGSMETRICS_Y ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_y ) - - SENTIEON_WGSMETRICS ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_wgs.map{ interval -> [[:], interval]} ) - SENTIEON_WGSMETRICS_Y ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_y.map{ interval -> [[:], interval]} ) - + if (!params.analysis_type.equals("wes")) { + PICARD_COLLECTWGSMETRICS_WG ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_wgs ) + PICARD_COLLECTWGSMETRICS_Y ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_y ) + SENTIEON_WGSMETRICS_WG ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_wgs.map{ interval -> [[:], interval]} ) + SENTIEON_WGSMETRICS_Y ( ch_bam_bai, ch_genome_fasta, ch_genome_fai, ch_intervals_y.map{ interval -> [[:], interval]} ) + ch_cov = Channel.empty().mix(PICARD_COLLECTWGSMETRICS_WG.out.metrics, SENTIEON_WGSMETRICS_WG.out.wgs_metrics) + ch_cov_y = Channel.empty().mix(PICARD_COLLECTWGSMETRICS_Y.out.metrics, SENTIEON_WGSMETRICS_Y.out.wgs_metrics) + ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS_WG.out.versions.first(), SENTIEON_WGSMETRICS_WG.out.versions.first()) + ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS_Y.out.versions.first(), SENTIEON_WGSMETRICS_Y.out.versions.first()) + } // Check sex NGSBITS_SAMPLEGENDER(ch_bam_bai, ch_genome_fasta, ch_genome_fai, ngsbits_samplegender_method) - ch_cov = Channel.empty().mix(PICARD_COLLECTWGSMETRICS.out.metrics, SENTIEON_WGSMETRICS.out.wgs_metrics) - ch_cov_y = Channel.empty().mix(PICARD_COLLECTWGSMETRICS_Y.out.metrics, SENTIEON_WGSMETRICS_Y.out.wgs_metrics) ch_versions = ch_versions.mix(CHROMOGRAPH_COV.out.versions.first()) ch_versions = ch_versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions.first()) @@ -77,8 +81,6 @@ workflow QC_BAM { ch_versions = ch_versions.mix(UCSC_WIGTOBIGWIG.out.versions.first()) ch_versions = ch_versions.mix(MOSDEPTH.out.versions.first()) ch_versions = ch_versions.mix(NGSBITS_SAMPLEGENDER.out.versions.first()) - ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS.out.versions.first(), SENTIEON_WGSMETRICS.out.versions.first()) - ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS_Y.out.versions.first(), SENTIEON_WGSMETRICS_Y.out.versions.first()) emit: multiple_metrics = PICARD_COLLECTMULTIPLEMETRICS.out.metrics // channel: [ val(meta), path(metrics) ] diff --git a/subworkflows/local/subsample_mt.nf b/subworkflows/local/subsample_mt.nf index d8da5aae..180748e5 100644 --- a/subworkflows/local/subsample_mt.nf +++ b/subworkflows/local/subsample_mt.nf @@ -19,7 +19,7 @@ workflow SUBSAMPLE_MT { ch_mt_bam_bai.map {meta, bam, bai -> return [meta, bam, -1]}.set {ch_genomecov_in} - BEDTOOLS_GENOMECOV (ch_genomecov_in, [], "genomecov") + BEDTOOLS_GENOMECOV (ch_genomecov_in, [], "genomecov", false) CALCULATE_SEED_FRACTION ( BEDTOOLS_GENOMECOV.out.genomecov, diff --git a/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf b/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf index 912c7ace..36c0cbaa 100644 --- a/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf @@ -150,6 +150,10 @@ workflow PIPELINE_COMPLETION { imNotification(summary_params, hook_url) } } + + workflow.onError { + log.error "Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting" + } } /* @@ -420,8 +424,16 @@ def methodsDescriptionText(mqc_methods_yaml) { meta["manifest_map"] = workflow.manifest.toMap() // Pipeline DOI - meta["doi_text"] = meta.manifest_map.doi ? "(doi: ${meta.manifest_map.doi})" : "" - meta["nodoi_text"] = meta.manifest_map.doi ? "": "
  • Make sure to update the text to include the Zenodo DOI of version of the pipeline used.
  • " + if (meta.manifest_map.doi) { + // Using a loop to handle multiple DOIs + // Removing `https://doi.org/` to handle pipelines using DOIs vs DOI resolvers + // Removing ` ` since the manifest.doi is a string and not a proper list + def temp_doi_ref = "" + String[] manifest_doi = meta.manifest_map.doi.tokenize(",") + for (String doi_ref: manifest_doi) temp_doi_ref += "(doi: ${doi_ref.replace("https://doi.org/", "").replace(" ", "")}), " + meta["doi_text"] = temp_doi_ref.substring(0, temp_doi_ref.length() - 2) + } else meta["doi_text"] = "" + meta["nodoi_text"] = meta.manifest_map.doi ? "" : "
  • If available, make sure to update the text to include the Zenodo DOI of version of the pipeline used.
  • " // Tool references meta["tool_citations"] = toolCitationText().replaceAll(", \\.", ".").replaceAll("\\. \\.", ".").replaceAll(", \\.", ".") diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/main.nf b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf index a8b55d6f..14558c39 100644 --- a/subworkflows/nf-core/utils_nfcore_pipeline/main.nf +++ b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf @@ -65,9 +65,15 @@ def checkProfileProvided(nextflow_cli_args) { // Citation string for pipeline // def workflowCitation() { + def temp_doi_ref = "" + String[] manifest_doi = workflow.manifest.doi.tokenize(",") + // Using a loop to handle multiple DOIs + // Removing `https://doi.org/` to handle pipelines using DOIs vs DOI resolvers + // Removing ` ` since the manifest.doi is a string and not a proper list + for (String doi_ref: manifest_doi) temp_doi_ref += " https://doi.org/${doi_ref.replace('https://doi.org/', '').replace(' ', '')}\n" return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" + "* The pipeline\n" + - " ${workflow.manifest.doi}\n\n" + + temp_doi_ref + "\n" + "* The nf-core framework\n" + " https://doi.org/10.1038/s41587-020-0439-x\n\n" + "* Software dependencies\n" + diff --git a/workflows/raredisease.nf b/workflows/raredisease.nf index 96debe46..ab09b6f2 100644 --- a/workflows/raredisease.nf +++ b/workflows/raredisease.nf @@ -71,6 +71,10 @@ if (!params.skip_vep_filter) { } } +if (!params.skip_me_calling) { + mandatoryParams += ["mobile_element_references"] +} + if (!params.skip_me_annotation) { mandatoryParams += ["mobile_element_svdb_annotations", "variant_consequences_snv"] } @@ -112,12 +116,15 @@ include { SMNCOPYNUMBERCALLER } from '../modules/nf-core/smncopynumbercaller/mai include { RENAME_ALIGN_FILES as RENAME_BAM_FOR_SMNCALLER } from '../modules/local/rename_align_files' include { RENAME_ALIGN_FILES as RENAME_BAI_FOR_SMNCALLER } from '../modules/local/rename_align_files' +include { CREATE_HGNCIDS_FILE } from '../modules/local/create_hgncids_file' +include { CREATE_PEDIGREE_FILE } from '../modules/local/create_pedigree_file' // // SUBWORKFLOWS // include { ALIGN } from '../subworkflows/local/align' +include { ANNOTATE_CSQ_PLI as ANN_CSQ_PLI_ME } from '../subworkflows/local/annotate_consequence_pli.nf' include { ANNOTATE_CSQ_PLI as ANN_CSQ_PLI_MT } from '../subworkflows/local/annotate_consequence_pli' include { ANNOTATE_CSQ_PLI as ANN_CSQ_PLI_SNV } from '../subworkflows/local/annotate_consequence_pli' include { ANNOTATE_CSQ_PLI as ANN_CSQ_PLI_SV } from '../subworkflows/local/annotate_consequence_pli' @@ -129,6 +136,7 @@ include { CALL_MOBILE_ELEMENTS } from '../subworkf include { CALL_REPEAT_EXPANSIONS } from '../subworkflows/local/call_repeat_expansions' include { CALL_SNV } from '../subworkflows/local/call_snv' include { CALL_STRUCTURAL_VARIANTS } from '../subworkflows/local/call_structural_variants' +include { GENERATE_CLINICAL_SET as GENERATE_CLINICAL_SET_ME } from '../subworkflows/local/generate_clinical_set.nf' include { GENERATE_CLINICAL_SET as GENERATE_CLINICAL_SET_MT } from '../subworkflows/local/generate_clinical_set' include { GENERATE_CLINICAL_SET as GENERATE_CLINICAL_SET_SNV } from '../subworkflows/local/generate_clinical_set' include { GENERATE_CLINICAL_SET as GENERATE_CLINICAL_SET_SV } from '../subworkflows/local/generate_clinical_set' @@ -160,7 +168,6 @@ workflow RAREDISEASE { ch_multiqc_files = Channel.empty() ch_samples = ch_samplesheet.map { meta, fastqs -> meta} - ch_pedfile = ch_samples.toList().map { file(CustomFunctions.makePed(it, params.outdir)) } ch_case_info = ch_samples.toList().map { CustomFunctions.createCaseChannel(it) } // Initialize file channels for PREPARE_REFERENCES subworkflow @@ -209,6 +216,8 @@ workflow RAREDISEASE { : ch_references.genome_bwa_index ch_genome_bwamem2index = params.bwamem2 ? Channel.fromPath(params.bwamem2).map {it -> [[id:it[0].simpleName], it]}.collect() : ch_references.genome_bwamem2_index + ch_genome_bwamemeindex = params.bwameme ? Channel.fromPath(params.bwameme).map {it -> [[id:it[0].simpleName], it]}.collect() + : ch_references.genome_bwameme_index ch_genome_chrsizes = ch_references.genome_chrom_sizes ch_genome_fai = ch_references.genome_fai ch_genome_dictionary = params.sequence_dictionary ? Channel.fromPath(params.sequence_dictionary).map {it -> [[id:it[0].simpleName], it]}.collect() @@ -239,6 +248,7 @@ workflow RAREDISEASE { ch_mtshift_backchain = ch_references.mtshift_backchain ch_mtshift_bwaindex = ch_references.mtshift_bwa_index ch_mtshift_bwamem2index = ch_references.mtshift_bwamem2_index + ch_mtshift_bwamemeindex = ch_references.mtshift_bwameme_index ch_mtshift_dictionary = ch_references.mtshift_dict ch_mtshift_fai = ch_references.mtshift_fai ch_mtshift_fasta = ch_references.mtshift_fasta @@ -285,9 +295,9 @@ workflow RAREDISEASE { : ( params.vep_cache ? Channel.fromPath(params.vep_cache).collect() : Channel.value([]) ) ch_vep_extra_files_unsplit = params.vep_plugin_files ? Channel.fromPath(params.vep_plugin_files).collect() : Channel.value([]) - ch_vep_filters_std_fmt = params.vep_filters ? Channel.fromPath(params.vep_filters).splitCsv().collect() + ch_vep_filters_std_fmt = params.vep_filters ? Channel.fromPath(params.vep_filters).map { it -> [[id:'standard'],it]}.collect() : Channel.empty() - ch_vep_filters_scout_fmt = params.vep_filters_scout_fmt ? Channel.fromPath(params.vep_filters_scout_fmt).collect() + ch_vep_filters_scout_fmt = params.vep_filters_scout_fmt ? Channel.fromPath(params.vep_filters_scout_fmt).map { it -> [[id:'scout'],it]}.collect() : Channel.empty() ch_versions = ch_versions.mix(ch_references.versions) @@ -298,6 +308,11 @@ workflow RAREDISEASE { ch_svcaller_priority = Channel.value(["tiddit", "manta", "gcnvcaller", "cnvnator"]) } + + // Generate pedigree file + ch_pedfile = CREATE_PEDIGREE_FILE(ch_samples.toList()).ped + ch_versions = ch_versions.mix(CREATE_PEDIGREE_FILE.out.versions) + // Read and store paths in the vep_plugin_files file if (params.vep_plugin_files) { ch_vep_extra_files_unsplit.splitCsv ( header:true ) @@ -315,9 +330,11 @@ workflow RAREDISEASE { // Read and store hgnc ids in a channel ch_vep_filters_scout_fmt - .map { it -> CustomFunctions.parseHgncIds(it.text) } .mix (ch_vep_filters_std_fmt) - .toList() + .set {ch_vep_filters} + + CREATE_HGNCIDS_FILE(ch_vep_filters) + .txt .set {ch_hgnc_ids} // Input QC @@ -345,9 +362,11 @@ workflow RAREDISEASE { ch_genome_fai, ch_genome_bwaindex, ch_genome_bwamem2index, + ch_genome_bwamemeindex, ch_genome_dictionary, ch_mtshift_bwaindex, ch_mtshift_bwamem2index, + ch_mtshift_bwamemeindex, ch_mtshift_fasta, ch_mtshift_dictionary, ch_mtshift_fai, @@ -356,7 +375,7 @@ workflow RAREDISEASE { .set { ch_mapped } ch_versions = ch_versions.mix(ALIGN.out.versions) - if (!params.skip_mt_subsample) { + if (!params.skip_mt_subsample && (params.analysis_type.equals("wgs") || params.run_mt_for_wes)) { SUBSAMPLE_MT( ch_mapped.mt_bam_bai, params.mt_subsample_rd, @@ -386,14 +405,16 @@ workflow RAREDISEASE { // // EXPANSIONHUNTER AND STRANGER // - CALL_REPEAT_EXPANSIONS ( - ch_mapped.genome_bam_bai, - ch_variant_catalog, - ch_case_info, - ch_genome_fasta, - ch_genome_fai - ) - ch_versions = ch_versions.mix(CALL_REPEAT_EXPANSIONS.out.versions) + if (params.analysis_type.equals("wgs")) { + CALL_REPEAT_EXPANSIONS ( + ch_mapped.genome_bam_bai, + ch_variant_catalog, + ch_case_info, + ch_genome_fasta, + ch_genome_fai + ) + ch_versions = ch_versions.mix(CALL_REPEAT_EXPANSIONS.out.versions) + } // // SNV CALLING @@ -547,7 +568,7 @@ workflow RAREDISEASE { // // ANNOTATE MT SNVs // - if (!params.skip_mt_annotation) { + if (!params.skip_mt_annotation && (params.run_mt_for_wes || params.analysis_type.equals("wgs"))) { ANNOTATE_MT_SNVS ( CALL_SNV.out.mt_vcf, @@ -647,52 +668,87 @@ workflow RAREDISEASE { ch_versions = ch_versions.mix(GENS.out.versions) } - CALL_MOBILE_ELEMENTS( - ch_mapped.genome_bam_bai, - ch_genome_fasta, - ch_genome_fai, - ch_me_references, - ch_case_info, - params.genome - ) - ch_versions = ch_versions.mix(CALL_MOBILE_ELEMENTS.out.versions) - - if (!params.skip_me_annotation) { - ANNOTATE_MOBILE_ELEMENTS( - CALL_MOBILE_ELEMENTS.out.vcf, - ch_me_svdb_resources, + if (!params.skip_me_calling) { + CALL_MOBILE_ELEMENTS( + ch_mapped.genome_bam_bai, ch_genome_fasta, - ch_genome_dictionary, - ch_vep_cache, - ch_variant_consequences_sv, - ch_hgnc_ids, - params.genome, - params.vep_cache_version, - ch_vep_extra_files + ch_genome_fai, + ch_me_references, + ch_case_info, + params.genome ) - ch_versions = ch_versions.mix(ANNOTATE_MOBILE_ELEMENTS.out.versions) + ch_versions = ch_versions.mix(CALL_MOBILE_ELEMENTS.out.versions) + + if (!params.skip_me_annotation) { + ANNOTATE_MOBILE_ELEMENTS( + CALL_MOBILE_ELEMENTS.out.vcf, + ch_me_svdb_resources, + ch_genome_fasta, + ch_genome_dictionary, + ch_vep_cache, + params.genome, + params.vep_cache_version, + ch_vep_extra_files + ) + ch_versions = ch_versions.mix(ANNOTATE_MOBILE_ELEMENTS.out.versions) + + GENERATE_CLINICAL_SET_ME( + ANNOTATE_MOBILE_ELEMENTS.out.vcf, + ch_hgnc_ids + ) + ch_versions = ch_versions.mix( GENERATE_CLINICAL_SET_ME.out.versions ) + + ANN_CSQ_PLI_ME( + GENERATE_CLINICAL_SET_ME.out.vcf, + ch_variant_consequences_sv + ) + ch_versions = ch_versions.mix( ANN_CSQ_PLI_ME.out.versions ) + + } } - // // Collate and save software versions // softwareVersionsToYAML(ch_versions) - .collectFile(storeDir: "${params.outdir}/pipeline_info", name: 'nf_core_pipeline_software_mqc_versions.yml', sort: true, newLine: true) - .set { ch_collated_versions } + .collectFile( + storeDir: "${params.outdir}/pipeline_info", + name: 'nf_core_pipeline_software_mqc_versions.yml', + sort: true, + newLine: true + ).set { ch_collated_versions } // // MODULE: MultiQC // - ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true) - ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath(params.multiqc_config, checkIfExists: true) : Channel.empty() - ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath(params.multiqc_logo, checkIfExists: true) : Channel.fromPath("$projectDir/docs/images/nf-core-raredisease_logo_light.png", checkIfExists: true) - summary_params = paramsSummaryMap(workflow, parameters_schema: "nextflow_schema.json") - ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params)) - ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true) - ch_methods_description = Channel.value(methodsDescriptionText(ch_multiqc_custom_methods_description)) - ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml')) - ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions) - ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml', sort: false)) + ch_multiqc_config = Channel.fromPath( + "$projectDir/assets/multiqc_config.yml", checkIfExists: true) + ch_multiqc_custom_config = params.multiqc_config ? + Channel.fromPath(params.multiqc_config, checkIfExists: true) : + Channel.empty() + ch_multiqc_logo = params.multiqc_logo ? + Channel.fromPath(params.multiqc_logo, checkIfExists: true) : + Channel.fromPath("$projectDir/docs/images/nf-core-raredisease_logo_light.png", checkIfExists: true) + + summary_params = paramsSummaryMap( + workflow, parameters_schema: "nextflow_schema.json") + ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params)) + + ch_multiqc_custom_methods_description = params.multiqc_methods_description ? + file(params.multiqc_methods_description, checkIfExists: true) : + file("$projectDir/assets/methods_description_template.yml", checkIfExists: true) + ch_methods_description = Channel.value( + methodsDescriptionText(ch_multiqc_custom_methods_description)) + + ch_multiqc_files = ch_multiqc_files.mix( + ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml')) + ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions) + ch_multiqc_files = ch_multiqc_files.mix( + ch_methods_description.collectFile( + name: 'methods_description_mqc.yaml', + sort: true + ) + ) + if (!params.skip_fastqc) { ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]}.ifEmpty([])) }