Mercurial > repos > galaxytrakr > hfp_centriflaken_awsbatch
comparison 0.4.2/workflows/spades_only.nf @ 0:082e0091e813 draft default tip
planemo upload
| author | galaxytrakr |
|---|---|
| date | Fri, 29 May 2026 13:27:47 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:082e0091e813 |
|---|---|
| 1 // Define any required imports for this specific workflow | |
| 2 import java.nio.file.Paths | |
| 3 import nextflow.file.FileHelper | |
| 4 | |
| 5 // Include any necessary methods | |
| 6 include { \ | |
| 7 summaryOfParams; stopNow; fastqEntryPointHelp; sendMail; \ | |
| 8 addPadding; wrapUpHelp } from "${params.routines}" | |
| 9 include { spadesHelp } from "${params.toolshelp}${params.fs}spades" | |
| 10 | |
| 11 | |
| 12 // Exit if help requested before any subworkflows | |
| 13 if (params.help) { | |
| 14 log.info help() | |
| 15 exit 0 | |
| 16 } | |
| 17 | |
| 18 // Include any necessary modules and subworkflows | |
| 19 include { PROCESS_FASTQ } from "${params.subworkflows}${params.fs}process_fastq" | |
| 20 include { SPADES_ASSEMBLE } from "${params.modules}${params.fs}spades${params.fs}assemble${params.fs}main" | |
| 21 include { DUMP_SOFTWARE_VERSIONS } from "${params.modules}${params.fs}custom${params.fs}dump_software_versions${params.fs}main" | |
| 22 | |
| 23 | |
| 24 | |
| 25 /* | |
| 26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 27 INPUTS AND ANY CHECKS FOR THE CENTRIFLAKEN-HY WORKFLOW | |
| 28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 29 */ | |
| 30 | |
| 31 def spades_custom_hmm = (params.spades_hmm ? file ( "${params.spades_hmm}" ) : false) | |
| 32 def reads_platform = 0 | |
| 33 | |
| 34 reads_platform += (params.input ? 1 : 0) | |
| 35 | |
| 36 if (spades_custom_hmm && !spades_custom_hmm.exists()) { | |
| 37 stopNow("Please check if the following SPAdes' custom HMM directory\n" + | |
| 38 "path is valid:\n${params.spades_hmm}\nCannot proceed further!") | |
| 39 } | |
| 40 | |
| 41 if (reads_platform < 1 || reads_platform == 0) { | |
| 42 stopNow("Please mention at least one absolute path to input folder which contains\n" + | |
| 43 "FASTQ files sequenced using the --input option.\n" + | |
| 44 "Ex: --input (Illumina or Generic short reads in FASTQ format)") | |
| 45 } | |
| 46 | |
| 47 /* | |
| 48 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 49 RUN THE CENTRIFLAKEN-HY WORKFLOW | |
| 50 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 51 */ | |
| 52 | |
| 53 workflow SPADES_ONLY { | |
| 54 main: | |
| 55 ch_dummy = Channel.fromPath("${params.dummyfile}") | |
| 56 ch_dummy2 = Channel.fromPath("${params.dummyfile2}") | |
| 57 | |
| 58 log.info summaryOfParams() | |
| 59 | |
| 60 PROCESS_FASTQ() | |
| 61 .processed_reads | |
| 62 .set { ch_processed_reads } | |
| 63 | |
| 64 PROCESS_FASTQ | |
| 65 .out | |
| 66 .versions | |
| 67 .set { software_versions } | |
| 68 | |
| 69 // As of 06/02/2022, with the upcoming newer versions of NextFlow, we will be able to do | |
| 70 // allowNull: true for both input and output, but until then, we have to use dummy files. | |
| 71 // and work arounds. | |
| 72 // https://github.com/nextflow-io/nextflow/pull/2893 | |
| 73 | |
| 74 SPADES_ASSEMBLE ( | |
| 75 ch_processed_reads | |
| 76 .combine(ch_dummy) | |
| 77 .combine(ch_dummy2) | |
| 78 ) | |
| 79 | |
| 80 SPADES_ASSEMBLE | |
| 81 .out | |
| 82 .assembly | |
| 83 .set { ch_assembly } | |
| 84 | |
| 85 software_versions | |
| 86 .mix ( SPADES_ASSEMBLE.out.versions.ifEmpty(null) ) | |
| 87 .set { software_versions } | |
| 88 | |
| 89 | |
| 90 DUMP_SOFTWARE_VERSIONS ( | |
| 91 software_versions | |
| 92 .unique() | |
| 93 .collectFile(name: 'collected_versions.yml') | |
| 94 ) | |
| 95 } | |
| 96 | |
| 97 /* | |
| 98 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 99 ON COMPLETE, SHOW GORY DETAILS OF ALL PARAMS WHICH WILL BE HELPFUL TO DEBUG | |
| 100 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 101 */ | |
| 102 | |
| 103 workflow.onComplete { | |
| 104 if (workflow.success) { | |
| 105 sendMail() | |
| 106 } | |
| 107 } | |
| 108 | |
| 109 workflow.onError { | |
| 110 sendMail() | |
| 111 } | |
| 112 | |
| 113 /* | |
| 114 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 115 HELPER METHODS FOR CENTRIFLAKEN-HY WORKFLOW | |
| 116 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 117 */ | |
| 118 | |
| 119 def help() { | |
| 120 | |
| 121 Map helptext = [:] | |
| 122 | |
| 123 helptext.putAll ( | |
| 124 fastqEntryPointHelp() + | |
| 125 spadesHelp(params).text + | |
| 126 wrapUpHelp() | |
| 127 ) | |
| 128 | |
| 129 return addPadding(helptext) | |
| 130 } |
