diff --git a/assets/final_email_template.txt b/assets/final_email_template.txt index fe40165f8cfdb69d0f1fe03d459c106171176194..4d0b8b66eb417522da383c29dcf91151056daf38 100644 --- a/assets/final_email_template.txt +++ b/assets/final_email_template.txt @@ -11,10 +11,13 @@ Project : $project Run : $run <% if (xpNGLSq){ out << "NGL-SQ Experiment : $xpNGLSq " } %> <% if (runNGLBi){out << "NGL-Bi RunCode : $runNGLBi" } %> +<% if (analysisNGLBi){out << "NGL-Bi AnalysisCode : $analysisNGLBi" } %> <% if (success){ out << """## GeT-nextflow-NGL-Bi/wf-Illumina-nf execution completed successfully! ## \n""" - if (runNGLBi){ + if (analysisNGLBi){ + out << """\tCheck your analyzes on NGL-Bi : https://ngl-bi.genomique.genotoul.fr/analyses/${analysisNGLBi} """ + } else if (runNGLBi){ out << """\tCheck your analyzes on NGL-Bi : https://ngl-bi.genomique.genotoul.fr/runs/${runNGLBi} """ } else { out << """\tYour analyzes are NOT on NGL-Bi : ask to a bioinfo team member for details.""" diff --git a/assets/get_plage_logo.jpg b/assets/get_plage_logo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ba357d5e88209733a2727b5bd198fa7d47470ecb Binary files /dev/null and b/assets/get_plage_logo.jpg differ diff --git a/assets/multiqc_config.yaml b/assets/multiqc_config.yaml index 75a0989baa999e00600a60420d1c27afc1c065bf..d311a8713542ab769206d7d66b466ab8757aba78 100644 --- a/assets/multiqc_config.yaml +++ b/assets/multiqc_config.yaml @@ -94,7 +94,6 @@ sp: fn: '*_screen.txt' -custom_logo: "./get_logo.png" custom_logo_url: "https://get.genotoul.fr/" custom_logo_title: "GeT-GenoToul" diff --git a/bin/demuxStatsElement.R b/bin/demuxStatsElement.R index 2cf47cb82f6c43bcfb3afee08afba2d945757d93..4333cad720452ed0e4d93f950b154a2c657ee44e 100755 --- a/bin/demuxStatsElement.R +++ b/bin/demuxStatsElement.R @@ -88,6 +88,7 @@ for (i in 1:nrow(assigned_filtered)) { sample <- assigned_filtered[i, 2] bc1 <- assigned_filtered[i, 3] bc2 <- assigned_filtered[i, 4] + barcode <- ifelse(is.na(bc2), bc1, paste(bc1, bc2, sep = "-")) bcCount <- assigned_filtered[i, 5]*2 project <- run_manifest$Samples %>% @@ -97,7 +98,7 @@ for (i in 1:nrow(assigned_filtered)) { new_row <- data.frame( Project = project, Sample = sample, - Barcode = paste(bc1, bc2, sep = "-"), + Barcode = barcode, bcCount = bcCount, percOfFrag = NA, stringsAsFactors = FALSE @@ -113,26 +114,31 @@ bcCount.threshold<-threshold*min(demultiplex_stat$bcCount) # Parcourir les lignes du fichier unassigned cat("\nExtraction des séquences non assignés\n") -for (i in 1:nrow(unassigned_filtered)) { - sample <- "Undetermined" - bc1 <- unassigned_filtered[i, 1] - bc2 <- unassigned_filtered[i, 2] - bcCount <- unassigned_filtered[i, 4]*2 - - project <- "DefaultProject" - - new_row <- data.frame( - Project = project, - Sample = sample, - Barcode = paste(bc1, bc2, sep = "-"), - bcCount = bcCount, - percOfFrag = NA, - stringsAsFactors = FALSE - ) - - cat("\tAjout de l'échantillon : ", project, "->" , sample, "\n") - - demultiplex_stat <- rbind(demultiplex_stat, new_row) +if(nrow(unassigned_filtered) == 0){ + cat("\tAucun index non assigné n'a été trouvé pour la lane ", lane, "\n") +} else { + for (i in 1:nrow(unassigned_filtered)) { + sample <- "Undetermined" + bc1 <- unassigned_filtered[i, 1] + bc2 <- unassigned_filtered[i, 2] + barcode <- ifelse(is.na(bc2), bc1, paste(bc1, bc2, sep = "-")) + bcCount <- unassigned_filtered[i, 4]*2 + + project <- "DefaultProject" + + new_row <- data.frame( + Project = project, + Sample = sample, + Barcode = barcode, + bcCount = bcCount, + percOfFrag = NA, + stringsAsFactors = FALSE + ) + + cat("\tAjout de l'échantillon : ", project, "->" , sample, "\n") + + demultiplex_stat <- rbind(demultiplex_stat, new_row) + } } cat("\n") diff --git a/conf/base.config b/conf/base.config index 0ce330ce58802443822a286121c938a9950f7678..4bc6650c6d84d233edb5dfd88c1910e5a009282f 100644 --- a/conf/base.config +++ b/conf/base.config @@ -345,8 +345,8 @@ process { withName: MULTIQC { ext.args = [ - "--config ${baseDir}/assets/multiqc_config.yaml", - params.project ? "--title '${params.project} - ${params.run_name}'" : '' + params.project ? "--title '${params.project} - ${params.run_name}'" : '', + "--filename '${params.project}_${params.run_name}_${params.fc_id}_${params.lane}_multiqc.html'" ].join(' ') beforeScript = "module purge" diff --git a/conf/report.config b/conf/report.config index 5a1322eade527ef37e10f0605f582577dd5323c6..42aef5472c129399343fd14a1a0d1f90bc62be06 100644 --- a/conf/report.config +++ b/conf/report.config @@ -29,5 +29,5 @@ manifest { description = "Workflow for Illumina data quality control" mainScript = 'main.nf' nextflowVersion = '>=0.32.0' - version = '1.25.0' + version = '1.26.5' } \ No newline at end of file diff --git a/lib/pipeline.groovy b/lib/pipeline.groovy index e785788b6bd2c848d8889fb7ecff8bd28998ca2c..4cc505efafaf00e69d28035acbd3791a6edfe6e9 100644 --- a/lib/pipeline.groovy +++ b/lib/pipeline.groovy @@ -120,6 +120,31 @@ begin_email_fields = get_workflow_info( // ---------------------------------- // Functions Definition // ---------------------------------- +def getPipelineInfo() { + def map = [:] + map['Analysis Name'] = params.run_name + File analysis_file = new File(params.outdir + '/ngl/NGL-BiAnalysis.created') + if (analysis_file.exists()) { + map['Analysis Code'] = analysis_file.getString() + } else { + map['Analysis Code'] = '###ANALYSIS_CODE###' + } + map['Library Type'] = params.data_nature ?: '' + map['Sequencing Type'] = params.is_multiplex ? 'Multiplex' : 'Simplex' + def ref = params.reference_genome ?: params.reference_transcriptome?: '' + File ref_source = new File(ref + '_source') + if (ref_source.exists()) { + map['Reference'] = ref_source.getText() + } + def seq = params.sequencer ?: '' + def sn = params.machine_id ?: '' + def platform = "$seq $sn" + map['Sequencing Platform'] = platform ?: '' + map['Contact E-mail'] = 'get-plage.contact@genotoul.fr' + + return map +} + def create_email_map() { def hash = [:] @@ -150,13 +175,33 @@ def create_email_map() { } def create_final_email_fields(formatted_date, summary) { + // Get AnalysisCode + def analysis_code = '' + File analysis_file = new File(params.outdir + '/ngl/NGL-BiAnalysis.created') + if (analysis_file.exists()) { + analysis_code = analysis_file.text + } + + // Get RunCode + def run_code = '' + if (params.insert_to_ngl) { + if (params.bi_run_code) { run_code = params.bi_run_code } + else { + File run_file = new File(params.outdir + '/ngl/RunNGL-Bi.created') + if (run_file.exists()) { + run_code = run_file.text + } + } + } + return get_workflow_info( [ subject_prefix: "[${params.sequencer}]", subject_sufix: params.inputdir.split('/')[-1], project: (params.project ?: ''), run: (params.run_name ?: ''), - runNGLBi: (params.bi_run_code ?: ''), + runNGLBi: run_code, + analysisNGLBi: analysis_code, xpNGLSq: (params.sq_xp_code ?: ''), dateComplete: formatted_date, summary: (summary ?: [:]) diff --git a/workflow/short_reads_qc.nf b/workflow/short_reads_qc.nf index 41bef8c9db65ddae0f10cc39985ade350f1b15a7..5dd432a5000a7b803d528d1e2df126a1dfd4a697 100644 --- a/workflow/short_reads_qc.nf +++ b/workflow/short_reads_qc.nf @@ -3,7 +3,8 @@ nextflow.enable.dsl = 2 include { getSummary; - endOfPipelineEvents } from "${baseDir}/lib/pipeline.groovy" + endOfPipelineEvents; + getPipelineInfo } from "${baseDir}/lib/pipeline.groovy" include { softwareVersionsToYAML } from "${params.shared_modules}/lib/utils.groovy" // ------------------------------------------------- // CHANNELS @@ -67,6 +68,9 @@ ch_demux_stat_json = Channel.fromPath("${params.inputdir}/Stats/Stats.json") mismatchNumber = params.sequencer == 'MiSeq'? 0 : 1 //banksForConta = params.addBankForConta ? params.genomesRefForConta << params.addBankForConta : params.genomesRefForConta +ch_mqc_config = Channel.fromPath("${baseDir}/assets/multiqc_config.yaml") +ch_mqc_logo = Channel.from("${baseDir}/assets/get_logo.png") + createDir = file(params.outdir).mkdir() params.summary = getSummary() params.summary.collect{k,v -> println "$k : $v"} @@ -85,6 +89,7 @@ include { TREATMENT_DEMUXSTAT as TREATMENT_DEMUX_RUN; TREATMENT_DEMUXSTAT as TREATMENT_DEMUX_READSETS; } from "$baseDir/modules/local/module_NGL-Bi.nf" include { MULTIQC } from "${params.shared_modules}/multiqc.nf" +include { MQC_HEADER } from "${params.shared_modules}/multiqc.nf" include { GCBIAS as GC_BIAS } from "${params.shared_modules}/gcbias.nf" include { workflow_summary as WORKFLOW_SUMMARY } from "${params.shared_modules}/workflow_summary.nf" @@ -97,24 +102,36 @@ workflow SHORT_READS_QC { WORKFLOW_SUMMARY() - if (! params.skip_core_illumina && params.sequencer =~ "NovaSeq|MiSeq" ) { - CORE_ILLUMINA(ch_ss, ch_DemuxStatXML, ch_DemuxSummary, ch_read) - fastq = CORE_ILLUMINA.out.fastq - ch_versions = ch_versions.mix(CORE_ILLUMINA.out.versions) - demux_stats = CORE_ILLUMINA.out.demuxStat - } else { - fastq = ch_read - demux_stats = channel.empty() + if ( params.sequencer =~ "NovaSeq|MiSeq" ) { + if (params.skip_core_illumina) { + log.info "Illumina's sequencer but skipping CORE_ILLUMINA" + fastq = ch_read + demux_stats = channel.empty() + } else { + CORE_ILLUMINA(ch_ss, ch_DemuxStatXML, ch_DemuxSummary, ch_read) + fastq = CORE_ILLUMINA.out.fastq + ch_versions = ch_versions.mix(CORE_ILLUMINA.out.versions) + demux_stats = CORE_ILLUMINA.out.demuxStat + } } - if (! params.skip_core_element && params.sequencer =~ "AVITI") { - CORE_ELEMENT(ch_runManifestJSON, ch_indexAssigned, ch_indexUnassigned) - demux_stats = CORE_ELEMENT.out.demuxStat - } else { - demux_stats = Channel.empty() + + if ( params.sequencer =~ "AVITI") { + if (params.skip_core_element) { + log.info "Elembio's sequencer but skipping CORE_ELEMENT" + demux_stats = Channel.empty() + } else { + CORE_ELEMENT(ch_runManifestJSON, ch_indexAssigned, ch_indexUnassigned) + demux_stats = CORE_ELEMENT.out.demuxStat + } } CORE(fastq) ch_versions = ch_versions.mix(CORE.out.versions) + ch_mqc = ch_mqc.mix( + CORE.out.fastqc_report.collect{it[1]}.ifEmpty([]), + CORE.out.fastqscreen_report.collect{it[1]}.ifEmpty([]), + CORE.out.fastp_report.collect{it[1]}.ifEmpty([]) + ) if (params.data_nature =~ 'DNA|GENOMIC|WGS') { DNA_QC(CORE.out.subset_fastq @@ -171,14 +188,14 @@ workflow SHORT_READS_QC { newLine: true ) - MULTIQC(WORKFLOW_SUMMARY.out.ifEmpty([]) - .mix( - CORE.out.fastqc_report.collect{it[1]}.ifEmpty([]), - CORE.out.fastqscreen_report.collect{it[1]}.ifEmpty([]), - CORE.out.fastp_report.collect{it[1]}.ifEmpty([]), - ch_mqc.collect().ifEmpty([]), - version_yaml - ).collect() + MQC_HEADER(getPipelineInfo()) + ch_mqc_config = ch_mqc_config.mix(MQC_HEADER.out.yaml) + ch_mqc = ch_mqc.mix(version_yaml) + + MULTIQC( + ch_mqc.collect(), + ch_mqc_config.collect(), + ch_mqc_logo ) if (params.insert_to_ngl){