From fa8bdec6627dd12b64e167f821b5ed25485260c6 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Sun, 26 Jun 2022 10:04:03 +0200 Subject: [PATCH 1/9] adding checkIfExists rules to input loading --- main.nf | 4 ++-- workflows/parse_samples.nf | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main.nf b/main.nf index fe88a9e3..f86a7eb3 100644 --- a/main.nf +++ b/main.nf @@ -52,11 +52,11 @@ workflow { Cheers. """) } else { - bacannot_db = file(params.bacannot_db) + bacannot_db = file(params.bacannot_db, checkIfExists: true) } // Load yaml - samplesheet_yaml = file(params.input) + samplesheet_yaml = file(params.input, checkIfExists: true) parameter_yaml = samplesheet_yaml.readLines().join("\n") new Yaml().load(parameter_yaml).each { k, v -> params[k] = v } diff --git a/workflows/parse_samples.nf b/workflows/parse_samples.nf index ed861ee8..6ee0c736 100644 --- a/workflows/parse_samples.nf +++ b/workflows/parse_samples.nf @@ -13,13 +13,13 @@ workflow PARSE_SAMPLESHEET { tuple( row.name, row.entrypoint, - (row.fwd == "missing_pairFWD") ? row.fwd : file(row.fwd), - (row.rev == "missing_pairREV") ? row.rev : file(row.rev), - (row.single == "missing_single") ? row.single : file(row.single), - (row.lreads == "missing_lreads") ? row.lreads : file(row.lreads), + (row.fwd == "missing_pairFWD") ? row.fwd : file(row.fwd, checkIfExists: true), + (row.rev == "missing_pairREV") ? row.rev : file(row.rev, checkIfExists: true), + (row.single == "missing_single") ? row.single : file(row.single, checkIfExists: true), + (row.lreads == "missing_lreads") ? row.lreads : file(row.lreads, checkIfExists: true), row.lr_type, - (row.fast5 == "missing_fast5") ? row.fast5 : file(row.fast5), - (row.assembly == "missing_assembly") ? row.assembly : file(row.assembly), + (row.fast5 == "missing_fast5") ? row.fast5 : file(row.fast5, checkIfExists: true), + (row.assembly == "missing_assembly") ? row.assembly : file(row.assembly, checkIfExists: true), row.resfinder ) } From f91d7bff15a0f7a6ec8177a24067bfadcda6d891 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Sun, 26 Jun 2022 10:04:20 +0200 Subject: [PATCH 2/9] Update build.sh --- docker/renv/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/renv/build.sh b/docker/renv/build.sh index 51153a5c..a7bc2124 100644 --- a/docker/renv/build.sh +++ b/docker/renv/build.sh @@ -1 +1,2 @@ -../../bin/build_image.sh $1 +source ../set_version.sh +../../bin/build_image.sh $NEW_VERSION From 33b6d441cd7e90135b65a2af1238a9465739a1e9 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Sun, 26 Jun 2022 10:04:38 +0200 Subject: [PATCH 3/9] fixed report if else statement --- docker/renv/reports/report_custom_blast.Rmd | 16 ++++++++-------- modules/generic/custom_database_report.nf | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docker/renv/reports/report_custom_blast.Rmd b/docker/renv/reports/report_custom_blast.Rmd index 0a309f2a..9f19eb08 100644 --- a/docker/renv/reports/report_custom_blast.Rmd +++ b/docker/renv/reports/report_custom_blast.Rmd @@ -59,12 +59,10 @@ check_lines <- function(x) { ## Read input documents custom_blast <- try(read.delim(params$custom_blast, header = TRUE), silent = TRUE) -blast_gff <- try(read.delim(params$blast_gff, header = FALSE), silent = TRUE) -colnames(blast_gff) <- - c("Contig", "Source", "Feature", "Start", "End", "Score", "Strand", "Phase", "Attributes") +blast_gff <- try(read.delim(params$blast_gff, header = FALSE, col.names=c("Contig", "Source", "Feature", "Start", "End", "Score", "Strand", "Phase", "Attributes")), silent = TRUE) ## Check for emptyness -if (class(custom_blast) == "try-error" || +if (class(blast_gff) == "try-error" || check_lines(custom_blast) == 1) { custom_blast <- data.frame( matrix(ncol = 14, nrow = 0) @@ -72,6 +70,8 @@ if (class(custom_blast) == "try-error" || blast_gff <- data.frame( matrix(ncol = 9, nrow = 0) ) + colnames(blast_gff) <- + c("Contig", "Source", "Feature", "Start", "End", "Score", "Strand", "Phase", "Attributes") } else { # read blast summary @@ -91,6 +91,9 @@ if (class(custom_blast) == "try-error" || blast_gff$`Query Protein ID` <- getAttributeField(blast_gff$Attributes, "ID", ";") blast_gff$`Prokka Annotation (Gene)` <- getAttributeField(blast_gff$Attributes, "gene", ";") blast_gff$`Prokka Annotation (Product)` <- getAttributeField(blast_gff$Attributes, "product", ";") + + blast_gff <- blast_gff %>% + select(`Query Protein ID`, `Prokka Annotation (Gene)`, `Prokka Annotation (Product)`, `Custom DB Acc`, `Custom DB Target`, `Custom DB Product`, Attributes) } ``` @@ -144,10 +147,7 @@ Using the software bedtools intersect, the BLAST results have been used to searc
(#tab:blast-gff-table) Annotation intersection of the `r params$blast_db` custom database BLAST results with the main pipeline results ```{r} -blast <- blast_gff -# Render dt -datatable(blast %>% - select(`Query Protein ID`, `Prokka Annotation (Gene)`, `Prokka Annotation (Product)`, `Custom DB Acc`, `Custom DB Target`, `Custom DB Product`, Attributes), +datatable(blast_gff, escape = FALSE, filter = 'top', options = list(pageLength = 5, diff --git a/modules/generic/custom_database_report.nf b/modules/generic/custom_database_report.nf index eb1d2d0c..2946466a 100644 --- a/modules/generic/custom_database_report.nf +++ b/modules/generic/custom_database_report.nf @@ -23,7 +23,7 @@ process CUSTOM_DATABASE_REPORT { system("rm -f input.??") ; system("rm -f input.?") ; - ## Generate Resistance Report + ## Generate Report rmarkdown::render("report_custom_blast.Rmd", params = list(\ blast_id = ${params.blast_custom_minid} , \ blast_cov = ${params.blast_custom_mincov}, \ From ff7adc8ac9d9f01cf74fe481539363b9df4df202 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Sun, 26 Jun 2022 10:07:27 +0200 Subject: [PATCH 4/9] updated version and changelog --- .zenodo.json | 2 +- markdown/CHANGELOG.md | 8 ++++++++ nextflow.config | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 4ee22bf7..28e072e8 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -2,7 +2,7 @@ "description": "

The pipeline

\n\n

bacannot, is a customisable, easy to use, pipeline that uses state-of-the-art software for comprehensively annotating prokaryotic genomes having only Docker and Nextflow as dependencies. It is able to annotate and detect virulence and resistance genes, plasmids, secondary metabolites, genomic islands, prophages, ICEs, KO, and more, while providing nice an beautiful interactive documents for results exploration.

", "license": "other-open", "title": "fmalmeida/bacannot: A generic but comprehensive bacterial annotation pipeline", - "version": "v3.1.1", + "version": "v3.1.2", "upload_type": "software", "creators": [ { diff --git a/markdown/CHANGELOG.md b/markdown/CHANGELOG.md index a4e8cb89..50d17304 100644 --- a/markdown/CHANGELOG.md +++ b/markdown/CHANGELOG.md @@ -2,6 +2,14 @@ The tracking for changes started in v2.1 +## v3.1.2 + +This version contains: + +* A fix on the custom blast report file which had an wrong ifelse statement definition +* Updated version of renv docker with fixed report Rmd +* Addition of `checkIfExists` statements when loading file to make sure that user is pointing to files that exists and did not misspelled them + ## v3.1.1 This version contains a quick fix spotted by @fetyj described in issue [#52](https://github.com/fmalmeida/bacannot/issues/52). Now the path to the argminer backup database is given as full path. diff --git a/nextflow.config b/nextflow.config index 80da7098..b86ba429 100644 --- a/nextflow.config +++ b/nextflow.config @@ -104,7 +104,7 @@ manifest { homePage = "https://github.com/fmalmeida/bacannot" mainScript = "main.nf" nextflowVersion = ">=20.10.0" - version = '3.1.1' + version = '3.1.2' } // Function to ensure that resource requirements don't go beyond From 9a0149b5eba6eeaf225c0a8c3cc5e5d6cff54953 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Tue, 28 Jun 2022 17:30:30 +0200 Subject: [PATCH 5/9] fix example samplesheet url --- lib/WorkflowMain.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/WorkflowMain.groovy b/lib/WorkflowMain.groovy index b966f0ee..7531147f 100755 --- a/lib/WorkflowMain.groovy +++ b/lib/WorkflowMain.groovy @@ -66,7 +66,7 @@ class WorkflowMain { // Download template samplesheet if (params.get_samplesheet) { - new File("bacannot_samplesheet.yaml").write(new URL ("https://github.com/fmalmeida/bacannot/raw/master/example_samplesheet.yml").getText()) + new File("bacannot_samplesheet.yaml").write(new URL ("https://github.com/fmalmeida/bacannot/raw/master/example_samplesheet.yaml").getText()) log.info """ Samplesheet (bacannot_samplesheet.yml) file saved in working directory Nice code! From a88c9129f36f6c75b95994cc5910354105193dc7 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Tue, 28 Jun 2022 19:31:08 +0200 Subject: [PATCH 6/9] Create nf-core-bacannot-compare_logo_dark.png --- docs/images/nf-core-bacannot-compare_logo_dark.png | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/images/nf-core-bacannot-compare_logo_dark.png diff --git a/docs/images/nf-core-bacannot-compare_logo_dark.png b/docs/images/nf-core-bacannot-compare_logo_dark.png new file mode 100644 index 00000000..e69de29b From 2a2371c9cd1c9e4de5082a9bb6aef0143ebe95dd Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Wed, 29 Jun 2022 21:53:00 +0200 Subject: [PATCH 7/9] Update phigaro.nf --- modules/prophages/phigaro.nf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/prophages/phigaro.nf b/modules/prophages/phigaro.nf index 318bc9d9..71a58d94 100644 --- a/modules/prophages/phigaro.nf +++ b/modules/prophages/phigaro.nf @@ -1,7 +1,6 @@ process PHIGARO { publishDir "${params.output}/${prefix}", mode: 'copy', saveAs: { filename -> - if (filename == "out.phg") null - else if (filename.indexOf("_version.txt") > 0) "tools_versioning/$filename" + if (filename.indexOf("_version.txt") > 0) "tools_versioning/$filename" else "prophages/phigaro/$filename" } tag "${prefix}" @@ -46,11 +45,12 @@ process PHIGARO { --not-open ; # change names - [ ! -s out.phg/assembly.phigaro.tsv ] || mv out.phg/assembly.phigaro.tsv ${prefix}_phigaro.tsv ; - [ ! -s out.phg/assembly.phigaro.html ] || mv out.phg/assembly.phigaro.html ${prefix}_phigaro.html ; + [ ! -s out.phg/assembly.phigaro.tsv ] || cp out.phg/assembly.phigaro.tsv ${prefix}_phigaro.tsv ; + [ ! -s out.phg/assembly.phigaro.html ] || cp out.phg/assembly.phigaro.html ${prefix}_phigaro.html ; # create BED - grep -v "taxonomy" ${prefix}_phigaro.tsv | \ - awk 'BEGIN { FS = "\t"; OFS="\\t" } { print \$1,\$2,\$3 }' > ${prefix}_phigaro.bed + touch ${prefix}_phigaro.bed ; + [ ! -s out.phg/assembly.phigaro.html ] || grep -v "taxonomy" ${prefix}_phigaro.tsv | \\ + awk 'BEGIN { FS = "\\t"; OFS="\\t" } { print \$1,\$2,\$3 }' > ${prefix}_phigaro.bed """ } From 9182172b0203edaa2ca5e4c9206e805954aca30a Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Wed, 29 Jun 2022 21:55:13 +0200 Subject: [PATCH 8/9] Update CHANGELOG.md --- markdown/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/markdown/CHANGELOG.md b/markdown/CHANGELOG.md index 50d17304..ef00895e 100644 --- a/markdown/CHANGELOG.md +++ b/markdown/CHANGELOG.md @@ -9,6 +9,9 @@ This version contains: * A fix on the custom blast report file which had an wrong ifelse statement definition * Updated version of renv docker with fixed report Rmd * Addition of `checkIfExists` statements when loading file to make sure that user is pointing to files that exists and did not misspelled them +* A small fix on phigaro.nf module which was causing the pipeline to fail when its outputs were empty + +Thanks to @fetyj for spotting these issues. ## v3.1.1 From 4f3870f6bf76bb67305f5acc29765860c6008c04 Mon Sep 17 00:00:00 2001 From: fmalmeida Date: Wed, 29 Jun 2022 21:59:12 +0200 Subject: [PATCH 9/9] Update CHANGELOG.md --- markdown/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/markdown/CHANGELOG.md b/markdown/CHANGELOG.md index ef00895e..ffb67216 100644 --- a/markdown/CHANGELOG.md +++ b/markdown/CHANGELOG.md @@ -9,6 +9,7 @@ This version contains: * A fix on the custom blast report file which had an wrong ifelse statement definition * Updated version of renv docker with fixed report Rmd * Addition of `checkIfExists` statements when loading file to make sure that user is pointing to files that exists and did not misspelled them +* Fixed a small misspelling on example samplesheet url * A small fix on phigaro.nf module which was causing the pipeline to fail when its outputs were empty Thanks to @fetyj for spotting these issues.