Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSL2+ #312

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open

DSL2+ #312

Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f531c5d
Replace ext/publishDir with params/publish definition
bentsherman Apr 27, 2024
836ace2
Update config to comply with strict parser
bentsherman Apr 27, 2024
25a1fb5
Use param schemas as source of truth, convert to YAML
bentsherman Apr 27, 2024
505806a
Use eval output, topic channels to collect tool versions
bentsherman Apr 27, 2024
4401d29
Refactor params as workflow inputs
bentsherman May 19, 2024
1b2ad00
Update workflow output definition
bentsherman May 19, 2024
4ab2ddc
Update workflow params definition
bentsherman May 19, 2024
39971b6
Add workflow output schema
bentsherman May 19, 2024
a05928c
Rename schema_params.yml to schema_inputs.yml
bentsherman Jun 10, 2024
081dbc0
Remove trailing slashes from target names
bentsherman Jun 10, 2024
ff54921
Add wrapper workflow for ASPERA_CLI
bentsherman Jun 11, 2024
b69bb74
Initialize ch_fastq
bentsherman Jun 21, 2024
6996724
Remove import statements
bentsherman Jun 26, 2024
faf3af4
Fix warnings
bentsherman Sep 23, 2024
f9385f3
Update workflow outputs (second preview)
bentsherman Sep 23, 2024
a65146e
Refactor output targets to samples and versions
bentsherman Nov 2, 2024
e567043
Revert unrelated changes
bentsherman Dec 4, 2024
885128a
Revert unrelated changes
bentsherman Dec 5, 2024
595ac02
Merge branch 'dev' into dsl2-plus
bentsherman Dec 5, 2024
0bbc665
Use Nextflow 24.10
bentsherman Dec 5, 2024
8e91e21
FIx failing test
bentsherman Dec 5, 2024
768702d
Fix failing tests
bentsherman Dec 5, 2024
8f97ac6
minor edits
bentsherman Dec 5, 2024
26c43af
minor edits
bentsherman Dec 5, 2024
9e33149
Fix workflow outputs
bentsherman Dec 5, 2024
08a3361
Fix dynamic publish path
bentsherman Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
fail-fast: false
matrix:
NXF_VER:
- "24.04.2"
- "24.10.2"
- "latest-everything"
profile:
- "conda"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![GitHub Actions CI Status](https://github.com/nf-core/fetchngs/actions/workflows/ci.yml/badge.svg)](https://github.com/nf-core/fetchngs/actions/workflows/ci.yml)
[![GitHub Actions Linting Status](https://github.com/nf-core/fetchngs/actions/workflows/linting.yml/badge.svg)](https://github.com/nf-core/fetchngs/actions/workflows/linting.yml)[![AWS CI](https://img.shields.io/badge/CI%20tests-full%20size-FF9900?labelColor=000000&logo=Amazon%20AWS)](https://nf-co.re/fetchngs/results)[![Cite with Zenodo](http://img.shields.io/badge/DOI-10.5281/zenodo.5070524-1073c8?labelColor=000000)](https://doi.org/10.5281/zenodo.5070524)[![nf-test](https://img.shields.io/badge/unit_tests-nf--test-337ab7.svg)](https://www.nf-test.com)

[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A524.04.2-23aa62.svg)](https://www.nextflow.io/)
[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A524.10.2-23aa62.svg)](https://www.nextflow.io/)
[![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/)
Expand Down
6 changes: 0 additions & 6 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ process {
memory = { 6.GB * task.attempt }
time = { 4.h * task.attempt }

publishDir = [
path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]

errorStrategy = { task.exitStatus in ((130..145) + 104) ? 'retry' : 'finish' }
maxRetries = 1
maxErrors = '-1'
Expand Down
41 changes: 40 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
----------------------------------------------------------------------------------------
*/

nextflow.preview.output = true
nextflow.preview.topic = true

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS
Expand All @@ -18,6 +21,7 @@
include { SRA } from './workflows/sra'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_fetchngs_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_fetchngs_pipeline'
include { softwareVersionsToYAML } from './subworkflows/nf-core/utils_nfcore_pipeline'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -38,8 +42,16 @@ workflow NFCORE_FETCHNGS {
//
// WORKFLOW: Download FastQ files for SRA / ENA / GEO / DDBJ ids
//
SRA ( ids )
SRA (
ids,
params.ena_metadata_fields ?: '',
params.download_method,
params.skip_fastq_download,
params.dbgap_key
)

emit:
samples = SRA.out.samples
}

/*
Expand Down Expand Up @@ -81,6 +93,33 @@ workflow {
params.monochrome_logs,
params.hook_url
)

publish:
NFCORE_FETCHNGS.out.samples >> 'samples'
softwareVersionsToYAML() >> 'versions'
}


output {
samples {
path { _sample ->
def dirs = [
'fastq': 'fastq',
'md5': 'fastq/md5'
]
return { file -> "${dirs[file.extension]}/${file.name}" }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more explicit way to write this could be as a list of source-target pairs:

def files = [
    sample.fastq_1,
    sample.fastq_2,
    sample.md5_1,
    sample.md5_2
]
def dirs = [
    'fastq': 'fastq',
    'md5': 'fastq/md5'
]
return files
    .findAll { file -> file != null }
    .collect { file ->
        [ file, "${dirs[file.extension]}/${file.name}" ]
    }

It's more verbose but it spells out more clearly what it going on. But as long as Nextflow can infer the files list automatically, the user should only need to return the mapping closure

}
index {
path 'samplesheet/samplesheet.json'
}
}

versions {
path '.'
index {
path 'nf_core_fetchngs_software_mqc_versions.yml'
}
}
}

/*
Expand Down
28 changes: 17 additions & 11 deletions modules/local/aspera_cli/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process ASPERA_CLI {
output:
tuple val(meta), path("*fastq.gz"), emit: fastq
tuple val(meta), path("*md5") , emit: md5
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('aspera_cli'), eval('ascli --version'), topic: versions

script:
def args = task.ext.args ?: ''
Expand All @@ -31,11 +31,6 @@ process ASPERA_CLI {

echo "${meta.md5_1} ${meta.id}.fastq.gz" > ${meta.id}.fastq.gz.md5
md5sum -c ${meta.id}.fastq.gz.md5

cat <<-END_VERSIONS > versions.yml
"${task.process}":
aspera_cli: \$(ascli --version)
END_VERSIONS
"""
} else {
"""
Expand All @@ -58,11 +53,22 @@ process ASPERA_CLI {

echo "${meta.md5_2} ${meta.id}_2.fastq.gz" > ${meta.id}_2.fastq.gz.md5
md5sum -c ${meta.id}_2.fastq.gz.md5

cat <<-END_VERSIONS > versions.yml
"${task.process}":
aspera_cli: \$(ascli --version)
END_VERSIONS
"""
}
}

workflow {
def input = [
[ id:'SRX9626017_SRR13191702', single_end:false, md5_1: '89c5be920021a035084d8aeb74f32df7', md5_2: '56271be38a80db78ef3bdfc5d9909b98' ],
[
'fasp.sra.ebi.ac.uk:/vol1/fastq/SRR131/002/SRR13191702/SRR13191702_1.fastq.gz',
'fasp.sra.ebi.ac.uk:/vol1/fastq/SRR131/002/SRR13191702/SRR13191702_2.fastq.gz'
]
]
def user = 'era-fasp'

ASPERA_CLI (
input,
user
)
}
12 changes: 0 additions & 12 deletions modules/local/aspera_cli/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
process {
withName: 'ASPERA_CLI' {
ext.args = '-QT -l 300m -P33001'
publishDir = [
[
path: { "${params.outdir}/fastq" },
mode: params.publish_dir_mode,
pattern: "*.fastq.gz"
],
[
path: { "${params.outdir}/fastq/md5" },
mode: params.publish_dir_mode,
pattern: "*.md5"
]
]
}
}
7 changes: 1 addition & 6 deletions modules/local/multiqc_mappings_config/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ process MULTIQC_MAPPINGS_CONFIG {

output:
path "*config.yml" , emit: yml
path "versions.yml", emit: versions
tuple val("${task.process}"), val('python'), eval("python --version | sed 's/Python //g'"), topic: versions

script:
"""
multiqc_mappings_config.py \\
$csv \\
multiqc_config.yml

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
}
9 changes: 0 additions & 9 deletions modules/local/multiqc_mappings_config/nextflow.config

This file was deleted.

12 changes: 1 addition & 11 deletions modules/local/sra_fastq_ftp/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ process SRA_FASTQ_FTP {
output:
tuple val(meta), path("*fastq.gz"), emit: fastq
tuple val(meta), path("*md5") , emit: md5
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('wget'), eval("echo \$(wget --version | head -n 1 | sed 's/^GNU Wget //; s/ .*\$//')"), topic: versions

script:
def args = task.ext.args ?: ''
Expand All @@ -28,11 +28,6 @@ process SRA_FASTQ_FTP {

echo "${meta.md5_1} ${meta.id}.fastq.gz" > ${meta.id}.fastq.gz.md5
md5sum -c ${meta.id}.fastq.gz.md5

cat <<-END_VERSIONS > versions.yml
"${task.process}":
wget: \$(echo \$(wget --version | head -n 1 | sed 's/^GNU Wget //; s/ .*\$//'))
END_VERSIONS
"""
} else {
"""
Expand All @@ -51,11 +46,6 @@ process SRA_FASTQ_FTP {

echo "${meta.md5_2} ${meta.id}_2.fastq.gz" > ${meta.id}_2.fastq.gz.md5
md5sum -c ${meta.id}_2.fastq.gz.md5

cat <<-END_VERSIONS > versions.yml
"${task.process}":
wget: \$(echo \$(wget --version | head -n 1 | sed 's/^GNU Wget //; s/ .*\$//'))
END_VERSIONS
"""
}
}
12 changes: 0 additions & 12 deletions modules/local/sra_fastq_ftp/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
process {
withName: 'SRA_FASTQ_FTP' {
ext.args = '-t 5 -nv -c -T 60'
publishDir = [
[
path: { "${params.outdir}/fastq" },
mode: params.publish_dir_mode,
pattern: "*.fastq.gz"
],
[
path: { "${params.outdir}/fastq/md5" },
mode: params.publish_dir_mode,
pattern: "*.md5"
]
]
}
}
7 changes: 1 addition & 6 deletions modules/local/sra_ids_to_runinfo/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ process SRA_IDS_TO_RUNINFO {

output:
path "*.tsv" , emit: tsv
path "versions.yml", emit: versions
tuple val("${task.process}"), val('python'), eval("python --version | sed 's/Python //g'"), topic: versions

script:
def metadata_fields = fields ? "--ena_metadata_fields ${fields}" : ''
Expand All @@ -24,10 +24,5 @@ process SRA_IDS_TO_RUNINFO {
id.txt \\
${id}.runinfo.tsv \\
$metadata_fields

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
}
8 changes: 0 additions & 8 deletions modules/local/sra_ids_to_runinfo/nextflow.config

This file was deleted.

7 changes: 1 addition & 6 deletions modules/local/sra_runinfo_to_ftp/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ process SRA_RUNINFO_TO_FTP {

output:
path "*.tsv" , emit: tsv
path "versions.yml", emit: versions
tuple val("${task.process}"), val('python'), eval("python --version | sed 's/Python //g'"), topic: versions

script:
"""
sra_runinfo_to_ftp.py \\
${runinfo.join(',')} \\
${runinfo.toString().tokenize(".")[0]}.runinfo_ftp.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
}
9 changes: 0 additions & 9 deletions modules/local/sra_runinfo_to_ftp/nextflow.config

This file was deleted.

8 changes: 0 additions & 8 deletions modules/local/sra_to_samplesheet/nextflow.config

This file was deleted.

2 changes: 1 addition & 1 deletion modules/nf-core/custom/sratoolsncbisettings/main.nf

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

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

9 changes: 2 additions & 7 deletions modules/nf-core/sratools/fasterqdump/main.nf

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

5 changes: 0 additions & 5 deletions modules/nf-core/sratools/fasterqdump/nextflow.config

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

2 changes: 1 addition & 1 deletion modules/nf-core/sratools/prefetch/main.nf

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

8 changes: 0 additions & 8 deletions modules/nf-core/sratools/prefetch/nextflow.config

This file was deleted.

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

Loading
Loading