Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions modules/nf-core/ribowaltz/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ output:
- ribowaltz_qc/*.tsv:
type: file
description: TSV files containing data underlying riboWaltz QC plots including
P-site region distribution, frame distribution, and frame distribution
stratified by read length (optional)
read length distribution, read length bins for P-site offset identification,
ends heatmap, codon usage, P-site region distribution, frame distribution,
frame distribution stratified by read length, and metaprofile P-site
frequency around start/stop codons (optional)
pattern: "ribowaltz_qc/*.tsv"
ontologies: []
versions:
Expand Down
27 changes: 27 additions & 0 deletions modules/nf-core/ribowaltz/templates/ribowaltz.r
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ plot_length_bins <- function(sample_name, df_list) {

ggplot2::ggsave(paste0(getwd(),"/ribowaltz_qc/", sample_name, ".length_bins_for_psite.pdf"), length_dist_split.gg, dpi = 400, width = 10, height = 5)

# Export underlying data
length_bins_dt <- length_dist_split[["count_dt"]]
if (!is.null(length_bins_dt)) {
data.table::fwrite(length_bins_dt, paste0(getwd(), "/ribowaltz_qc/", sample_name, ".length_bins_for_psite.tsv"), sep = "\t")
}
}

#' Export meta-heatmaps of read extremities around start and stop codons produced by the `riboWaltz::rends_heat` function
Expand All @@ -176,6 +181,11 @@ plot_metaheatmap <- function(sample_name, df_list, annotation) {

ggplot2::ggsave(paste0(getwd(),"/ribowaltz_qc/", sample_name, ".ends_heatmap.pdf"), ends_heatmap.gg, dpi = 400, width = 12, height = 8)

# Export underlying data
ends_heatmap_dt <- ends_heatmap[["count_dt"]]
if (!is.null(ends_heatmap_dt)) {
data.table::fwrite(ends_heatmap_dt, paste0(getwd(), "/ribowaltz_qc/", sample_name, ".ends_heatmap.tsv"), sep = "\t")
}
}

#' Export meta-heatmaps of read extremities around start and stop codons produced by the `riboWaltz::codon_usage_psite` function
Expand All @@ -201,6 +211,12 @@ plot_codon_usage <- function(sample_name, psite_info_ls, frequency_normalization
cu_barplot.gg <-cu_barplot[[paste0("plot_", sample_name)]]

ggplot2::ggsave(paste0(getwd(),"/ribowaltz_qc/", sample_name, ".codon_usage.pdf"), cu_barplot.gg, dpi = 400, width = 10, height = 7)

# Export underlying data
codon_usage_dt <- cu_barplot[["count_dt"]]
if (!is.null(codon_usage_dt)) {
data.table::fwrite(codon_usage_dt, paste0(getwd(), "/ribowaltz_qc/", sample_name, ".codon_usage.tsv"), sep = "\t")
}
}


Expand Down Expand Up @@ -268,6 +284,11 @@ save_length_distribution_plot <- function(sample_name, dt.ls) {

ggplot2::ggsave(paste0(getwd(), "/ribowaltz_qc/", sample_name, ".length_distribution.pdf"), length_dist.gg, dpi = 400)

# Export underlying data
length_dist_dt <- length_dist[["count_dt"]]
if (!is.null(length_dist_dt)) {
data.table::fwrite(length_dist_dt, paste0(getwd(), "/ribowaltz_qc/", sample_name, ".length_distribution.tsv"), sep = "\t")
}
}

#' Save P-site Region Plot
Expand Down Expand Up @@ -383,6 +404,12 @@ save_metaprofile_psite_plot <- function(sample_name, df.ls, annotation.df) {
ggplot2::ggsave(paste0(getwd(),"/ribowaltz_qc/", sample_name, ".metaprofile_psite.pdf"), metaprofiles.gg,
dpi = 400, width = 12, height = 6) # save in wide format

# Export plot data for MultiQC
plot_dt <- metaprofile[["plot_dt"]]
if (!is.null(plot_dt)) {
write.table(plot_dt, paste0(getwd(), "/ribowaltz_qc/", sample_name, ".metaprofile_psite.tsv"),
sep = "\t", row.names = FALSE, quote = FALSE)
}
}
# =========
# Parse parameters for Nextflow
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/ribowaltz/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ nextflow_process {
{ assert snapshot(process.out.cds_coverage).match('cds_coverage') },
{ assert snapshot(process.out.cds_window_coverage).match('cds_window_coverage') },
{ assert snapshot(process.out.ribowaltz_qc.size() == 8) },
{ assert snapshot(process.out.ribowaltz_qc_data.size() == 3) },
{ assert snapshot(process.out.ribowaltz_qc_data.size() == 8) },
{ assert snapshot(process.out.versions).match('versions') }
)
}
Expand Down
Loading