Skip to content

Commit

Permalink
switch mqc to 1.20, adjust prettier config again
Browse files Browse the repository at this point in the history
  • Loading branch information
DarianHole committed Mar 12, 2024
1 parent beead64 commit 5e15614
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ indent_style = unset
indent_style = unset

# ignore Rmd files
[*.{Rmd}]
[*.Rmd]
indent_style = unset
trim_trailing_whitespace = unset
7 changes: 3 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ testing/
testing*
*.pyc
bin/
assets/rmarkdown-reports/
reportDashboard.Rmd
sampleAmplicons.Rmd
sampleSubpage.Rmd

# Rmd files
**/*.Rmd
28 changes: 14 additions & 14 deletions assets/rmarkdown-reports/reportDashboard.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -91,15 +91,15 @@ 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)])
} else {
results[i] <- 0 # If none of the key phrases are found, assign 0
}
}
# Return results
return(results)
}
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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)
) %>%
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion assets/rmarkdown-reports/sampleAmplicons.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions assets/rmarkdown-reports/sampleSubpage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
```
Expand Down
2 changes: 1 addition & 1 deletion modules/local/multiqc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::multiqc=1.21
- bioconda::multiqc=1.20
4 changes: 2 additions & 2 deletions modules/local/multiqc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5e15614

Please sign in to comment.