Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When exporting plots, make a more clear error message for unsupported FastQC dot plot #1976

Merged
merged 6 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CSP.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ script-src 'self'
'sha256-1pWjCVoi5AoQvT52zb72qGCpIpfJzlc9trKcbcarXUY=' # multiqc_toolbox.js
'sha256-gB0osLOAZOyj1tcLhUs/xzf98qK3dfViuIJdX0lI8xA=' # multiqc_fastqc.js
'unsafe-eval'

# 1.16
'sha256-wlLs2UDz7n3cvWqY0PTazlKGYhGTOPH77vsElgE7pFw=' # multiqc_fastqc.js
'sha256-GueuiCxuV8FbnCv7Txho8dTrz3HODU6GH40tvy5kMks=' # multiqc_dragen_fastqc.js
;
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,17 @@ function fastqc_module(module_element, module_key) {

// Export plot
module_element.find(".dragen_fastqc_per_base_sequence_content_plot").on("mqc_plotexport_image", function (e, cfg) {
alert("Apologies, it's not yet possible to export this plot.\nPlease take a screengrab or export the JSON data.");
alert(
"Apologies, it's not yet possible to export the DRAGEN-FastQC per-base sequence content plot.\nPlease take a screengrab or export the JSON data."
);
});
module_element.find(".dragen_fastqc_per_base_sequence_content_plot").on("mqc_plotexport_data", function (e, cfg) {
if (cfg["ft"] == "json") {
json_str = JSON.stringify(fastqc_seq_content[module_key], null, 2);
var blob = new Blob([json_str], { type: "text/plain;charset=utf-8" });
saveAs(blob, cfg["fname"]);
} else {
alert("Apologies, this plot can only be exported as JSON currently.");
alert("Apologies, the DRAGEN-FastQC per-base sequence content plot can only be exported as JSON currently.");
}
});

Expand Down
6 changes: 4 additions & 2 deletions multiqc/modules/fastqc/assets/js/multiqc_fastqc.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,17 @@ function fastqc_module(module_element, module_key) {

// Export plot
module_element.find(".fastqc_per_base_sequence_content_plot").on("mqc_plotexport_image", function (e, cfg) {
alert("Apologies, it's not yet possible to export this plot.\nPlease take a screengrab or export the JSON data.");
alert(
"Apologies, it's not yet possible to export the FastQC per-base sequence content plot.\nPlease take a screengrab or export the JSON data."
);
});
module_element.find(".fastqc_per_base_sequence_content_plot").on("mqc_plotexport_data", function (e, cfg) {
if (cfg["ft"] == "json") {
json_str = JSON.stringify(fastqc_seq_content[module_key], null, 2);
var blob = new Blob([json_str], { type: "text/plain;charset=utf-8" });
saveAs(blob, cfg["fname"]);
} else {
alert("Apologies, this plot can only be exported as JSON currently.");
alert("Apologies, the FastQC per-base sequence content plot can only be exported as JSON currently.");
}
});

Expand Down
4 changes: 2 additions & 2 deletions multiqc/plots/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def make_table(dt):
)

# Make a colour scale
if header["scale"] == False:
if header["scale"] is False:
c_scale = None
else:
c_scale = mqc_colour.mqc_colour_scale(header["scale"], header["dmin"], header["dmax"], id=table_id)
Expand Down Expand Up @@ -157,7 +157,7 @@ def make_table(dt):
dmin = header["dmin"]
dmax = header["dmax"]
percentage = ((float(val) - dmin) / (dmax - dmin)) * 100
# Treat 0 as 0-width and make bars width of absoluate value
# Treat 0 as 0-width and make bars width of absolute value
if header.get("bars_zero_centrepoint"):
dmax = max(abs(header["dmin"]), abs(header["dmax"]))
dmin = 0
Expand Down
3 changes: 2 additions & 1 deletion test/print_missing_csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def is_executable(script):
executable_types = {
"text/javascript",
"application/javascript",
"module" "text/ecmascript",
"module",
"text/ecmascript",
"application/ecmascript",
}
script_type = script.attrs.get("type", "text/javascript")
Expand Down