annotate report.Rmd @ 1:3a7f73d638ba draft default tip

planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
author ufz
date Tue, 22 Jul 2025 11:09:24 +0000
parents 315c2ed31af1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1 ---
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
2 title: "PHI Prophage-Host Interaction Toolkit report"
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
3 subtitle: "Toolkit for the Detection, Comparison, and Annotation of Prophages in Bacterial Genomes."
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
4 date: "`r format(Sys.Date(), '%B %d, %Y')`"
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
5 output:
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
6 html_document:
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
7 theme: flatly
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
8 toc: yes
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
9 toc_float: false
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
10 number_sections: yes
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
11 code_folding: none
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
12 fig_width: 12
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
13 fig_height: 8
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
14 fig_caption: true
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
15 df_print: paged
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
16 editor_options:
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
17 markdown:
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
18 wrap: 72
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
19 params:
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
20 outdir: "data"
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
21 ---
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
22
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
23
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
24 ------------------------------------------------------------------------
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
25
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
26 ```{r setup_env, include=FALSE}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
27 knitr::opts_chunk$set(echo = FALSE)
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
28 knitr::opts_chunk$set(dev = "svglite") # set output device to svg
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
29
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
30 cat("params$outdir:", params$outdir, "\n")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
31 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
32
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
33 ```{r setup_libraries, message=FALSE, warning=FALSE, echo=FALSE, results='asis'}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
34 # Define required packages
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
35 # Note: update version_command if changed here!
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
36 required_packages <- c(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
37 "tidyverse", "janitor", "here",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
38 "kableExtra", "gmoviz", "circlize",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
39 "GenomicRanges", "patchwork", "fs",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
40 "tools", "scales", "formattable",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
41 "pdftools", "base64"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
42 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
43
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
44 # Load required packages
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
45 invisible(lapply(required_packages, library, character.only = TRUE))
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
46 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
47
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
48 ```{r helper_functions, echo=FALSE}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
49 log_file <- "debug.log"
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
50
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
51 log_debug <- function(message) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
52 if (!exists("log_initialized") || !log_initialized) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
53 cat(paste0(Sys.time(), " - DEBUG: ", message, "\n"), file = log_file, append = FALSE)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
54 assign("log_initialized", TRUE, envir = .GlobalEnv)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
55 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
56 cat(paste0(Sys.time(), " - DEBUG: ", message, "\n"), file = log_file, append = TRUE)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
57 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
58 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
59
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
60 load_file <- function(path) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
61 log_debug(paste("Attempting to load:", path))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
62 if (file.exists(path)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
63 ext <- tools::file_ext(path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
64 if (ext %in% c("tsv", "csv")) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
65 data <- read_delim(path, delim = ifelse(ext == "csv", ",", "\t"), show_col_types = FALSE) %>% janitor::clean_names()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
66 log_debug(paste("Loaded", nrow(data), "rows from", path))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
67 data
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
68 } else if (ext == "fna") {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
69 data <- Biostrings::readDNAStringSet(path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
70 log_debug(paste("Loaded", length(data), "sequences from", path))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
71 data
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
72 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
73 log_debug(paste("Skipping", path, "- unsupported file type"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
74 NULL
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
75 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
76 } else {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
77 log_debug(paste("File does not exist:", path))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
78 NULL
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
79 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
80 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
81
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
82 get_file_info <- function(path, loaded_data) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
83 log_debug(paste("Processing file info for:", path))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
84 if (file.exists(path)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
85 ext <- tools::file_ext(path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
86 if (ext %in% c("tsv", "csv", "fna")) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
87 data <- loaded_data[[basename(path)]]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
88 rows <- if (ext == "fna") length(data) else nrow(data)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
89 tibble::tibble(exists = TRUE, rows = rows, size = file.size(path), path = path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
90 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
91 tibble::tibble(exists = TRUE, rows = NA_integer_, size = file.size(path), path = path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
92 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
93 } else {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
94 tibble::tibble(exists = FALSE, rows = NA_integer_, size = NA_real_, path = NA_character_)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
95 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
96 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
97
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
98 process_genome_folder <- function(folder, host_analyses_dir, virus_analyses_dir) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
99 log_debug(paste("Processing folder:", folder))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
100 genome_name <- basename(folder)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
101
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
102 paths <- list(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
103 genomad = file.path(host_analyses_dir, "genomad", genome_name, paste0(genome_name, "_summary"), paste0(genome_name, "_virus_summary.tsv")),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
104 genomad_phages = file.path(host_analyses_dir, "genomad", genome_name, paste0(genome_name, "_summary"), paste0(genome_name, "_virus.fna")),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
105 genomad_annotations = file.path(host_analyses_dir, "genomad", genome_name, paste0(genome_name, "_summary"), paste0(genome_name, "_virus_genes.tsv")),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
106 defense_finder = file.path(host_analyses_dir, "defense-finder", genome_name, paste0(genome_name, "_defense_finder_systems.tsv")),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
107 checkv = file.path(virus_analyses_dir, "checkv", genome_name, "quality_summary.tsv"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
108 iphop = file.path(virus_analyses_dir, "iphop", genome_name, "Host_prediction_to_genome_m90.csv"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
109 drep = file.path(virus_analyses_dir, "drep_compare", genome_name, "data_tables", "Cdb.csv"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
110 phatyp = file.path(virus_analyses_dir, "phatyp", genome_name, "phatyp.csv"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
111 abricate = file.path(virus_analyses_dir, "abricate", genome_name, paste0(genome_name, "_virus_vfdb.tsv")),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
112 vibrant = file.path(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
113 virus_analyses_dir, "vibrant", genome_name,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
114 paste0("VIBRANT_", genome_name, "_virus"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
115 paste0("VIBRANT_results_", genome_name, "_virus"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
116 paste0("VIBRANT_AMG_individuals_", genome_name, "_virus.tsv")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
117 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
118 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
119
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
120 loaded_data <- map(paths, load_file)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
121 file_info <- purrr::map_dfr(paths, ~ get_file_info(.x, loaded_data), .id = "file_type")
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
122
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
123 virus_count <- if (!is.null(loaded_data$genomad)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
124 count <- sum(loaded_data$genomad$virus_score > 0.5, na.rm = TRUE)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
125 log_debug(paste("Virus count:", count))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
126 count
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
127 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
128 log_debug("No genomad summary found, virus count set to 0")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
129 0
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
130 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
131
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
132 log_debug("Returning results from process_genome_folder")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
133 list(file_info = file_info, virus_count = virus_count, loaded_data = loaded_data)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
134 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
135 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
136
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
137
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
138 ```{r compile_results, message=FALSE, warning=FALSE, echo=FALSE}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
139 compile_results <- function() {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
140 base_dir <- params$outdir
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
141 log_debug(paste("Base directory:", base_dir))
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
142
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
143 host_analyses_dir <- file.path(base_dir, "host_analyses")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
144 virus_analyses_dir <- file.path(base_dir, "virus_analyses")
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
145
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
146 # List all sample-level directories from all tools under virus_analyses
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
147 tool_dirs <- list.dirs(virus_analyses_dir, full.names = TRUE, recursive = FALSE)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
148
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
149 genome_folders <- list.dirs(file.path(base_dir, "host_analyses", "genomad"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
150 full.names = TRUE, recursive = FALSE
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
151 )
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
152
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
153 # cat(length(genome_folders), "sample(s) processed\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
154
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
155 log_debug("Processing genome folders")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
156 genome_data <- map(genome_folders, process_genome_folder,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
157 host_analyses_dir = host_analyses_dir,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
158 virus_analyses_dir = virus_analyses_dir
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
159 ) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
160 purrr::set_names(basename(genome_folders)) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
161 compact()
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
162
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
163 log_debug("Creating summary dataframe")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
164 summary_df <- purrr::map_dfr(genome_data, ~ {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
165 file_info <- .x$file_info
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
166 tibble::tibble(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
167 Sample = basename(file_info$path[1]),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
168 Virus_Count = .x$virus_count,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
169 geNomad = file_info$exists[file_info$file_type == "genomad"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
170 CheckV = file_info$exists[file_info$file_type == "checkv"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
171 VIBRANT = file_info$exists[file_info$file_type == "vibrant"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
172 dRep = file_info$exists[file_info$file_type == "drep"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
173 iPHOP = file_info$exists[file_info$file_type == "iphop"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
174 PhaTYP = file_info$exists[file_info$file_type == "phatyp"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
175 Defense_Finder = file_info$exists[file_info$file_type == "defense_finder"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
176 geNomad_Path = file_info$path[file_info$file_type == "genomad"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
177 CheckV_Path = file_info$path[file_info$file_type == "checkv"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
178 VIBRANT_Path = file_info$path[file_info$file_type == "vibrant"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
179 dRep_Path = file_info$path[file_info$file_type == "drep"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
180 PhaTYP_Path = file_info$path[file_info$file_type == "phatyp"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
181 Defense_Finder_Path = file_info$path[file_info$file_type == "defense_finder"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
182 Virus_Contigs = ifelse(file_info$exists[file_info$file_type == "genomad_phages"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
183 file_info$rows[file_info$file_type == "genomad_phages"],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
184 0
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
185 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
186 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
187 }) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
188 dplyr::mutate(dplyr::across(ends_with("_Path"), ~ ifelse(is.na(.), "Not available", as.character(.))))
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
189
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
190 host_genomes_fasta <- list.files(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
191 path = file.path(params$outdir, "genomes"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
192 pattern = "\\.fna$",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
193 full.names = TRUE
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
194 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
195
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
196 host_genomes_paths <- tibble::tibble(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
197 name = tools::file_path_sans_ext(basename(host_genomes_fasta)),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
198 path = host_genomes_fasta
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
199 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
200
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
201 data_gtdbtk_host <- read_tsv(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
202 file.path(params$outdir, "host_analyses/gtdbtk/gtdbtk.bac120.summary.tsv"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
203 show_col_types = FALSE
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
204 ) %>% janitor::clean_names()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
205
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
206 data_checkm_host <- read_tsv(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
207 file.path(params$outdir, "host_analyses/checkm2/quality_report.tsv"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
208 show_col_types = FALSE
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
209 ) %>% janitor::clean_names()
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
210
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
211 log_debug("Returning summary dataframe, genome data, and host data")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
212
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
213 log_debug(paste("summary_df dimensions:", nrow(summary_df), "rows,", ncol(summary_df), "columns"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
214 log_debug(paste("summary_df column names:", paste(colnames(summary_df), collapse = ", ")))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
215 log_debug(paste("genome_data length:", length(genome_data)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
216 log_debug(paste("genome_data names:", paste(names(genome_data), collapse = ", ")))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
217 log_debug(paste("host_genomes_paths dimensions:", nrow(host_genomes_paths), "rows,", ncol(host_genomes_paths), "columns"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
218 log_debug(paste("host_genomes_paths column names:", paste(colnames(host_genomes_paths), collapse = ", ")))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
219 log_debug(paste("data_gtdbtk_host dimensions:", nrow(data_gtdbtk_host), "rows,", ncol(data_gtdbtk_host), "columns"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
220 log_debug(paste("data_gtdbtk_host column names:", paste(colnames(data_gtdbtk_host), collapse = ", ")))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
221 log_debug(paste("data_checkm_host dimensions:", nrow(data_checkm_host), "rows,", ncol(data_checkm_host), "columns"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
222 log_debug(paste("data_checkm_host column names:", paste(colnames(data_checkm_host), collapse = ", ")))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
223
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
224 list(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
225 summary = summary_df,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
226 genome_data = genome_data,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
227 host_genomes_paths = host_genomes_paths,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
228 data_gtdbtk_host = data_gtdbtk_host,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
229 data_checkm_host = data_checkm_host
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
230 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
231 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
232 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
233
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
234 ```{r run_main_function, echo=FALSE, message=FALSE, warning=FALSE}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
235 log_debug("Starting execution of main function")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
236 result <- compile_results()
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
237
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
238 if (is.null(result)) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
239 log_debug("Main function execution failed")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
240 stop("Main function execution failed")
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
241 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
242
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
243 summary_df <- result$summary
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
244 genome_data <- result$genome_data
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
245 host_genomes_paths <- result$host_genomes_paths
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
246 data_gtdbtk_host <- result$data_gtdbtk_host
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
247 data_checkm_host <- result$data_checkm_host
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
248 log_debug("Data extracted successfully")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
249
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
250 result$summary <- result$summary %>%
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
251 dplyr::mutate(Sample = stringr::str_remove(Sample, "_virus_summary.tsv"))
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
252 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
253
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
254 # Summary {.tabset .tabset-fade}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
255
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
256 This table provides sample-by-sample information on detected viruses and key host genome statistics. It includes taxonomy, virus count, genome quality classification, CheckM2 metrics (completeness and contamination), and genome assembly statistics such as size and N50.
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
257
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
258 ```{r render_table, message=FALSE, warning=FALSE, echo=FALSE, results='asis'}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
259 data <- result$summary
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
260
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
261 log_debug("Assigning checkm2 host data")
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
262 checkm_host_data <- data_checkm_host %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
263 janitor::clean_names() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
264 dplyr::select(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
265 name, completeness, contamination,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
266 contig_n50, genome_size
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
267 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
268
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
269 log_debug("Assigning GTDB-Tk host data")
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
270 gtdbtk_data <- data_gtdbtk_host %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
271 dplyr::select(user_genome, classification)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
272
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
273 log_debug("Defining color-blind friendly palette")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
274 cb_friendly_colors <- list(
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
275 green = "#009E73",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
276 blue = "#0072B2",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
277 orange = "#E69F00",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
278 red = "#D55E00",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
279 grey = "#999999"
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
280 )
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
281
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
282 log_debug("Defining function to color cells")
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
283 color_cell <- function(values, color_true = cb_friendly_colors$green,
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
284 color_false = cb_friendly_colors$red) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
285 ifelse(values,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
286 kableExtra::cell_spec("Yes", color = "white", bold = TRUE, background = color_true),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
287 kableExtra::cell_spec("No", color = "white", bold = TRUE, background = color_false)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
288 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
289 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
290
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
291 log_debug("Defining function to create bar plot")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
292 create_bar_plot <- function(values, max_value, color = cb_friendly_colors$grey) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
293 sapply(values, function(value) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
294 if (is.na(value) || !is.numeric(value)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
295 return("N/A")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
296 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
297 bar_width <- min(max(value, 0), max_value) / max_value * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
298 sprintf(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
299 '<div style="background-color: %s; width: %f%%; height: 10px;"></div>%.1f%%',
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
300 color, bar_width, value
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
301 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
302 })
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
303 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
304
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
305 log_debug("Defining function to format large numbers")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
306 format_large_number <- function(x) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
307 sapply(x, function(value) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
308 if (is.na(value) || !is.numeric(value)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
309 return("N/A")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
310 } else if (value < 1000) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
311 return(as.character(value))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
312 } else if (value < 1e6) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
313 return(paste0(round(value / 1e3, 1), "K"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
314 } else if (value < 1e9) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
315 return(paste0(round(value / 1e6, 1), "M"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
316 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
317 return(paste0(round(value / 1e9, 1), "G"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
318 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
319 })
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
320 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
321
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
322 log_debug("Defining function to extract last known taxonomy level")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
323 extract_last_known_taxonomy <- function(classification) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
324 if (is.na(classification) || classification == "") {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
325 return(list(level = "Unknown", name = "Unknown"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
326 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
327
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
328 parts <- strsplit(classification, ";")[[1]]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
329 for (i in length(parts):1) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
330 level <- sub("^[a-z]__", "", parts[i])
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
331 if (level != "") {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
332 prefix <- sub("__.*$", "", parts[i])
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
333 return(list(level = prefix, name = level))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
334 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
335 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
336 return(list(level = "Unknown", name = "Unknown"))
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
337 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
338
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
339 log_debug("Defining function to format taxonomy")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
340 format_taxonomy <- function(classification) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
341 result <- extract_last_known_taxonomy(classification)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
342 if (result$level == "Unknown") {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
343 return("Unknown")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
344 } else if (result$level == "s") {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
345 return(paste0("<i>", result$name, "</i>"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
346 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
347 genus <- str_replace_all(result$name, "_", " ")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
348 return(paste0("<i>", genus, "</i> sp."))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
349 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
350 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
351
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
352 log_debug("Defining function to calculate quality score and determine genome quality class")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
353 calculate_quality_score_and_class <- function(completeness, contamination) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
354 if (is.na(completeness) || is.na(contamination)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
355 return(list(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
356 score = kableExtra::cell_spec("N/A", color = "white", bold = TRUE, background = cb_friendly_colors$grey),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
357 class = kableExtra::cell_spec("Unknown", color = "white", bold = TRUE, background = cb_friendly_colors$grey),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
358 numeric_score = NA
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
359 ))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
360 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
361
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
362 quality_score <- completeness - (5 * contamination)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
363 formatted_score <- sprintf("%.1f", quality_score)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
364
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
365 if (completeness > 90 && contamination < 5) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
366 class <- "High-quality draft"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
367 color <- cb_friendly_colors$green
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
368 } else if (completeness >= 50 && contamination < 10) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
369 class <- "Medium-quality draft"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
370 color <- cb_friendly_colors$blue
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
371 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
372 class <- "Low-quality draft"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
373 color <- cb_friendly_colors$red
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
374 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
375
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
376 list(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
377 score = kableExtra::cell_spec(formatted_score, color = "white", bold = TRUE, background = color),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
378 class = kableExtra::cell_spec(class, color = "white", bold = TRUE, background = color),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
379 numeric_score = quality_score
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
380 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
381 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
382
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
383 log_debug("Preparing the data")
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
384
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
385 table_data <- data %>%
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
386 # dplyr::mutate(Sample = basename(Sample) %>% trim_sample_name()) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
387 dplyr::mutate(Sample = basename(Sample)) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
388 dplyr::left_join(checkm_host_data, by = c("Sample" = "name")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
389 dplyr::left_join(gtdbtk_data, by = c("Sample" = "user_genome")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
390 dplyr::mutate(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
391 quality_data = purrr::pmap(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
392 list(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
393 as.numeric(completeness),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
394 as.numeric(contamination)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
395 ),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
396 calculate_quality_score_and_class
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
397 ),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
398 Quality_Score = purrr::map_chr(quality_data, ~ .$score),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
399 Genome_Quality = purrr::map_chr(quality_data, ~ .$class),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
400 Quality_Score_Numeric = purrr::map_dbl(quality_data, ~ .$numeric_score),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
401 Virus_Count_Numeric = as.numeric(Virus_Count),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
402 Virus_Count = kableExtra::cell_spec(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
403 Virus_Count,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
404 color = "white",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
405 bold = TRUE,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
406 background = dplyr::case_when(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
407 Virus_Count == 0 ~ cb_friendly_colors$red,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
408 Virus_Count == 1 ~ cb_friendly_colors$blue,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
409 Virus_Count > 1 ~ cb_friendly_colors$green
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
410 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
411 ),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
412 Completeness_Numeric = as.numeric(completeness),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
413 Completeness = create_bar_plot(as.numeric(completeness), 100),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
414 Contamination = create_bar_plot(as.numeric(contamination), 100),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
415 `N50 (contigs)` = format_large_number(as.numeric(contig_n50)),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
416 `Genome size (bp)` = format_large_number(as.numeric(genome_size)),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
417 `GTDB Taxonomy` = sapply(classification, format_taxonomy)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
418 ) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
419 dplyr::mutate(`#` = row_number()) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
420 dplyr::select(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
421 `#`, Sample, `GTDB Taxonomy`, Virus_Count,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
422 Quality_Score, Genome_Quality, Completeness, Contamination,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
423 `Genome size (bp)`, `N50 (contigs)`
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
424 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
425
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
426 log_debug("Creating the table")
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
427 kableExtra::kbl(table_data,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
428 escape = FALSE,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
429 align = c("c", "l", "l", "c", rep("c", 2), rep("r", 2), rep("r", 2))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
430 ) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
431 kableExtra::kable_paper(full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
432 kableExtra::column_spec(1, bold = TRUE, width = "2em") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
433 kableExtra::column_spec(2:3, bold = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
434 kableExtra::column_spec(4:5, width = "5em") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
435 kableExtra::column_spec(6:7, width = "60px") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
436 kableExtra::column_spec(8:9, width = "4em") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
437 kableExtra::add_header_above(c(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
438 " " = 4, "Host Genome Quality" = 2, "CheckM Metrics" = 2,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
439 "Statistics" = 2
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
440 )) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
441 kableExtra::kable_styling(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
442 bootstrap_options = c("striped", "hover", "condensed", "responsive"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
443 font_size = 9,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
444 html_font = "Arial",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
445 position = "left"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
446 ) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
447 kableExtra::row_spec(0, bold = TRUE, color = "white", background = "#333333") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
448 kableExtra::row_spec(0, extra_css = "border-bottom: 2px solid #000000;") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
449 kableExtra::column_spec(9, extra_css = "border-right: 2px solid #000000;") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
450 kableExtra::scroll_box(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
451 width = "100%", height = "100%",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
452 extra_css = "overflow-x: auto; border: 1px solid #ccc; border-radius: 4px;"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
453 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
454 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
455
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
456 # Results {.tabset .tabset-fade}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
457
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
458 ```{r}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
459 # Creating combined_unique object
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
460
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
461 combined_unique <- bind_rows(
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
462 checkm_host_data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
463 # dplyr::select(bin_id) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
464 # dplyr::rename(Sample = bin_id),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
465 dplyr::select(name) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
466 dplyr::rename(Sample = name),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
467 data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
468 # dplyr::mutate(Sample = stringr::str_remove(Sample, "_virus_summary.tsv")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
469 dplyr::select(Sample)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
470 ) %>%
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
471 distinct(Sample) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
472 arrange(Sample)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
473
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
474 log_debug(paste("combined_unique samples:", paste(combined_unique$Sample, collapse = ", ")))
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
475 ```
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
476
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
477
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
478
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
479 ```{r main_workflow, fig.width=6, fig.height=6, out.height="100%", out.width='100%', dpi=300, fig.align='center', warning=FALSE, message=FALSE, results='asis'}
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
480 # Process proviruses data
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
481 process_proviruses <- function(data_genomad) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
482 proviruses <- data_genomad %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
483 dplyr::filter(topology == "Provirus") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
484 dplyr::mutate(contig = sub("\\|provirus_.*", "", seq_name)) %>% # take everything before "|provirus"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
485 dplyr::mutate(contig = paste0("c", as.numeric(factor(contig)))) %>% # map them to c_1, c_2, ...
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
486 dplyr::select(seq_name, coordinates, length, contig, virus_score, n_hallmarks)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
487
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
488 proviruses <- proviruses %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
489 tidyr::separate(coordinates, into = c("start", "end"), sep = "-")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
490
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
491 proviruses$start <- as.integer(proviruses$start)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
492 proviruses$end <- as.integer(proviruses$end)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
493
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
494 proviruses_gr_features <- GRanges(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
495 seqnames = proviruses$contig,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
496 ranges = IRanges(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
497 start = proviruses$start,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
498 end = proviruses$end
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
499 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
500 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
501 proviruses_gr_features$length <- proviruses_gr_features %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
502 ranges() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
503 width()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
504 proviruses_gr_features$score <- as.numeric(proviruses$virus_score)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
505 proviruses_gr_features$n_hallmarks <- as.numeric(proviruses$n_hallmarks)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
506
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
507 proviruses_gr_features$n_hallmarks_pos <-
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
508 abs(start(proviruses_gr_features) - end(proviruses_gr_features)) / 2
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
509
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
510 return(proviruses_gr_features)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
511 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
512
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
513 plot_genome_ideogram <- function(genome_current, proviruses_gr_features) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
514 fasta_file_path <- file.path(params$outdir, "genomes", paste0(genome_current, ".fna"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
515 # cat(fasta_file_path, "\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
516 genome_ideogram <- gmoviz::getIdeogramData(fasta_file = fasta_file_path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
517
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
518 # Replace any seqlevel to c_1, c_2, c_3, ...
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
519 new_seqlevels <- paste0("c", seq_along(GenomeInfoDb::seqlevels(genome_ideogram)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
520 names(new_seqlevels) <- GenomeInfoDb::seqlevels(genome_ideogram)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
521 genome_ideogram <- GenomeInfoDb::renameSeqlevels(genome_ideogram, new_seqlevels)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
522 colours <- rep("#a58bc5", length(GenomeInfoDb::seqlevels(genome_ideogram)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
523
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
524 par(mar = c(2, 2, 2, 2)) # minimal margins around the plot
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
525
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
526 gmoviz::gmovizInitialise(genome_ideogram,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
527 sector_colours = colours,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
528 sector_border_colours = colours,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
529 sector_labels = FALSE
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
530 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
531
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
532 for (i in 1:length(proviruses_gr_features)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
533 name <- as.character(seqnames(proviruses_gr_features[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
534 start <- as.numeric(start(proviruses_gr_features[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
535 end <- as.numeric(end(proviruses_gr_features[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
536 region <- data.frame(start = start, end = end)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
537 circlize::circos.genomicRect(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
538 seqnames = name,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
539 region,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
540 ytop = .5,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
541 ybottom = 0,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
542 track.index = 1,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
543 sector.index = name,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
544 border = "#e9d27d",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
545 col = "#e9d27d"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
546 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
547 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
548
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
549 length <- as.numeric(proviruses_gr_features$length)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
550 length <- ifelse(length > 1000000,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
551 paste0(round(length / 1000000, 2), "mb"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
552 paste0(round(length / 1000, 2), "kb")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
553 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
554 labels <- paste0(as.character(seqnames(proviruses_gr_features)), " (", length, ")")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
555 circlize::circos.labels(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
556 sectors = as.character(seqnames(proviruses_gr_features)),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
557 x = as.numeric(start(proviruses_gr_features)),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
558 labels,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
559 facing = "clockwise"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
560 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
561 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
562
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
563 process_sample <- function(sample, combined_unique, host_genomes_paths, genome_data) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
564 genome_current <- sample # Add this line
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
565 tryCatch(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
566 {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
567 log_debug(paste("Starting to process sample:", sample))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
568
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
569 # Check if sample exists in genome_data
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
570 if (!(sample %in% names(genome_data))) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
571 log_debug(paste("Sample", sample, "not found in genome_data"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
572 cat(paste("Error: Sample", sample, "not found in genome_data\n\n"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
573 return()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
574 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
575
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
576 cat(paste("## ", sample, "{.tabset .tabset-fade} \n\n"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
577
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
578 host_genome_path <- host_genomes_paths$path[host_genomes_paths$name == sample]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
579 if (length(host_genome_path) == 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
580 log_debug(paste("Host genome path not found for sample:", sample))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
581 cat(paste("Error: Host genome path not found for sample", sample, "\n\n"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
582 return()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
583 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
584
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
585 host_genome_ideogram <- tryCatch(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
586 {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
587 gmoviz::getIdeogramData(fasta_file = host_genome_path)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
588 },
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
589 error = function(e) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
590 log_debug(paste("Error loading host genome ideogram for sample", sample, ":", conditionMessage(e)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
591 NULL
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
592 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
593 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
594
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
595 if (is.null(host_genome_ideogram)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
596 cat(paste("Error: Unable to load host genome ideogram for sample", sample, "\n\n"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
597 return()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
598 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
599
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
600 sample_data <- genome_data[[sample]]$loaded_data
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
601 genomad_summary <- sample_data$genomad
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
602 genomad_annotation <- sample_data$genomad_annotations
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
603 checkv_data <- sample_data$checkv
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
604 defense_finder_data <- sample_data$defense_finder
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
605 abricate_data <- sample_data$abricate
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
606 iphop_data <- sample_data$iphop
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
607 vibrant_data <- sample_data$vibrant
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
608
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
609 cat("### Host Genome\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
610
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
611 cat("**GTDB-Tk taxonomy**: \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
612 data_gtdbtk_host %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
613 dplyr::filter(user_genome == sample) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
614 dplyr::select(classification) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
615 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
616 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
617 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
618 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
619 cat()
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
620
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
621 # Cat checkm summary for this genome
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
622 cat("**CheckM2 Summary**:\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
623 # checkm_summary <- data_checkm_host %>% dplyr::filter(`bin_id` == sample)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
624 checkm_summary <- data_checkm_host %>% dplyr::filter(`name` == sample)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
625 checkm_summary %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
626 janitor::clean_names() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
627 # dplyr::select(number_contigs, n50_contigs, completeness, contamination, strain_heterogeneity) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
628 dplyr::select(total_contigs, contig_n50, completeness, contamination) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
629 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
630 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
631 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
632 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
633 cat()
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
634
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
635 # Display defense-finder as a table
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
636 if (!is.null(defense_finder_data) && nrow(defense_finder_data) > 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
637 cat("**Defense-Finder Systems**:\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
638
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
639 defense_finder_data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
640 dplyr::select(sys_id, type, subtype, sys_beg, sys_end, protein_in_syst, genes_count, name_of_profiles_in_sys) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
641 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
642 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
643 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
644 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
645 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
646 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
647 cat("No Defense-Finder systems detected.\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
648 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
649
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
650 if (is.null(genomad_summary) || nrow(genomad_summary) == 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
651 q
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
652 log_debug(paste("No geNomad summary data found for sample:", sample))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
653 return()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
654 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
655
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
656 if (length(GenomeInfoDb::seqlevels(host_genome_ideogram)) == 1) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
657 host_genome_size <- sum(width(host_genome_ideogram))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
658 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
659 virus_containing_contigs <- unique(sub("\\|.*", "", genomad_summary$seq_name))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
660 virus_containing_contigs <- paste0("c_", as.numeric(factor(virus_containing_contigs)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
661 filtered_host_genome <- subset_and_update_ideogram(host_genome_ideogram, virus_containing_contigs)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
662 host_genome_size <- sum(width(filtered_host_genome))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
663 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
664
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
665 # Process proviruses
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
666 proviruses_gr_features <- process_proviruses(genomad_summary)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
667
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
668 cat("**Genomad and CheckV Summary**:\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
669 genomad_summary %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
670 dplyr::select(seq_name, taxonomy, topology, coordinates, length) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
671 dplyr::left_join(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
672 checkv_data %>% dplyr::select(contig_id, gene_count, viral_genes, checkv_quality, miuvig_quality),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
673 by = c("seq_name" = "contig_id")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
674 ) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
675 dplyr::select(seq_name, length, gene_count, viral_genes, checkv_quality, miuvig_quality, taxonomy, topology, coordinates) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
676 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
677 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
678 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
679 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
680 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
681
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
682 cat("**Host Genome Ideogram with Phages**:\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
683 plot_genome_ideogram(sample, proviruses_gr_features)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
684 cat('In this circular plot, **"c"** indicates the contig, and the number that follows (e.g., **c1**) represents the contig number.
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
685 If multiple contigs are present in the genome, each will be shown with a distinct label (e.g., **c1**, **c2**, etc.).\n\n')
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
686 cat("\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
687
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
688 # Process phage genomes
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
689 cat("### Prophages {.tabset .tabset-fade} \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
690 cat("**Select prophage to show: ** \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
691 for (i in seq_len(nrow(genomad_summary))) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
692 log_debug(paste("Processing phage", i, "of", nrow(genomad_summary), "for sample", sample))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
693 process_phage(genomad_summary[i, ], genomad_summary, genomad_annotation, checkv_data, host_genome_size)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
694 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
695
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
696 # Plot dREP if applicable
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
697 if (nrow(genomad_summary) > 1) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
698 cat("### vOTUs\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
699 plot_drep(sample, genomad_summary)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
700 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
701
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
702 # Creating table with Abricate data
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
703 if (nrow(abricate_data) > 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
704 cat("### Virulence Genes {.tabset .tabset-fade} \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
705 cat("Screening of virulence genes present in the prophage contigs. \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
706 abricate_data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
707 dplyr::select(-number_file) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
708 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
709 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
710 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
711 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
712 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
713 cat("\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
714 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
715
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
716 # Creating table with iPHOP
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
717 if (nrow(iphop_data) > 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
718 cat("### Prophage-Host Prediction {.tabset .tabset-fade} \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
719 cat("Prediction of potential hosts for the prophage contigs. \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
720 iphop_data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
721 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
722 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
723 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
724 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
725 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
726 cat("\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
727 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
728
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
729 # Creating table with VIBRANT AMGs
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
730 if (nrow(vibrant_data) > 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
731 cat("### AMG Predictions {.tabset .tabset-fade} \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
732 cat("Prediction of auxiliary metabolic genes in the prophage contigs. \n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
733 vibrant_data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
734 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
735 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
736 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
737 kableExtra::scroll_box(width = "100%", height = "100%") %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
738 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
739 cat("\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
740 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
741
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
742 log_debug(paste("Finished processing sample:", sample))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
743 },
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
744 error = function(e) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
745 log_debug(paste("Error in process_sample for", sample, ":", conditionMessage(e)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
746 cat(paste("Error processing sample", sample, ":", conditionMessage(e), "\n\n"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
747 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
748 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
749 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
750
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
751 process_phage <- function(virus, genomad_summary, genomad_annotation, checkv_data, host_genome_size) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
752 cat(paste("#### Phage ID:", virus$seq_name, " {.tabset .tabset-fade} \n\n"))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
753
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
754 current_contig <- sub("\\|.*", "", virus$seq_name)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
755
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
756 provirus_start <- as.numeric(sub(".*provirus_(\\d+)_\\d+", "\\1", virus$seq_name))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
757 provirus_end <- as.numeric(sub(".*provirus_\\d+_(\\d+)", "\\1", virus$seq_name))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
758 virus_length <- provirus_end - provirus_start + 1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
759
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
760 current_contig_base <- sub("\\|provirus_.*", "", virus$seq_name)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
761 current_provirus_range <- sub(".*\\|provirus_", "", virus$seq_name)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
762 current_annotations <- genomad_annotation[grepl(paste0(current_contig_base, "\\|provirus_", current_provirus_range, "_"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
763 genomad_annotation$gene,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
764 fixed = FALSE
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
765 ), ] %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
766 dplyr::mutate(arrow_pos = ifelse(strand == -1, "start", "end"))
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
767
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
768
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
769 cat("\n\n**Phage-Host Genome Ideogram:**\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
770
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
771 plot_phage_circos(virus, genomad_summary, current_annotations, virus_length, host_genome_size, provirus_start, provirus_end, checkv_data)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
772
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
773 cat("\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
774 cat("\n\n**Genes Annotation (geNomad):**\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
775
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
776 current_annotations %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
777 dplyr::select(gene, length, marker, annotation_accessions, annotation_description) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
778 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
779 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
780 kableExtra::kable_paper() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
781 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
782 cat("\n\n")
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
783 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
784
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
785 plot_phage_circos <- function(virus, genomad_summary, current_annotations, virus_length, host_genome_size, provirus_start, provirus_end, checkv_data) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
786 tryCatch(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
787 {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
788 log_debug("Starting plot_phage_circos function")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
789 log_debug(paste("Current virus:", virus$seq_name))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
790 log_debug(paste("Virus length:", virus_length))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
791 log_debug(paste("Host genome size:", host_genome_size))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
792 log_debug(paste("Provirus start:", provirus_start))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
793 log_debug(paste("Provirus end:", provirus_end))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
794
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
795 # Check for NA or invalid values in input parameters
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
796 if (is.na(virus_length) || virus_length <= 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
797 log_debug("Error: Invalid virus length", virus_length)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
798 return(NULL)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
799 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
800 if (is.na(host_genome_size) || host_genome_size <= 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
801 log_debug("Error: Invalid host genome size")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
802 return(NULL)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
803 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
804 if (is.na(provirus_start) || provirus_start < 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
805 log_debug("Error: Invalid provirus start position")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
806 return(NULL)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
807 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
808 if (is.na(provirus_end) || provirus_end <= provirus_start) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
809 log_debug("Error: Invalid provirus end position")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
810 return(NULL)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
811 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
812
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
813 # Extract contig information
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
814 current_contig <- sub("\\|.*", "", virus$seq_name)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
815 log_debug(paste("Current contig:", current_contig))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
816
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
817 contig_viruses <- genomad_summary[grepl(paste0("^", current_contig), genomad_summary$seq_name), ]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
818 if (nrow(contig_viruses) == 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
819 log_debug("Error: No viruses found for the current contig")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
820 return(NULL)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
821 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
822
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
823 contig_length <- max(as.numeric(sub(".*_(\\d+)$", "\\1", contig_viruses$seq_name)))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
824 if (is.na(contig_length) || contig_length <= 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
825 contig_length <- virus_length # Use virus length as fallback if contig length is invalid
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
826 log_debug(paste("Using virus length as contig length:", contig_length))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
827 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
828 log_debug(paste("Contig length:", contig_length))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
829 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
830
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
831 if (provirus_end > contig_length) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
832 log_debug("Error: Provirus end position exceeds contig length")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
833 return(NULL)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
834 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
835
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
836 log_debug("Clearing circos")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
837 circlize::circos.clear()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
838
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
839 log_debug("Setting circos parameters")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
840 circlize::circos.par(start.degree = 180, gap.degree = 10, track.margin = c(0.01, 0.01))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
841
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
842 main_color <- "#a58bc5"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
843 zoom_color <- "#e9d27d"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
844
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
845 zoom_start <- (provirus_start / contig_length) * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
846 zoom_end <- (provirus_end / contig_length) * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
847
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
848 log_debug(paste("Zoom start:", zoom_start))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
849 log_debug(paste("Zoom end:", zoom_end))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
850
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
851 log_debug("Initializing circos")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
852 circlize::circos.initialize(factors = c("Zoom", "Main"), xlim = c(0, 100))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
853
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
854 format_genome_labels <- function(x) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
855 ifelse(x >= 1e6, paste0(round(x / 1e6, 2), " Mb"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
856 ifelse(x >= 1e3, paste0(round(x / 1e3, 2), " Kb"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
857 paste0(x, " bp")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
858 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
859 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
860 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
861
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
862 log_debug("Adding link")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
863 tryCatch(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
864 {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
865 circlize::circos.link("Main", c(zoom_start, zoom_end), "Zoom", c(0, 100),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
866 rou1 = 0.8,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
867 rou2 = 0.97,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
868 h.ratio = 0.55, # width?
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
869 lty = 2,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
870 lwd = 0.5,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
871 h2 = 1,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
872 col = "grey99", border = "grey80"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
873 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
874 },
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
875 error = function(e) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
876 log_debug(paste("Error in circlize::circos.link:", e$message))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
877 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
878 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
879
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
880 log_debug("Adding zoom track")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
881 circlize::circos.track(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
882 factors = "Zoom", ylim = c(0, 1), track.height = 0.15,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
883 panel.fun = function(x, y) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
884 circlize::circos.rect(0, 0, 100, 1, col = zoom_color, border = NA)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
885 axis_labels <- seq(0, virus_length, length.out = 6)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
886 axis_positions <- seq(0, 100, length.out = 6)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
887 circlize::circos.axis(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
888 h = "top", major.at = axis_positions,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
889 labels = format_genome_labels(axis_labels),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
890 labels.cex = 0.7, direction = "outside"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
891 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
892
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
893 for (i in 1:nrow(current_annotations)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
894 gene_start <- current_annotations$start[i]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
895 gene_end <- current_annotations$end[i]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
896 arrow_start <- (gene_start - provirus_start) / virus_length * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
897 arrow_end <- (gene_end - provirus_start) / virus_length * 100
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
898
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
899 circlize::circos.arrow(arrow_start, arrow_end,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
900 arrow.head.width = 0.75, arrow.head.length = cm_x(0.1),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
901 arrow.position = current_annotations$arrow_pos[i],
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
902 col = ifelse(is.na(current_annotations$annotation_description[i]), "grey", "#7fbfff"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
903 border = ifelse(is.na(current_annotations$annotation_description[i]), "grey20", "darkblue")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
904 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
905 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
906 }, bg.border = NA
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
907 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
908
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
909 log_debug("Adding main track")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
910 circlize::circos.track(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
911 factors = "Main", ylim = c(0, 1), track.height = 0.1,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
912 panel.fun = function(x, y) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
913 circlize::circos.rect(xleft = 0, ybottom = 0, xright = 100, ytop = 1, col = main_color, border = NA)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
914
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
915 for (i in 1:nrow(contig_viruses)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
916 virus_start <- as.numeric(sub(".*provirus_(\\d+)_\\d+", "\\1", contig_viruses$seq_name[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
917 virus_end <- as.numeric(sub(".*provirus_\\d+_(\\d+)", "\\1", contig_viruses$seq_name[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
918
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
919 virus_start_percent <- (virus_start / contig_length) * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
920 virus_end_percent <- (virus_end / contig_length) * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
921
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
922 rect_color <- if (contig_viruses$seq_name[i] == virus$seq_name) zoom_color else adjustcolor(zoom_color, alpha.f = 0.7)
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
923
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
924 circlize::circos.rect(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
925 xleft = virus_start_percent, ybottom = 0,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
926 xright = virus_end_percent, ytop = 1,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
927 col = rect_color, border = NA
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
928 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
929 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
930
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
931 axis_labels <- seq(0, contig_length, length.out = 6)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
932 axis_positions <- seq(0, 100, length.out = 6)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
933 circlize::circos.axis(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
934 h = "top", major.at = axis_positions,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
935 labels = format_genome_labels(axis_labels),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
936 labels.cex = 0.7, direction = "outside"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
937 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
938 }, bg.border = NA
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
939 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
940
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
941 log_debug("Locating phage positions")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
942 phage_positions <- sapply(1:nrow(contig_viruses), function(i) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
943 virus_start <- as.numeric(sub(".*provirus_(\\d+)_\\d+", "\\1", contig_viruses$seq_name[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
944 virus_end <- as.numeric(sub(".*provirus_\\d+_(\\d+)", "\\1", contig_viruses$seq_name[i]))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
945 ((virus_start + virus_end) / 2 / contig_length) * 100
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
946 })
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
947
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
948 log_debug("Annotating names on phage positions")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
949
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
950 # Extract start and end positions from sequence names
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
951 start_positions <- as.numeric(sub(".*provirus_([0-9]+)_.*", "\\1", contig_viruses$seq_name))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
952 end_positions <- as.numeric(sub(".*provirus_[0-9]+_([0-9]+)", "\\1", contig_viruses$seq_name))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
953
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
954 # Create phage labels with the desired format
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
955 phage_labels <- paste0(round(contig_viruses$length / 1e3, 2), " Kb")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
956
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
957 # Apply labels to circos plot
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
958 circlize::circos.labels(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
959 sectors = "Main",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
960 x = phage_positions,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
961 labels = phage_labels,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
962 facing = "reverse.clockwise",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
963 niceFacing = TRUE,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
964 col = "black",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
965 cex = 0.6,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
966 side = "inside",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
967 connection_height = 0.02,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
968 line_col = "gray"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
969 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
970
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
971 center_x <- 50
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
972 virus_name <- virus$seq_name
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
973 taxonomy <- virus$taxonomy
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
974
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
975 log_debug("Adding taxonomy and virus name to the plot")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
976 circlize::circos.text(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
977 x = center_x, y = -0.2, labels = taxonomy,
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
978 sector.index = "Zoom", track.index = 1,
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
979 facing = "bending.inside", niceFacing = TRUE,
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
980 adj = c(0.5, 0.7), cex = 0.8
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
981 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
982
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
983 checkv_info <- checkv_data[checkv_data$contig_id == virus$seq_name, ]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
984 if (nrow(checkv_info) > 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
985 checkv_quality <- checkv_info$checkv_quality
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
986 gene_count <- checkv_info$gene_count
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
987 viral_genes <- checkv_info$viral_genes
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
988 host_genes <- checkv_info$host_genes
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
989 miuvig_quality <- checkv_info$miuvig_quality
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
990 completeness <- checkv_info$completeness
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
991 completeness_method <- checkv_info$completeness_method
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
992 contamination <- checkv_info$contamination
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
993
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
994 circlize::circos.text(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
995 x = center_x, y = -0.5,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
996 labels = paste("CheckV Quality:", checkv_quality, " - miuvig Quality:", miuvig_quality),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
997 sector.index = "Zoom", track.index = 2,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
998 facing = "bending.inside", niceFacing = TRUE,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
999 adj = c(0.5, 0), cex = 0.7
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1000 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1001
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1002 circlize::circos.text(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1003 x = center_x, y = -1.5,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1004 labels = paste("Gene Count:", gene_count, " - Viral Genes:", viral_genes, " - Host Genes:", host_genes),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1005 sector.index = "Zoom", track.index = 2,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1006 facing = "bending.inside", niceFacing = TRUE,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1007 adj = c(0.5, 0), cex = 0.7
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1008 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1009
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1010 circlize::circos.text(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1011 x = center_x, y = -2.5,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1012 labels = paste("Completeness:", completeness, " - Contamination:", contamination),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1013 sector.index = "Zoom", track.index = 2,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1014 facing = "bending.inside", niceFacing = TRUE,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1015 adj = c(0.5, 0), cex = 0.7
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1016 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1017 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1018
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1019 log_debug("Adding legend")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1020 # Add legend
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1021 legend("topright",
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1022 legend = c("Annotated gene", "Unknown gene"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1023 fill = c("#7fbfff", "grey"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1024 border = c("darkblue", "grey20"),
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1025 cex = 0.8,
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1026 bty = "n"
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1027 )
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1028
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1029 log_debug("Clearing circos")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1030 circlize::circos.clear()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1031 log_debug("Finished plot_phage_circos function successfully")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1032 },
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1033 error = function(e) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1034 log_debug(paste("Error in plot_phage_circos:", e$message))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1035 circlize::circos.clear()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1036 }
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1037 )
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1038 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1039
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1040 plot_drep <- function(sample, genomad_summary) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1041 drep_file_path <- file.path(params$outdir, "virus_analyses", "drep_compare", sample, "data_tables", "Cdb.csv")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1042 drep_data <- read_csv(drep_file_path) %>% janitor::clean_names()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1043 drep_data <- cbind(genomad_summary$seq_name, drep_data)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1044
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1045 cat("When more than 1 phage is detected in the host genome, we perform a clustering step using the tool dRep.\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1046 cat("A threshold of 0.95 was applied to the ANI similarity index to define clusters of virus operational taxonomic units (vOTUs).")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1047
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1048 cat("\n\n**Final cluster designations**\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1049 drep_data %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1050 kableExtra::kbl() %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1051 kableExtra::kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1052 kableExtra::kable_paper("striped", full_width = TRUE) %>%
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1053 cat()
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1054
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1055 # Insert the PDF plot
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1056 plot_path <- file.path(params$outdir, "virus_analyses", "drep_compare", sample, "figures", "Primary_clustering_dendrogram.pdf")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1057 png_path <- file.path(params$outdir, "virus_analyses", "drep_compare", sample, "figures", "Primary_clustering_dendrogram.png")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1058
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1059 if (file.exists(plot_path)) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1060 pdftools::pdf_convert(plot_path, format = "png", filenames = png_path, verbose = FALSE, dpi = 150)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1061 base64_str <- base64enc::dataURI(file = png_path, mime = "image/png")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1062 cat("**Primary clustering plot**\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1063 cat(sprintf(
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1064 '<div style="text-align: center;"><img src="%s" style="max-width: 100%%; height: auto; border:1px solid #ddd; border-radius:4px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin: 1em 0;"></div>', base64_str
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1065 ))
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1066 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1067 cat("**No dRep clustering plot found.**\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1068 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1069 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1070
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1071 subset_and_update_ideogram <- function(ideogram, contigs) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1072 filtered <- ideogram[seqnames(ideogram) %in% contigs]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1073 GenomeInfoDb::seqlevels(filtered) <- contigs
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1074 seqinfo(filtered) <- seqinfo(filtered)[contigs]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1075 filtered
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1076 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1077
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1078 render_all_samples <- function(test_mode = FALSE) {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1079 if (test_mode) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1080 if (nrow(combined_unique) > 0) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1081 cat("**Select sample to show:** \n\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1082 current_sample <- combined_unique$Sample[6]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1083 process_sample(current_sample, combined_unique, host_genomes_paths, genome_data)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1084 } else {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1085 print("No samples can be further analysed.")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1086 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1087 } else {
1
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1088 cat("**Select sample to show:** \n\n\n")
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1089 for (i in seq_len(nrow(combined_unique))) {
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1090 current_sample <- combined_unique$Sample[i]
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1091 process_sample(current_sample, combined_unique, host_genomes_paths, genome_data)
3a7f73d638ba planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 368e8a7322c9763c648637263d4695abc146be13
ufz
parents: 0
diff changeset
1092 }
0
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1093 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1094 }
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1095
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1096 # Execute the main function
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1097 # Test mode processes one sample only
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1098 render_all_samples(test_mode = F)
315c2ed31af1 planemo upload for repository https://github.com/Helmholtz-UFZ/ufz-galaxy-tools/blob/main/tools/phi-toolkit commit 45c746567f48e6c9bcc19ba4e94e87348df3ac7a
ufz
parents:
diff changeset
1099 ```