From ea20a1cf51f7754e2b1555389641407d932e218e Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 31 Jul 2023 17:06:42 +0200 Subject: [PATCH] add input section --- assets/report_template.Rmd | 42 +++++++++++++++++++++++++++++++++ modules/local/summary_report.nf | 8 ++++++- workflows/ampliseq.nf | 3 +++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/assets/report_template.Rmd b/assets/report_template.Rmd index 1c05a17e..da681919 100644 --- a/assets/report_template.Rmd +++ b/assets/report_template.Rmd @@ -12,6 +12,8 @@ output: date: "`r Sys.Date()`" #bibliography: ./references.bibtex params: + # any parameter that is by default "FALSE" is used to evaluate the inclusion of a codeblock with e.g. "eval=!isFALSE(params$mqc_plot)" + # report style css: NULL logo: NULL @@ -51,6 +53,10 @@ params: qiime_adonis_formula: FALSE # file paths + metadata: FALSE + samplesheet: FALSE + fasta: FALSE + input: FALSE mqc_plot: FALSE ca_sum_path: FALSE dada_filtntrim_args: FALSE @@ -142,6 +148,42 @@ subtitle: `r report_subtitle` The bioinformatics analysis pipeline [nfcore/ampliseq](https://nf-co.re/ampliseq) is used for amplicon sequencing, supporting denoising of any amplicon and supports a variety of taxonomic databases for taxonomic assignment of 16S, ITS, CO1 and 18S amplicons. + + +# Input + +Pipeline input was saved in folder [input](../input). + +```{r, results='asis'} +if ( !isFALSE(params$samplesheet) ) { + # samplesheet input + cat("Sequencing data was provided in the samplesheet file `", params$samplesheet, "` that is displayed below:", sep="") + + samplesheet <- read.table(file = params$samplesheet, header = TRUE, sep = "\t") + # Display table + datatable(samplesheet, options = list( + scrollX = TRUE, + scrollY = "300px", + paging = FALSE)) +} else if ( !isFALSE(params$fasta) ) { + # fasta input + cat("ASV/OTU sequences were provided in the fasta file `", params$fasta, "`. ", sep="") +} else if ( !isFALSE(params$input) ) { + # folder input + cat("Sequencing data was retrieved from folder `", params$fasta, "`. ", sep="") +} +if ( !isFALSE(params$metadata) ) { + cat("Metadata associated with the sequencing data was provided in `", params$metadata, "` and is displayed below:", sep="") + + metadata <- read.table(file = params$metadata, header = TRUE, sep = "\t") + # Display table + datatable(metadata, options = list( + scrollX = TRUE, + scrollY = "300px", + paging = FALSE)) +} +``` + ```{r, eval = !isFALSE(params$mqc_plot) || !isFALSE(params$dada_filtntrim_args), results='asis'} diff --git a/modules/local/summary_report.nf b/modules/local/summary_report.nf index 5ffe6d05..a9d2f8c6 100644 --- a/modules/local/summary_report.nf +++ b/modules/local/summary_report.nf @@ -1,5 +1,4 @@ process SUMMARY_REPORT { - label 'process_low' container 'docker.io/tillenglert/ampliseq_report:latest' @@ -20,6 +19,9 @@ process SUMMARY_REPORT { path(report_template) path(report_styles) path(report_logo) + path(metadata) + path(samplesheet) + path(fasta) path(mqc_plots) path(ca_summary) val(find_truncation_values) @@ -76,6 +78,10 @@ process SUMMARY_REPORT { "workflow_manifest_version='${workflow.manifest.version}'", "workflow_scriptid='${workflow.scriptId.substring(0,10)}'", meta.single_end ? "flag_single_end=TRUE" : "", + metadata ? "metadata='$metadata'" : "", + samplesheet ? "samplesheet='$samplesheet'" : "", + fasta ? "fasta='$fasta'" : "", + !fasta && !samplesheet ? "input='$params.input'" : "", mqc_plots ? "mqc_plot='${mqc_plots}/svg/mqc_fastqc_per_sequence_quality_scores_plot_1.svg'" : "", ca_summary ? params.retain_untrimmed ? "flag_retain_untrimmed=TRUE,ca_sum_path='$ca_summary'" : diff --git a/workflows/ampliseq.nf b/workflows/ampliseq.nf index 3da0aa28..1a4d2970 100644 --- a/workflows/ampliseq.nf +++ b/workflows/ampliseq.nf @@ -686,6 +686,9 @@ workflow AMPLISEQ { ch_report_template, ch_report_css, ch_report_logo, + ch_metadata.ifEmpty( [] ), + params.input.toString().toLowerCase().endsWith("tsv") ? ch_input : [], // samplesheet input + is_fasta_input ? PARSE_INPUT.out.fasta.ifEmpty( [] ) : [], // fasta input !is_fasta_input && !params.skip_fastqc && !params.skip_multiqc ? MULTIQC.out.plots : [], //.collect().flatten().collectFile(name: "mqc_fastqc_per_sequence_quality_scores_plot_1.svg") !params.skip_cutadapt ? CUTADAPT_WORKFLOW.out.summary.collect().ifEmpty( [] ) : [], find_truncation_values,