diff --git a/.editorconfig b/.editorconfig index 51e7377..75f40d7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -37,6 +37,6 @@ indent_style = unset indent_style = unset # ignore Rmd files -[*.{Rmd}] +[*.Rmd] indent_style = unset trim_trailing_whitespace = unset diff --git a/.prettierignore b/.prettierignore index ba81f78..9fb0b2a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -10,7 +10,6 @@ testing/ testing* *.pyc bin/ -assets/rmarkdown-reports/ -reportDashboard.Rmd -sampleAmplicons.Rmd -sampleSubpage.Rmd + +# Rmd files +**/*.Rmd diff --git a/assets/rmarkdown-reports/reportDashboard.Rmd b/assets/rmarkdown-reports/reportDashboard.Rmd index e005c62..8e098be 100755 --- a/assets/rmarkdown-reports/reportDashboard.Rmd +++ b/assets/rmarkdown-reports/reportDashboard.Rmd @@ -47,16 +47,16 @@ control_substrings = c("neg", "ntc", "blank") summary_df <- read.table(params$summary_df, header = TRUE, sep = ",") # Genome completeness colour palette -get_genome_completeness_color <- function(value) { +get_genome_completeness_color <- function(value) { # Create the Red to Yellow to Green color palette for 100 values red_to_green_palette <- colorRampPalette(c("#FF0039", "#FF7518", "#3FB618"))(100) - + # Calculate the index of the color in the palette based on the input value if (value == 0) { value <- value + 0.00001 } color_index <- ceiling(value * 100) - + # Return the corresponding color with alpha 0.7 selected_color <- red_to_green_palette[color_index] selected_color <- adjustcolor(selected_color, alpha = 0.7) @@ -91,7 +91,7 @@ add_pass_value_int <- function(df, column) { for (i in 1:length(split_values)) { # Check if any key phrase is contained in the split values matching_phrases <- intersect(split_values[[i]], key_phrases) - + if (length(matching_phrases) > 0) { # If matching phrases are found, assign the corresponding integer value results[i] <- min(values[match(matching_phrases, key_phrases)]) @@ -99,7 +99,7 @@ add_pass_value_int <- function(df, column) { results[i] <- 0 # If none of the key phrases are found, assign 0 } } - + # Return results return(results) } @@ -163,7 +163,7 @@ Row {dataset-height=250} df <- select(summary_df, sample, genome_completeness) # Creat plot, adding in titles and the PASS/WARN hlines (may need to figure out how to label these) -p <- plot_ly(df, x = ~sample, y=~genome_completeness, type = 'bar', color = ~genome_completeness, colors = "RdYlGn", name="") %>% +p <- plot_ly(df, x = ~sample, y=~genome_completeness, type = 'bar', color = ~genome_completeness, colors = "RdYlGn", name="") %>% layout( title = "Sample Genome Completeness", xaxis = list(title = "Sample Name"), @@ -203,7 +203,7 @@ df <- df %>% df$completeness_int_color <- add_pass_value_int(df, 'QC Pass') # Using datatable, removing the index row and adding in highlights for the status -summary_dt <- df %>% +summary_dt <- df %>% DT::datatable(rownames = FALSE, options = list( scrollX = FALSE, @@ -235,19 +235,19 @@ summary_dt subpages = NULL # Set knitr options to allow duplicate labels options(knitr.duplicate.label = 'allow') -# Create temporary environment which we use for knitting subpages.RMD +# Create temporary environment which we use for knitting subpages.RMD subpage_env <- new.env() # Create subpages for ( samplev in summary_df$sample ) { # Filter data for sample - sample_df <- summary_df %>% + sample_df <- summary_df %>% filter(sample == samplev) - + # Assign data to subpage_env assign("sample_df", sample_df, subpage_env) assign("sample", samplev, subpage_env) - + # Knit sample subpage using the subpage_env and add result to out vector subpages = c(subpages, knitr::knit_child('sampleSubpage.Rmd', envir = subpage_env)) } @@ -324,7 +324,7 @@ Row {data-height=500} # Have to concat the substrings to grep with substring_regex <- paste(control_substrings, collapse = "|") df <- select(summary_df, sample, neg_control_info, mean_sequencing_depth, median_sequencing_depth, num_aligned_reads, total_variants, genome_completeness, qc_pass) -df <- df %>% +df <- df %>% filter( grepl(substring_regex, sample, ignore.case = TRUE) ) %>% @@ -343,7 +343,7 @@ df <- df %>% df$completeness_int_color <- add_pass_value_int(df, 'QC Pass') # Using datatable, removing the index row and adding in highlights for the status -summary_dt <- df %>% +summary_dt <- df %>% DT::datatable(rownames = FALSE, options = list( scrollX = FALSE, @@ -402,7 +402,7 @@ for (key_process in names(yaml_data)) { # DF df <- data.frame("Process Name" = process, "Software" = softwares, "Version" = versions) -ddt <- df %>% +ddt <- df %>% DT::datatable(rownames = FALSE, class = 'cell-border stripe', options = list( scrollX = FALSE, diff --git a/assets/rmarkdown-reports/sampleAmplicons.Rmd b/assets/rmarkdown-reports/sampleAmplicons.Rmd index 1b83cc3..5c82a81 100755 --- a/assets/rmarkdown-reports/sampleAmplicons.Rmd +++ b/assets/rmarkdown-reports/sampleAmplicons.Rmd @@ -12,7 +12,7 @@ region based on the primer scheme. If there are no N's, the completeness is cons to be 100% (1.0 on the heatmap). Amplicon depth is calculated using bedtools coverage looking for reads in the bam file -that overlap 85% of the amplicon region. +that overlap 85% of the amplicon region. These plots are most useful for determining if there are any amplicons with consistent dropouts or low sequencing depth across the run that can be adjusted for better results diff --git a/assets/rmarkdown-reports/sampleSubpage.Rmd b/assets/rmarkdown-reports/sampleSubpage.Rmd index b2a7eb2..2a3225d 100755 --- a/assets/rmarkdown-reports/sampleSubpage.Rmd +++ b/assets/rmarkdown-reports/sampleSubpage.Rmd @@ -22,7 +22,7 @@ valueBox(sample, icon = "") completeness <- sample_df$genome_completeness[1] sec_color <- get_genome_completeness_color(completeness) valueBox( - completeness, + completeness, icon = "", color = sec_color ) @@ -84,7 +84,7 @@ text_info <- paste( # Plot variation table # I want to make it so that the colors are always the same but was having some trouble with that p <- plot_ly(variants) %>% - add_trace(x = variants[['position']], y = variants[['percentage_nonref']], + add_trace(x = variants[['position']], y = variants[['percentage_nonref']], type = 'scatter', mode = 'markers', color = variants[['variant_type']], marker = list(sizemode = 'diameter', size = 15.0, opacity = 0.7), text = text_info, @@ -114,7 +114,7 @@ p var_f <- paste0("./variant_tsvs/", sample, ".vcf.tsv") if (file.exists(var_f)) { variants <- read.table(var_f, header = TRUE, sep = "\t") - ddt <- variants %>% + ddt <- variants %>% DT::datatable(rownames = FALSE, options = list( scrollX = FALSE @@ -123,7 +123,7 @@ if (file.exists(var_f)) { variants <- data.frame(matrix(ncol = 4, nrow = 0)) colv <- c("Pos", "Ref", "Alt", "Qual") colnames(variants) <- colv - ddt <- variants %>% + ddt <- variants %>% DT::datatable(rownames = FALSE) } ddt @@ -166,7 +166,7 @@ ggplot(coverage) + geom_line(aes(x=position, y=depth)) + scale_y_log10() + xlab("Genome Position (nt)") + - ylab("Sequencing Depth") + + ylab("Sequencing Depth") + geom_rect(data=rect_data, aes(xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax,fill=col),alpha=0.1) + scale_fill_identity() ``` diff --git a/modules/local/multiqc/environment.yml b/modules/local/multiqc/environment.yml index ca39fb6..2212096 100644 --- a/modules/local/multiqc/environment.yml +++ b/modules/local/multiqc/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::multiqc=1.21 + - bioconda::multiqc=1.20 diff --git a/modules/local/multiqc/main.nf b/modules/local/multiqc/main.nf index dd38fb4..f1e142c 100644 --- a/modules/local/multiqc/main.nf +++ b/modules/local/multiqc/main.nf @@ -8,8 +8,8 @@ process MULTIQC_SAMPLE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/multiqc:1.21--pyhdfd78af_0' : - 'biocontainers/multiqc:1.21--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/multiqc:1.20--pyhdfd78af_0' : + 'biocontainers/multiqc:1.20--pyhdfd78af_0' }" input: path multiqc_config