replikation / What_the_Phage

WtP: Phage identification via nextflow and docker or singularity
https://mult1fractal.github.io/wtp-documentation/
GNU General Public License v3.0
103 stars 15 forks source link

Error with report_heatmap_table.input #178

Open deminatanja opened 1 year ago

deminatanja commented 1 year ago

Hi, The run occasionally ends with being unable to use report_heatmap_table.input for making the final report, because report_heatmap_table.input contains a line "reached / virfinder " instead of something like "NODE_X 1 tool-name". Got the error a few times with different datasets. BR, Tatiana

mult1fractal commented 1 year ago

hi I'm currently on holiday. I will check the issue when I'm back in January

Could you please provide the file with the error? without it I cannot see/identify what the problem is

Thanks!

deminatanja commented 1 year ago

Hi!

Thanks a lot! Have nice holidays!

The example of an error log is attached.

slurm-13998112.txt

It ends with

processing file: final_report.Rmd
  Quitting from lines 152-184 (final_report.Rmd) 
  Error in FUN(X[[i]], ...) : 
    only defined on a data frame with all numeric-alike variables
  Calls: <Anonymous> ... styleColorBar -> Summary.data.frame -> lapply -> FUN
  Execution halted

Work dir:
  /scratch/project_2006548/What_the_Phage/workflow-phages-username/36/553df25b195db99545426caae568a3

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

And file final_report.Rmd lines 152-184:

suppressMessages(library(DT))
suppressMessages(library(dplyr))
suppressMessages(library(tidyr))

input_file_heatmap <- "contigs_m12205_report_heatmap_table.input"
sample_name <- "contigs_m12205"

dt = read.table(file = input_file_heatmap, sep = '\t', header = TRUE)

wide <- spread(dt, toolname, p_value)

col_count = ncol(wide)-1
wide3 = wide %>% 
    replace(is.na(.), 0) %>%
    mutate(sum_normed = rowSums(across(where(is.numeric)))/col_count) %>%   # norm sum of pvalue of tooles
    mutate_if(is.numeric,
            round,
            digits = 3)
## pre sort table
wide3 <- wide3 %>% 
 # desc orders from largest to smallest
  arrange(desc(sum_normed))

datatable(wide3, rownames = TRUE , class = 'hover', extensions  = 'Buttons', filter = "top", options = list(
    dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'colvis'))) %>% formatStyle(names(wide3),
  background = styleColorBar(range(wide3[,-1]), 'lightblue'),
  backgroundSize = '98% 88%',
  backgroundRepeat = 'no-repeat',
  backgroundPosition = 'center')

##columnDefs = list(list(visible=FALSE, targets=col_count+1) ## hides last column

The issue seems to be that the contigs_m12205_report_heatmap_table.input file has the following text on line - 393908:

"reached /       virfinder "

all other lines (except headr) have something like the following:

"NODE_9438_length_7263_cov_0_881867      1       virsorter-virome"

I was trying to modify the file and resume the pipeline, but there has been some problems with resuming it when running other datasets in parallel, so I think I stopped at that point. So I can't say if modifying the file ultimately helps.