annotate 0.5.0/workflows/bettercallsal_db.nf @ 1:365849f031fd

"planemo upload"
author kkonganti
date Mon, 05 Jun 2023 18:48:51 -0400
parents
children
rev   line source
kkonganti@1 1 // Define any required imports for this specific workflow
kkonganti@1 2 import java.nio.file.Paths
kkonganti@1 3 import nextflow.file.FileHelper
kkonganti@1 4
kkonganti@1 5
kkonganti@1 6 // Include any necessary methods
kkonganti@1 7 include { \
kkonganti@1 8 fastqEntryPointHelp; summaryOfParams; stopNow; sendMail; \
kkonganti@1 9 addPadding; wrapUpHelp } from "${params.routines}"
kkonganti@1 10 include { wcompHelp } from "${params.toolshelp}${params.fs}wcomp"
kkonganti@1 11 include { wsnpHelp } from "${params.toolshelp}${params.fs}wsnp"
kkonganti@1 12 include { mashsketchHelp } from "${params.toolshelp}${params.fs}mashsketch"
kkonganti@1 13
kkonganti@1 14
kkonganti@1 15 // Exit if help requested before any subworkflows
kkonganti@1 16 if (params.help) {
kkonganti@1 17 log.info help()
kkonganti@1 18 exit 0
kkonganti@1 19 }
kkonganti@1 20
kkonganti@1 21
kkonganti@1 22 // Include any necessary modules and subworkflows
kkonganti@1 23 include { DOWNLOAD_PDG_METADATA } from "${params.modules}${params.fs}download_pdg_metadata${params.fs}main"
kkonganti@1 24 include { FILTER_PDG_METADATA } from "${params.modules}${params.fs}filter_pdg_metadata${params.fs}main"
kkonganti@1 25 include { DB_PER_COMPUTED_SEROTYPE } from "${params.modules}${params.fs}db_per_computed_serotype${params.fs}main"
kkonganti@1 26 include { DB_PER_SNP_CLUSTER } from "${params.modules}${params.fs}db_per_snp_cluster${params.fs}main"
kkonganti@1 27 include { INDEX_METADATA } from "${params.modules}${params.fs}index_metadata${params.fs}main"
kkonganti@1 28 include { SCAFFOLD_GENOMES } from "${params.modules}${params.fs}scaffold_genomes${params.fs}main"
kkonganti@1 29 include { MASH_SKETCH } from "${params.modules}${params.fs}mash${params.fs}sketch${params.fs}main"
kkonganti@1 30 include { DUMP_SOFTWARE_VERSIONS } from "${params.modules}${params.fs}custom${params.fs}dump_software_versions${params.fs}main"
kkonganti@1 31
kkonganti@1 32 /*
kkonganti@1 33 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 34 INPUTS AND ANY CHECKS FOR THE BETTERCALLSAL_DB WORKFLOW
kkonganti@1 35 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 36 */
kkonganti@1 37
kkonganti@1 38 if (!params.output) {
kkonganti@1 39 stopNow("Please mention the absolute UNIX path to store the DB flat files\n" +
kkonganti@1 40 "using the --output option.\n" +
kkonganti@1 41 "Ex: --output /path/to/bettercallsal/db_files")
kkonganti@1 42 }
kkonganti@1 43
kkonganti@1 44 /*
kkonganti@1 45 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 46 RUN THE BETTERCALLSAL_DB WORKFLOW
kkonganti@1 47 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 48 */
kkonganti@1 49
kkonganti@1 50 workflow BETTERCALLSAL_DB {
kkonganti@1 51 main:
kkonganti@1 52 log.info summaryOfParams()
kkonganti@1 53
kkonganti@1 54 DOWNLOAD_PDG_METADATA ( params.pdg_release ?: null )
kkonganti@1 55
kkonganti@1 56 DOWNLOAD_PDG_METADATA
kkonganti@1 57 .out
kkonganti@1 58 .versions
kkonganti@1 59 .set { software_versions }
kkonganti@1 60
kkonganti@1 61 FILTER_PDG_METADATA ( DOWNLOAD_PDG_METADATA.out.accs )
kkonganti@1 62
kkonganti@1 63 DB_PER_COMPUTED_SEROTYPE (
kkonganti@1 64 FILTER_PDG_METADATA.out.accs_chunk_tbl,
kkonganti@1 65 DOWNLOAD_PDG_METADATA.out.pdg_metadata
kkonganti@1 66 )
kkonganti@1 67
kkonganti@1 68 DB_PER_SNP_CLUSTER (
kkonganti@1 69 FILTER_PDG_METADATA.out.accs_chunk_tbl,
kkonganti@1 70 DOWNLOAD_PDG_METADATA.out.pdg_metadata,
kkonganti@1 71 DOWNLOAD_PDG_METADATA.out.snp_cluster_metadata
kkonganti@1 72 )
kkonganti@1 73
kkonganti@1 74 DB_PER_COMPUTED_SEROTYPE.out.genome_paths
kkonganti@1 75 .map { query ->
kkonganti@1 76 kv = [:]
kkonganti@1 77 kv['id'] = 'comp'
kkonganti@1 78 [ kv, query ]
kkonganti@1 79 }
kkonganti@1 80 .concat(
kkonganti@1 81 DB_PER_SNP_CLUSTER.out.genome_paths
kkonganti@1 82 .map { query ->
kkonganti@1 83 kv = [:]
kkonganti@1 84 kv['id'] = 'snp'
kkonganti@1 85 [ kv, query ]
kkonganti@1 86 }
kkonganti@1 87 )
kkonganti@1 88 .groupTuple(by: [0])
kkonganti@1 89 .set { ch_mash_these_genomes }
kkonganti@1 90
kkonganti@1 91 DB_PER_SNP_CLUSTER
kkonganti@1 92 .out
kkonganti@1 93 .asm_chunk_snp_tbl
kkonganti@1 94 .concat( DB_PER_COMPUTED_SEROTYPE.out.asm_chunk_comp_tbl )
kkonganti@1 95 .map { acc ->
kkonganti@1 96 [ acc.name.find(/\_comp|\_snp/), acc ]
kkonganti@1 97 }
kkonganti@1 98 .set { ch_index_metadata }
kkonganti@1 99
kkonganti@1 100 INDEX_METADATA ( ch_index_metadata )
kkonganti@1 101
kkonganti@1 102 DB_PER_COMPUTED_SEROTYPE.out.accs_comp
kkonganti@1 103 .concat( DB_PER_SNP_CLUSTER.out.accs_snp )
kkonganti@1 104 .collectFile(name: 'accs_to_download.txt')
kkonganti@1 105 .splitText(by: params.genomes_chunk, file: true)
kkonganti@1 106 .set { ch_accs_to_download }
kkonganti@1 107
kkonganti@1 108 SCAFFOLD_GENOMES ( ch_accs_to_download )
kkonganti@1 109
kkonganti@1 110 SCAFFOLD_GENOMES
kkonganti@1 111 .out
kkonganti@1 112 .genomes_dir
kkonganti@1 113 .toSortedList()
kkonganti@1 114 .flatten()
kkonganti@1 115 .unique()
kkonganti@1 116 .set { ch_genomes_dir }
kkonganti@1 117
kkonganti@1 118 MASH_SKETCH (
kkonganti@1 119 ch_mash_these_genomes.combine( ch_genomes_dir )
kkonganti@1 120 )
kkonganti@1 121
kkonganti@1 122 DUMP_SOFTWARE_VERSIONS (
kkonganti@1 123 software_versions
kkonganti@1 124 .mix (
kkonganti@1 125 DOWNLOAD_PDG_METADATA.out.versions,
kkonganti@1 126 FILTER_PDG_METADATA.out.versions,
kkonganti@1 127 DB_PER_COMPUTED_SEROTYPE.out.versions,
kkonganti@1 128 DB_PER_SNP_CLUSTER.out.versions,
kkonganti@1 129 INDEX_METADATA.out.versions,
kkonganti@1 130 SCAFFOLD_GENOMES.out.versions,
kkonganti@1 131 MASH_SKETCH.out.versions,
kkonganti@1 132 )
kkonganti@1 133 .unique()
kkonganti@1 134 .collectFile(name: 'collected_versions.yml')
kkonganti@1 135 )
kkonganti@1 136 }
kkonganti@1 137
kkonganti@1 138 /*
kkonganti@1 139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 140 ON COMPLETE, SHOW GORY DETAILS OF ALL PARAMS WHICH WILL BE HELPFUL TO DEBUG
kkonganti@1 141 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 142 */
kkonganti@1 143
kkonganti@1 144 workflow.onComplete {
kkonganti@1 145 if (workflow.success) {
kkonganti@1 146 sendMail()
kkonganti@1 147 }
kkonganti@1 148 }
kkonganti@1 149
kkonganti@1 150 workflow.onError {
kkonganti@1 151 sendMail()
kkonganti@1 152 }
kkonganti@1 153
kkonganti@1 154 /*
kkonganti@1 155 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 156 HELP TEXT METHODS FOR BETTERCALLSAL_DB WORKFLOW
kkonganti@1 157 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkonganti@1 158 */
kkonganti@1 159
kkonganti@1 160 def help() {
kkonganti@1 161
kkonganti@1 162 Map helptext = [:]
kkonganti@1 163
kkonganti@1 164 helptext.putAll (
kkonganti@1 165 fastqEntryPointHelp().findAll {
kkonganti@1 166 it.key =~ /Required|output|Other|Workflow|Author|Version/
kkonganti@1 167 } +
kkonganti@1 168 wcompHelp(params).text +
kkonganti@1 169 wsnpHelp(params).text +
kkonganti@1 170 mashsketchHelp(params).text +
kkonganti@1 171 wrapUpHelp()
kkonganti@1 172 )
kkonganti@1 173
kkonganti@1 174 return addPadding(helptext)
kkonganti@1 175 }