diff --git a/assets/fastq_screen.conf_example b/assets/fastq_screen.conf_example index dbbb7bcb7c49f4053af9020f13f4d0f4feb80ec9..084bedc9f2878193b04a37070bc4db1a20f13660 100644 --- a/assets/fastq_screen.conf_example +++ b/assets/fastq_screen.conf_example @@ -55,10 +55,10 @@ THREADS 8 ## have contaminated your sample during the library preparation step. ## Genome of E. coli -DATABASE E.coli /work/bank/bwadb/Escherichia_coli_FRIK2069 +DATABASE E.coli /home/sbsuser/plage/references/indexed/ng6_conta_ref/Escherichia_coli/FRIK2069/genome/BWA/Escherichia_coli_FRIK2069 Sequence of PhiX -DATABASE PhiX /work/bank/bwadb/phi.fa +DATABASE PhiX /home/sbsuser/plage/references/indexed/ng6_conta_ref/PhiX/BWA/phi.fa Genome of yeast -DATABASE Yeast /work/bank/bwadb/yeast.nt +DATABASE Yeast /home/sbsuser/plage/references/indexed/ng6_conta_ref/Saccharomyces_cerevisiae/genome/BWA/yeast.nt diff --git a/bin/demuxStatsElement.R b/bin/demuxStatsElement.R new file mode 100755 index 0000000000000000000000000000000000000000..7e25e1777383b7d1a5131498d2889a947f2942bc --- /dev/null +++ b/bin/demuxStatsElement.R @@ -0,0 +1,161 @@ +#!/usr/bin/env Rscript + +## Extrait des statistiques de demultipelxage de plusieurs fichiers générés par bases2fastq et les compile en un seul CSV. + +## -------------------- +# PACKAGES +## -------------------- +suppressWarnings(library('optparse')) +suppressWarnings(library('jsonlite')) +suppressWarnings(library('dplyr')) + +## -------------------- +# FUNCTIONS +## -------------------- + + +## -------------------- +# PARAMETERS +## -------------------- +option_list = list( + # All arguments are compulsory + make_option(c("-a", "--assigned"), type = "character", default = './IndexAssignment.csv', metavar = "character", + help = "Path to the IndexAssignment.csv file."), + make_option(c("-u", "--unassigned"), type = "character", default = './UnassignedSequences.csv', metavar = "character", + help = "Path to the UnassignedSequences.csv file."), + make_option(c("-r", "--runManifest"), type = "character", default = './RunManifest.json', metavar = "character", + help = "Path to the RunManifest.json file. That Must be a JSON file !"), + make_option(c("-l", "--lane"), type = "character", default = '1', metavar = "character", + help = "Lane to work on, could be 1, 2 or 1+2"), + make_option(c("-t", "--threshold"), type = "numeric", default = 0.8, metavar = "numeric", + help = "Barcode count threshold") +) + +opt_parser = OptionParser(usage="Make demultiplexStats file from Element demultiplexing output.", option_list = option_list) +opt = parse_args(opt_parser) + +if(is.null(opt$assigned) | is.null(opt$unassigned) | is.null(opt$runManifest) | is.null(opt$lane)) { + stop("At least one argument is missing.\n", call. = FALSE) +} + +## -------------------- +# LOG +## -------------------- +cat("\nLancement du script demuxStatsElement.R avec les options suivantes :\n") +cat(paste0("\tFichier des index assignés :\t\t", opt$assigned, "\n")) +cat(paste0("\tFichier des index non assignés :\t", opt$unassigned, "\n")) +cat(paste0("\tRunManifest :\t\t\t\t" , opt$runManifest, "\n")) +cat(paste0("\tNumero de lane :\t\t\t" , opt$lane, "\n")) +cat(paste0("\tBC count threshold :\t\t\t" , opt$threshold, "\n")) +launchDir<-getwd() +cat(paste0("\nRépertoire de travail :\t",launchDir , "\n\n")) + + +## -------------------- +# MAIN +## -------------------- +# Initialisation des variables +assigned <- opt$assigned +unassigned <- opt$unassigned +runManifestJson <- opt$runManifest +lane <- opt$lane +threshold <- opt$threshold +demultiplexStat <- paste0(launchDir,"/demultiplexStat.csv") +demultiplex_stat <- data.frame( + Project = character(), + Sample = character(), + Barcode = character(), + bcCount = integer(), + percOfFrag = numeric(), + stringsAsFactors = FALSE +) + +# Lecture des données d'entrée +assigned_data <- read.csv(assigned, stringsAsFactors = FALSE) +run_manifest <- fromJSON(runManifestJson) +unassigned_data <- read.csv(unassigned, stringsAsFactors = FALSE) + +# Filtrer les lignes par numéro de lane +assigned_filtered <- assigned_data %>% + filter(assigned_data [, ncol(assigned_data )] == lane) + +unassigned_filtered <- unassigned_data %>% + filter(unassigned_data[, ncol(unassigned_data)] == lane) + +# Parcourir les lignes du fichier assigned +cat("\nExtraction des échantillons assignés\n") +for (i in 1:nrow(assigned_filtered)) { + sample <- assigned_filtered[i, 2] + bc1 <- assigned_filtered[i, 3] + bc2 <- assigned_filtered[i, 4] + bcCount <- assigned_filtered[i, 5] + perc <- assigned_filtered[i, 6] + + project <- run_manifest$Samples %>% + filter(SampleName == sample) %>% + .$Project + + new_row <- data.frame( + Project = project, + Sample = sample, + Barcode = paste(bc1, bc2, sep = "-"), + bcCount = bcCount, + percOfFrag = perc, + stringsAsFactors = FALSE + ) + + cat("\tAjout de l'échantillon : ", project, "->" , sample, "\n") + + demultiplex_stat <- rbind(demultiplex_stat, new_row) +} +cat("\n") +# Récupération du seuil limite +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] + perc <- unassigned_filtered[i, 3] + + project <- "DefaultProject" + + new_row <- data.frame( + Project = project, + Sample = sample, + Barcode = paste(bc1, bc2, sep = "-"), + bcCount = bcCount, + percOfFrag = perc, + stringsAsFactors = FALSE + ) + + cat("\tAjout de l'échantillon : ", project, "->" , sample, "\n") + + demultiplex_stat <- rbind(demultiplex_stat, new_row) +} +cat("\n") + +# Filtrer les lignes selon le seuil de bcCount +initial_nrow <- nrow(demultiplex_stat) +demultiplex_stat <- demultiplex_stat %>% + filter(bcCount >= bcCount.threshold) +initial_nrow <- nrow(demultiplex_stat) +lines_removed <- initial_nrow - initial_nrow +cat("L'échantillon le moins souvent retrouvé a", min(demultiplex_stat$bcCount), "séquences\n") +cat("Le seuil du nombre de séquence à ", threshold*100, "% est donc de", bcCount.threshold, "séquences\n") +cat("Tous les index indéterminés ayant au moins ce nombre de séquences seront gardés\n") +cat("\tNombre de lignes retirées du demultiplexStat :", lines_removed, "\n") + +# Tri selon bcCount +demultiplex_stat <- demultiplex_stat %>% + arrange(desc(bcCount)) + + +# Écriture du fichier de sortie +cat("\nEcriture du fichier de sortie :", demultiplexStat,"\n") +write.csv(demultiplex_stat, demultiplexStat, row.names = FALSE, quote = FALSE) + +cat("Fin normale du script.\n") \ No newline at end of file diff --git a/conf/base.config b/conf/base.config index 2a88de8caebbb7e43484d1191c8fee6e964deb43..465f3617a3bf15ea5058a6ed4ebc10460dd0bde8 100644 --- a/conf/base.config +++ b/conf/base.config @@ -113,8 +113,6 @@ process { time = { checkMax( 1.h * task.attempt, 'time' ) } module = toolsModuleHash['FASTQSCREEN'] - ext.args = "--conf ${params.inputdir}/fastq_screen.conf" - publishDir = [ path: "${params.outdir}/ContaminationSearch/FastQ-Screen", mode: 'copy' @@ -326,7 +324,7 @@ process { module = toolsModuleHash['SEQTK'] } - withName: MULTIQC { + withName: MULTIQC { ext.args = [ "--config ${baseDir}/assets/multiqc_config.yaml", params.project ? "--title '${params.project} - ${params.run_name}'" : '' @@ -357,7 +355,7 @@ process { ] } - withName: MD5SUM { + withName: 'MD5SUM_FASTQ|MD5SUM_INDEX' { time = { checkMax( 3.h * task.attempt * params.resource_factor, 'time' ) } publishDir = [ path: "${params.outdir}/fastq", diff --git a/conf/functions.config b/conf/functions.config index 863ca2b1483ae1be9bbc8718e25d288835871ae1..e4ff01764a59115c40dbd79988e86225b7bda087 100644 --- a/conf/functions.config +++ b/conf/functions.config @@ -153,7 +153,7 @@ def sendFinalMail(formatted_date, summary) { email_fields['runNGLBi'] = (params.bi_run_code ?: '') email_fields['xpNGLSq'] = (params.sq_xp_code ?: '') email_fields['success'] = workflow.success - email_fields['instance'] = params.profile + email_fields['instance'] = workflow.profile email_fields['dateComplete'] = formatted_date email_fields['duration'] = workflow.duration email_fields['exitStatus'] = workflow.exitStatus diff --git a/docs/usage.md b/docs/usage.md index 0d966edd1a210ac071c334f8aba85da72d236feb..6bf72b35237374a0a7ffb10ef770a2fa05467739 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -131,7 +131,11 @@ To skip subsampling step in core pipeline. _Default_ : false - **`--skip_core_illumina`** [bool] -To skip core illumina sub-workflow in core pipeline. To be use to analyze data produced by other platform than Illumina. +To skip core illumina sub-workflow in core pipeline. Have effect only if `sequencer` is NovaSeq or MiSeq. +_Default_ : false + +- **`--skip_core_element`** [bool] +To skip core element sub-workflow in core pipeline.Have effect only if `sequencer` is AVITI. _Default_ : false ## Workflows related parameters diff --git a/main.nf b/main.nf index be6b94b402a7bc43dcd9206e3d1df0998a1dbc6a..639c4f5a01690b62fcbcdcef3b0c13d71d5edc14 100644 --- a/main.nf +++ b/main.nf @@ -32,10 +32,10 @@ params.summary.collect{k,v -> println "$k : $v"} NAMED WORKFLOW FOR PIPELINE ======================================================================================== */ -include { ILLUMINA_QC } from "$baseDir/workflow/illumina_qc.nf" +include { SHORT_READS_QC } from "$baseDir/workflow/illumina_qc.nf" -workflow QC_ANALYSIS { - ILLUMINA_QC() +workflow PLAGE { + SHORT_READS_QC() } /* @@ -45,5 +45,5 @@ workflow QC_ANALYSIS { */ workflow { - QC_ANALYSIS() + PLAGE() } diff --git a/modules/local/module_NGL-Bi.nf b/modules/local/module_NGL-Bi.nf index c45a7b9e77291f4a8631bd87462eba35094c265a..c32681ffaf350e4c8e0584cd462683b517e1f859 100644 --- a/modules/local/module_NGL-Bi.nf +++ b/modules/local/module_NGL-Bi.nf @@ -20,7 +20,7 @@ process prepareReadSetCreation { """ } -process TREATMENT_DEMUXSTAT { +process TREATMENT_DEMUXSTAT_ILLUMINA { label 'ngl' input: diff --git a/modules/local/module_core.nf b/modules/local/module_core.nf index a874ffc5b7045a20abda51c45a687bcd6c2da9f4..43e812821ece5b64290b9b5899eb1b3106015220 100644 --- a/modules/local/module_core.nf +++ b/modules/local/module_core.nf @@ -83,8 +83,14 @@ process FASTQSCREEN { script: def args = task.ext.args ?: '' + def defaultConf = "${baseDir}/assets/fastq_screen.conf_example" + def inputConf = "${params.inputdir}/fastq_screen.conf" + def confFile = file(inputConf).exists() ? inputConf : defaultConf """ - fastq_screen $reads $args + fastq_screen \\ + $reads \\ + --conf ${confFile} \\ + $args """ } diff --git a/modules/local/module_core_element.nf b/modules/local/module_core_element.nf new file mode 100644 index 0000000000000000000000000000000000000000..c1e26a2b285a22f3b34178166d2c280ab9884503 --- /dev/null +++ b/modules/local/module_core_element.nf @@ -0,0 +1,28 @@ +/* + * Module pour les analyses de base des données Element Biosciences +*/ + +process DEMUX_STATS { + label 'demux' + label 'little_R' + + input: + path runManifestJson + path assigned + path unassigned + + output: + path "demultiplexStat.csv", emit: csv + + script: + def threshold = task.ext.threshold ?: '' + def lane = params.lane ?: '1' + """ + demuxStatsElement.R \\ + --assigned $assigned \\ + --unassigned $unassigned \\ + --runManifest $runManifestJson \\ + --lane $lane \\ + $threshold + """ +} diff --git a/nextflow.config b/nextflow.config index b54f8097f9767dfcdfbed50f9d8e7cb16f487eb6..8bff24659cf454295661e0f5446f4ab29552e542 100644 --- a/nextflow.config +++ b/nextflow.config @@ -86,6 +86,7 @@ params { // skip parameters skip_core_illumina = false + skip_core_element = false help = false } @@ -95,9 +96,9 @@ params { //========================================= import java.nio.file.Files import java.nio.file.Paths -def n_read_files = Files.walk(Paths.get(params.inputdir.toString())) +def n_read_files = Files.walk(Paths.get(params.inputdir.toString()), 3) .filter(Files::isRegularFile) - .filter(p -> p.getFileName().toString().matches(".*_R[12](_.*)?\\.fastq\\.gz")) + .filter(p -> p.getFileName().toString().matches(".*_L00${params.lane}_R[12](_.*)?\\.fastq\\.gz")) .count() // on retire les 2 fichiers undetermined diff --git a/sub-workflows/local/core_element.nf b/sub-workflows/local/core_element.nf new file mode 100644 index 0000000000000000000000000000000000000000..6207685c5320ca507f07af74706e8d02a61c69d6 --- /dev/null +++ b/sub-workflows/local/core_element.nf @@ -0,0 +1,47 @@ +// ------------------------------------------------- +// CORE ELEMENT +// ------------------------------------------------- +/* + * Statistiques de démultiplexage +*/ + +// ------------------------------------------------- +// MODULES +// ------------------------------------------------- +include { + DEMUX_STATS +} from "$baseDir/modules/local/module_core_element.nf" + +include { + TREATMENT_DEMUXSTAT_ELEMENT as TREATMENT_DEMUX_RUN; + TREATMENT_DEMUXSTAT_ELEMENT as TREATMENT_DEMUX_READSETS; +} from "$baseDir/modules/local/module_NGL-Bi.nf" + +// ------------------------------------------------- +// LOCAL PARAMS +// ------------------------------------------------- + + +// ------------------------------------------------- +// WORKFLOW +// ------------------------------------------------- + +workflow CORE_ELEMENT { + take: + runManifestJson + assigned + unassigned + nglBiRunCode + readsetsFile + + main: + // ----------- DemultiplexStat + DEMUX_STATS(runManifestJson, assigned, unassigned) + + // ----------- NGL-Bi + TREATMENT_DEMUX_RUN(nglBiRunCode, DEMUX_STATS.out.csv) + TREATMENT_DEMUX_READSETS(readsetsFile, DEMUX_STATS.out.csv) + + emit: + demuxStat = DEMUX_STATS.out.csv +} \ No newline at end of file diff --git a/sub-workflows/local/core_illumina.nf b/sub-workflows/local/core_illumina.nf index a03cd6f04d8c83201f2653be7c6a013d2dad847d..61f8885492641057b3afa8866ea45d8f2645013c 100644 --- a/sub-workflows/local/core_illumina.nf +++ b/sub-workflows/local/core_illumina.nf @@ -15,6 +15,11 @@ include { ILLUMINA_FILTER; } from "$baseDir/modules/local/module_core.nf" +include { + TREATMENT_DEMUXSTAT_ILLUMINA as TREATMENT_DEMUX_RUN; + TREATMENT_DEMUXSTAT_ILLUMINA as TREATMENT_DEMUX_READSETS; +} from "$baseDir/modules/local/module_NGL-Bi.nf" + // ------------------------------------------------- // LOCAL PARAMS // ------------------------------------------------- @@ -30,6 +35,8 @@ workflow CORE_ILLUMINA { demuxStatXML demuxSummary fastq + nglBiRunCode + readsetsFile main: // ----------- DemultiplexStat @@ -45,6 +52,12 @@ workflow CORE_ILLUMINA { fastq_good = ILLUMINA_FILTER.out.reads } + if (params.insert_to_ngl){ + // Add demultiplexStat treatments + TREATMENT_DEMUX_RUN(nglBiRunCode, DEMUX_STATS.out.demultiplexStatsTSV) + TREATMENT_DEMUX_READSETS(readsetsFile, DEMUX_STATS.out.demultiplexStatsTSV) + } + emit: fastq = fastq_good demuxStat = DEMUX_STATS.out.demultiplexStatsTSV diff --git a/sub-workflows/local/core_pipeline.nf b/sub-workflows/local/core_pipeline.nf index a14b560f3b33431dc50d52bb50a8481ed8aa58f7..20d45dc38f3f04a1eb6f5833ecffc4bb2823b808 100644 --- a/sub-workflows/local/core_pipeline.nf +++ b/sub-workflows/local/core_pipeline.nf @@ -15,7 +15,6 @@ include { FASTQC; FASTQSCREEN; DUPLICATED_READS; - MERGE_LANES; } from "$baseDir/modules/local/module_core.nf" include { GUNZIP } from "${params.shared_modules}/gzip.nf" include { SEQTK_SAMPLE } from "${params.shared_modules}/seqtk.nf" @@ -28,26 +27,9 @@ isResume=workflow.resume //------------------------------------------------- workflow CORE { take: - ch_fastq + ch_read main: - // ----------- Lane merging fastq - if (params.merge_lanes) { - MERGE_LANES(ch_fastq - .collect{it[1]} - .flatten() - .map { $it -> [ ($it.simpleName =~ /(.*)_S\d+_.*/)[0][1] , $it ] } - .groupTuple() - ) - - ch_read = MERGE_LANES.out.fastq - .collect{it[1]} - .flatten() - .map{$it -> [$it.simpleName, $it]} - } else { - ch_read = ch_fastq - } - // ----------- FASTQC FASTQC(ch_read) diff --git a/workflow/illumina_qc.nf b/workflow/illumina_qc.nf index 9ba6b3613411c9827addb2c4c7abeaa045660b40..d2d87cae0b5bd3ee9b3fbced6b7b3c7b0c4cbcff 100644 --- a/workflow/illumina_qc.nf +++ b/workflow/illumina_qc.nf @@ -27,22 +27,36 @@ System.out.println "\n" // ------------------------------------------------- // CHANNELS // ------------------------------------------------- -ch_ss = Channel.fromPath(params.samplesheet) -ch_DemuxSummary=Channel.fromPath(params.inputdir+"/Stats/DemuxSummaryF1L*.txt") -ch_DemuxStatXML=Channel.fromPath(params.inputdir+'/Stats/DemultiplexingStats.xml') +// Illumina's channels +ss_path = file(params.samplesheet) +demuxSummary_path = file(params.inputdir+"/Stats/DemuxSummaryF1L${params.lane}.txt") +demuxStatXML_path = file(params.inputdir+'/Stats/DemultiplexingStats.xml') +ch_ss = ss_path.exists() ? Channel.fromPath(ss_path) : Channel.empty() +ch_DemuxSummary = demuxSummary_path.exists() ? Channel.fromPath(demuxSummary_path) : Channel.empty() +ch_DemuxStatXML = demuxStatXML_path.exists() ? Channel.fromPath(demuxStatXML_path) : Channel.empty() + +// Element's channels +runManifestJSON_path = file(params.inputdir+"/RunManifest.json") +indexAssigned_path = file(params.inputdir+"/IndexAssignment.csv") +indexUnassigned_path = file(params.inputdir+"/UnassignedSequences.csv") +ch_runManifestJSON = runManifestJSON_path.exists() ? Channel.fromPath(runManifestJSON_path) : Channel.empty() +ch_indexAssigned = indexAssigned_path.exists() ? Channel.fromPath(indexAssigned_path) : Channel.empty() +ch_indexUnassigned = indexUnassigned_path.exists() ? Channel.fromPath(indexUnassigned_path) : Channel.empty() + +def SamplesBaseDir = params.sequencer =~ 'AVITI' ? 'Samples' : '' // Get samples globPatterns def sampleList = [] def indexFilesList = [] if (params.select_samples) { params.select_samples.tokenize(',').each { sample -> - sampleList.add("${params.inputdir}/${params.project}/**" + sample +'_*_R{1,2}{_*,*}.fastq.gz') - indexFilesList.add("${params.inputdir}/${params.project}/**" + sample +'_*_I{1,2}{_*,*}.fastq.gz') + sampleList.add("${params.inputdir}/${SamplesBaseDir}/${params.project}/**" + sample +"_*_L00${params.lane}_R{1,2}{_*,*}.fastq.gz") + indexFilesList.add("${params.inputdir}/${SamplesBaseDir}/${params.project}/**" + sample +"_*_L00${params.lane}_I{1,2}{_*,*}.fastq.gz") } } else { System.out.println "Aucun échantillon selectionné, on les sélectionne tous" - sampleList.add("${params.inputdir}/${params.project}/**_R{1,2}{_*,*}.fastq.gz") - indexFilesList.add("${params.inputdir}/${params.project}/**_I{1,2}{_*,*}.fastq.gz") + sampleList.add("${params.inputdir}/${SamplesBaseDir}/${params.project}/**_L00${params.lane}_R{1,2}{_*,*}.fastq.gz") + indexFilesList.add("${params.inputdir}/${SamplesBaseDir}/${params.project}/**_L00${params.lane}_I{1,2}{_*,*}.fastq.gz") } // Get 10X index Files @@ -76,14 +90,13 @@ createDir = file(params.outdir).mkdir() // INCLUDES // ------------------------------------------------- include { CORE_ILLUMINA } from "$baseDir/sub-workflows/local/core_illumina.nf" +include { CORE_ELEMENT } from "$baseDir/sub-workflows/local/core_element.nf" include { CORE } from "$baseDir/sub-workflows/local/core_pipeline.nf" include { DNA_QC } from "$baseDir/sub-workflows/local/dna_qc.nf" include { RNA_QC } from "$baseDir/sub-workflows/local/rna_qc.nf" include { DIVERSITY_QC } from "$baseDir/sub-workflows/local/diversity_qc.nf" include { PARSE_REPORTS } from "$baseDir/modules/local/module_DTM.nf" -include { TREATMENT_DEMUXSTAT as TREATMENT_DEMUX_RUN; - TREATMENT_DEMUXSTAT as TREATMENT_DEMUX_READSETS; - FILE_RENAME as RENAME_FASTQ; +include { FILE_RENAME as RENAME_FASTQ; FILE_RENAME as RENAME_INDEX; } from "$baseDir/modules/local/module_NGL-Bi.nf" include { MULTIQC } from "${params.shared_modules}/multiqc.nf" @@ -93,7 +106,7 @@ include { UPDATE_NGLBI_STATE_FROM_FILE as UPDATE_STATE_FQC; CREATE_ANALYSIS; } from "${params.shared_modules}/ngl_bi.nf" include { READSET_FILE_FROM_FILE as ADD_RS_INDEX_FILES } from "${params.shared_modules}/ngl_bi.nf" addParams(ext: 'INDEX') include { READSET_FILE_FROM_FILE as ADD_RS_RAW_FILES } from "${params.shared_modules}/ngl_bi.nf" addParams(ext: 'RAW') -include { md5sum as MD5SUM; +include { md5sum as MD5SUM_FASTQ; md5sum as MD5SUM_INDEX; } from "${params.shared_modules}/md5sum.nf" include { BEGIN_NGLBI as NGLBI } from "${params.shared_modules}/workflows/begin_nglbi.nf" @@ -109,25 +122,29 @@ sendBeginMail(format.format(new Date())) // ------------------------------------------------- // WORKFLOW // ------------------------------------------------- -workflow ILLUMINA_QC { +workflow SHORT_READS_QC { ch_mqc = Channel.empty() WORKFLOW_SUMMARY() if (params.insert_to_ngl){ NGLBI(params.bi_run_code, params.sq_xp_code, '', params.sequencer) + nglBiRunCode = NGLBI.out.nglBiRunCode + readsets_created = NGLBI.out.readsets_created + ready = NGLBI.out.ready + } else { + nglBiRunCode = Channel.empty() + readsets_created = Channel.empty() + ready = Channel.empty() } - if ( params.skip_core_illumina ) { - fastq = ch_read - } else { - CORE_ILLUMINA(ch_ss, ch_DemuxStatXML, ch_DemuxSummary, ch_read) + if (! params.skip_core_illumina && params.sequencer =~ "NovaSeq|MiSeq" ) { + CORE_ILLUMINA(ch_ss, ch_DemuxStatXML, ch_DemuxSummary, ch_read, nglBiRunCode, readsets_created) fastq = CORE_ILLUMINA.out.fastq - - if (params.insert_to_ngl){ - // Add demultiplexStat treatments - TREATMENT_DEMUX_RUN(NGLBI.out.nglBiRunCode, CORE_ILLUMINA.out.demuxStat) - TREATMENT_DEMUX_READSETS(NGLBI.out.readsets_created, CORE_ILLUMINA.out.demuxStat) - } + } else { + fastq = ch_read + } + if (! params.skip_core_element && params.sequencer =~ "AVITI") { + CORE_ELEMENT(ch_runManifestJSON, ch_indexAssigned, ch_indexUnassigned, nglBiRunCode, readsets_created) } CORE(fastq) @@ -172,7 +189,7 @@ workflow ILLUMINA_QC { ) } else { - System.out.println "Le QC des données non ADN n'est pas prit en charge pour le moment." + System.out.println "Le QC des données ${params.data_nature} n'a pas de sub-workflow spécifique pour le moment." ch_mqc = ch_mqc.mix( Channel.empty() ) } @@ -187,15 +204,15 @@ workflow ILLUMINA_QC { if (params.insert_to_ngl){ if (params.single_cell) { - RENAME_INDEX(ch_index.map{it[1]}.collect(), NGLBI.out.readsets_created, params.sq_xp_code, 'fastq_index') + RENAME_INDEX(ch_index.map{it[1]}.collect(), readsets_created, params.sq_xp_code, 'fastq_index') MD5SUM_INDEX(RENAME_INDEX.out.fastq.collect(), params.run_name+'_fastq_index') - ADD_RS_INDEX_FILES(NGLBI.out.readsets_created, MD5SUM_INDEX.out, 'INDEX', NGLBI.out.ready) + ADD_RS_INDEX_FILES(readsets_created, MD5SUM_INDEX.out, 'INDEX', ready) } - RENAME_FASTQ(fastq.map{it[1]}.collect(), NGLBI.out.readsets_created, params.sq_xp_code, 'fastq_read') - MD5SUM(RENAME_FASTQ.out.fastq.collect(), params.run_name+'_fastq_read') - ADD_RS_RAW_FILES(NGLBI.out.readsets_created, MD5SUM.out, 'RAW', NGLBI.out.ready) - UPDATE_STATE_FQC(NGLBI.out.readsets_created, 'F-QC', MULTIQC.out.html) - CREATE_ANALYSIS(NGLBI.out.nglBiRunCode, NGLBI.out.readsets_created, 1) + RENAME_FASTQ(fastq.map{it[1]}.collect(), readsets_created, params.sq_xp_code, 'fastq_read') + MD5SUM_FASTQ(RENAME_FASTQ.out.fastq.collect(), params.run_name+'_fastq_read') + ADD_RS_RAW_FILES(readsets_created, MD5SUM_FASTQ.out, 'RAW', ready) + UPDATE_STATE_FQC(readsets_created, 'F-QC', MULTIQC.out.html) + CREATE_ANALYSIS(nglBiRunCode, readsets_created, 1) ADD_MULTIQC(CREATE_ANALYSIS.out.createdFile, MULTIQC.out.html, CREATE_ANALYSIS.out.ready) }