Skip to content

Commit f6757a1

Browse files
committed
WIP implement as local modules
1 parent 982b7bf commit f6757a1

File tree

7 files changed

+140
-42
lines changed

7 files changed

+140
-42
lines changed

assets/schema_input.json

+3-11
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,19 @@
77
"items": {
88
"type": "object",
99
"properties": {
10-
"sample": {
10+
"id": {
1111
"type": "string",
1212
"pattern": "^\\S+$",
1313
"errorMessage": "Sample name must be provided and cannot contain spaces",
1414
"meta": ["id"]
1515
},
16-
"fastq_1": {
16+
"checksums": {
1717
"type": "string",
1818
"format": "file-path",
1919
"exists": true,
20-
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
2120
"errorMessage": "FastQ file for reads 1 must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
22-
},
23-
"fastq_2": {
24-
"type": "string",
25-
"format": "file-path",
26-
"exists": true,
27-
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
28-
"errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
2921
}
3022
},
31-
"required": ["sample", "fastq_1"]
23+
"required": ["id", "checksums"]
3224
}
3325
}

main.nf

+4-21
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,7 @@ params.fasta = getGenomeAttribute('fasta')
3737
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3838
*/
3939

40-
//
41-
// WORKFLOW: Run main analysis pipeline depending on type of input
42-
//
43-
workflow NFCORE_DATASYNC {
4440

45-
take:
46-
samplesheet // channel: samplesheet read in from --input
47-
48-
main:
49-
50-
//
51-
// WORKFLOW: Run pipeline
52-
//
53-
DATASYNC (
54-
samplesheet
55-
)
56-
emit:
57-
multiqc_report = DATASYNC.out.multiqc_report // channel: /path/to/multiqc_report.html
58-
}
5941
/*
6042
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6143
RUN MAIN WORKFLOW
@@ -80,8 +62,9 @@ workflow {
8062
//
8163
// WORKFLOW: Run main workflow
8264
//
83-
NFCORE_DATASYNC (
84-
PIPELINE_INITIALISATION.out.samplesheet
65+
DATASYNC (
66+
PIPELINE_INITIALISATION.out.samplesheet,
67+
params.workflow_type
8568
)
8669
//
8770
// SUBWORKFLOW: Run completion tasks
@@ -93,7 +76,7 @@ workflow {
9376
params.outdir,
9477
params.monochrome_logs,
9578
params.hook_url,
96-
NFCORE_DATASYNC.out.multiqc_report
79+
DATASYNC.out.multiqc_report
9780
)
9881
}
9982

modules/local/sha256sum/main.nf

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
process SHA256SUM_CHECK {
2+
container "biocontainers/fastp:0.23.4--h5f740d0_0" //Using the same as the nf-core shasum module
3+
//Rocky doesnt contain ps - which is required for nextflow https://nextflow.io/docs/latest/container.html
4+
5+
label 'process_single'
6+
7+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8+
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' :
9+
'nf-core/ubuntu:20.04' }"
10+
11+
input:
12+
tuple val(meta), path(checksum_file)
13+
14+
output:
15+
tuple val(meta), path(report)
16+
17+
script:
18+
"""
19+
sha256sum -c ${checksum_file} > ${meta.id}.report.txt
20+
"""
21+
}

nextflow.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ params {
2525
max_multiqc_email_size = '25.MB'
2626
multiqc_methods_description = null
2727

28+
// workflow
29+
workflow_type = "checksum_verify"
30+
// Checksum verify options
31+
chunksize = 100
32+
2833
// Boilerplate options
2934
outdir = null
3035
publish_dir_mode = 'copy'
@@ -232,7 +237,7 @@ manifest {
232237

233238
// Nextflow plugins
234239
plugins {
235-
id 'nf-schema@2.1.1' // Validation of pipeline parameters and creation of an input channel from a sample sheet
240+
id 'nf-schema@2.2.0' // Validation of pipeline parameters and creation of an input channel from a sample sheet
236241
}
237242

238243
validation {

nextflow_schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
"description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.",
3030
"fa_icon": "fas fa-folder-open"
3131
},
32+
"workflow_type": {
33+
"type": "string"
34+
},
35+
"chunksize": {
36+
"type": "integer"
37+
},
3238
"email": {
3339
"type": "string",
3440
"description": "Email address for completion summary.",

subworkflows/local/checksum_verify.nf

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
IMPORT MODULES / SUBWORKFLOWS / FUNCTIONS
4+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5+
*/
6+
include { SHA256SUM_CHECK } from "../../modules/local/sha256sum/main"
7+
include { MULTIQC } from '../../modules/nf-core/multiqc/main'
8+
include { paramsSummaryMap } from 'plugin/nf-schema'
9+
include { paramsSummaryMultiqc } from '../nf-core/utils_nfcore_pipeline'
10+
include { softwareVersionsToYAML } from '../nf-core/utils_nfcore_pipeline'
11+
include { methodsDescriptionText } from '../local/utils_nfcore_datasync_pipeline'
12+
13+
/*
14+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
RUN MAIN WORKFLOW
16+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
*/
18+
19+
workflow CHECKSUM_VERIFY {
20+
21+
take:
22+
ch_samplesheet // channel: samplesheet read in from --input
23+
main:
24+
25+
ch_samplesheet.view()
26+
ch_versions = Channel.empty()
27+
ch_multiqc_files = Channel.empty()
28+
29+
30+
31+
//
32+
// Collate and save software versions
33+
//
34+
softwareVersionsToYAML(ch_versions)
35+
.collectFile(
36+
storeDir: "${params.outdir}/pipeline_info",
37+
name: 'nf_core_' + 'pipeline_software_' + 'mqc_' + 'versions.yml',
38+
sort: true,
39+
newLine: true
40+
).set { ch_collated_versions }
41+
42+
43+
//
44+
// MODULE: MultiQC
45+
//
46+
ch_multiqc_config = Channel.fromPath(
47+
"$projectDir/assets/multiqc_config.yml", checkIfExists: true)
48+
ch_multiqc_custom_config = params.multiqc_config ?
49+
Channel.fromPath(params.multiqc_config, checkIfExists: true) :
50+
Channel.empty()
51+
ch_multiqc_logo = params.multiqc_logo ?
52+
Channel.fromPath(params.multiqc_logo, checkIfExists: true) :
53+
Channel.empty()
54+
55+
summary_params = paramsSummaryMap(
56+
workflow, parameters_schema: "nextflow_schema.json")
57+
ch_workflow_summary = Channel.value(paramsSummaryMultiqc(summary_params))
58+
ch_multiqc_files = ch_multiqc_files.mix(
59+
ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
60+
ch_multiqc_custom_methods_description = params.multiqc_methods_description ?
61+
file(params.multiqc_methods_description, checkIfExists: true) :
62+
file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)
63+
ch_methods_description = Channel.value(
64+
methodsDescriptionText(ch_multiqc_custom_methods_description))
65+
66+
ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions)
67+
ch_multiqc_files = ch_multiqc_files.mix(
68+
ch_methods_description.collectFile(
69+
name: 'methods_description_mqc.yaml',
70+
sort: true
71+
)
72+
)
73+
74+
MULTIQC (
75+
ch_multiqc_files.collect(),
76+
ch_multiqc_config.toList(),
77+
ch_multiqc_custom_config.toList(),
78+
ch_multiqc_logo.toList(),
79+
[],
80+
[]
81+
)
82+
83+
emit:multiqc_report = MULTIQC.out.report.toList() // channel: /path/to/multiqc_report.html
84+
versions = ch_versions // channel: [ path(versions.yml) ]
85+
86+
}
87+
88+
/*
89+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
THE END
91+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92+
*/

workflows/datasync.nf

+8-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
IMPORT MODULES / SUBWORKFLOWS / FUNCTIONS
44
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
*/
6-
include { FASTQC } from '../modules/nf-core/fastqc/main'
76
include { MULTIQC } from '../modules/nf-core/multiqc/main'
7+
include { CHECKSUM_VERIFY } from "../subworkflows/local/checksum_verify"
88
include { paramsSummaryMap } from 'plugin/nf-schema'
99
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
1010
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
@@ -20,18 +20,17 @@ workflow DATASYNC {
2020

2121
take:
2222
ch_samplesheet // channel: samplesheet read in from --input
23+
workflow_type
2324
main:
2425

2526
ch_versions = Channel.empty()
2627
ch_multiqc_files = Channel.empty()
27-
//
28-
// MODULE: Run FastQC
29-
//
30-
FASTQC (
31-
ch_samplesheet
32-
)
33-
ch_multiqc_files = ch_multiqc_files.mix(FASTQC.out.zip.collect{it[1]})
34-
ch_versions = ch_versions.mix(FASTQC.out.versions.first())
28+
29+
if(workflow_type == "checksum_verify") {
30+
CHECKSUM_VERIFY(ch_samplesheet)
31+
} else {
32+
error "Not Implemented"
33+
}
3534

3635
//
3736
// Collate and save software versions

0 commit comments

Comments
 (0)