diff --git a/nanoplotter/plot.py b/nanoplotter/plot.py
index 61cbc1b..188ccaf 100644
--- a/nanoplotter/plot.py
+++ b/nanoplotter/plot.py
@@ -5,13 +5,16 @@
import sys
import logging
-# bring in kaleido and ensure Chrome is installed
-import kaleido
-# this will download a small headless Chrome build the first time you run it
-kaleido.get_chrome_sync()
-
-from kaleido import write_fig_sync
-
+# Use Plotly's Chrome bootstrapper instead of kaleido
+import plotly.io as pio
+try:
+ # This should find or install a compatible Chrome in a user-writable location
+ pio.get_chrome()
+except Exception as e:
+ logging.warning(
+ "Plotly could not fetch or find Chrome automatically. "
+ "Static exports may fail unless BROWSER_PATH is set. Details: %s", e
+ )
class Plot(object):
"""A Plot object is defined by a path to the output file and the title of the plot."""
@@ -56,7 +59,7 @@ def save(self, settings):
p = os.path.splitext(self.path)[0] + ".png"
if os.path.exists(p):
os.remove(p)
- logging.warning("No static plots are saved due to some kaleido problem:")
+ logging.warning("No static plots are saved due to an export problem:")
logging.warning(e)
elif self.fig:
@@ -84,13 +87,13 @@ def show(self):
def save_static(self, figformat):
"""
- Export a Plotly figure via Kaleido v1’s write_fig_sync.
+ Export a Plotly figure using Plotly's image writer.
"""
output_path = self.path.replace(".html", f".{figformat}")
try:
- write_fig_sync(self.fig, path=output_path)
+ pio.write_image(self.fig, output_path, format=figformat)
logging.info(f"Saved {output_path} as {figformat}")
except Exception as e:
- logging.warning("No static plots are saved due to some kaleido problem:")
+ logging.warning("No static plots are saved due to an export problem:")
logging.warning(e)
diff --git a/scripts/agm_test.sh b/scripts/agm_test.sh
new file mode 100644
index 0000000..cf92870
--- /dev/null
+++ b/scripts/agm_test.sh
@@ -0,0 +1,16 @@
+#! /bin/bash
+
+#SBATCH --time=04-00:00:00
+#SBATCH --partition=defq
+#SBATCH --mail-user=myemail@email.org
+#SBATCH --mail-type=BEGIN,END,FAIL
+#SBATCH --ntasks-per-node=64
+#SBATCH --mem=128GB
+#SBATCH --nodes=1
+#SBATCH --job-name=nplot
+#SBATCH --comment=nplot
+
+source /path/to/nanoplot_env/bin/activate
+
+# test fresh nanoplot with update
+python /path/to/NanoPlot/nanoplot/NanoPlot.py --fastq /path/to/test_file.fastq.gz --verbose --minqual 4 --color red -o scripts/agm_tests
diff --git a/scripts/agm_tests/LengthvsQualityScatterPlot_dot.html b/scripts/agm_tests/LengthvsQualityScatterPlot_dot.html
new file mode 100644
index 0000000..1592228
--- /dev/null
+++ b/scripts/agm_tests/LengthvsQualityScatterPlot_dot.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/scripts/agm_tests/LengthvsQualityScatterPlot_dot.png b/scripts/agm_tests/LengthvsQualityScatterPlot_dot.png
new file mode 100644
index 0000000..fc23f53
Binary files /dev/null and b/scripts/agm_tests/LengthvsQualityScatterPlot_dot.png differ
diff --git a/scripts/agm_tests/LengthvsQualityScatterPlot_kde.html b/scripts/agm_tests/LengthvsQualityScatterPlot_kde.html
new file mode 100644
index 0000000..ea973a1
--- /dev/null
+++ b/scripts/agm_tests/LengthvsQualityScatterPlot_kde.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/scripts/agm_tests/LengthvsQualityScatterPlot_kde.png b/scripts/agm_tests/LengthvsQualityScatterPlot_kde.png
new file mode 100644
index 0000000..fe767ab
Binary files /dev/null and b/scripts/agm_tests/LengthvsQualityScatterPlot_kde.png differ
diff --git a/scripts/agm_tests/NanoPlot-report.html b/scripts/agm_tests/NanoPlot-report.html
new file mode 100644
index 0000000..17ab322
--- /dev/null
+++ b/scripts/agm_tests/NanoPlot-report.html
@@ -0,0 +1,463 @@
+
+
+
+
+
+
+NanoPlot Report
+
+
+
NanoPlot statistics report
+
+
NanoPlot reports
+
Summary statistics prior to filtering
+
+
+
+
General summary
+
+
+
+
Mean read length
+
1,589.5
+
+
+
Mean read quality
+
16.1
+
+
+
Median read length
+
1,011.0
+
+
+
Median read quality
+
17.4
+
+
+
Number of reads
+
10,000.0
+
+
+
Read length N50
+
2,584.0
+
+
+
STDEV read length
+
1,606.4
+
+
+
Total bases
+
15,894,925.0
+
+
+
Number, percentage and megabases of reads above quality cutoffs
+
+
+
+
>Q10
+
10000 (100.0%) 15.9Mb
+
+
+
>Q15
+
7452 (74.5%) 12.6Mb
+
+
+
>Q20
+
2169 (21.7%) 4.0Mb
+
+
+
>Q25
+
192 (1.9%) 0.2Mb
+
+
+
>Q30
+
18 (0.2%) 0.0Mb
+
+
+
Top 5 highest mean basecall quality scores and their read lengths
+
+
+
+
1
+
35.0 (989)
+
+
+
2
+
34.5 (1715)
+
+
+
3
+
34.2 (489)
+
+
+
4
+
33.9 (307)
+
+
+
5
+
33.9 (511)
+
+
+
Top 5 longest reads and their mean basecall quality score
+
+
+
+
1
+
24951 (10.3)
+
+
+
2
+
21731 (17.8)
+
+
+
3
+
19385 (16.7)
+
+
+
4
+
18470 (18.7)
+
+
+
5
+
16459 (22.0)
+
+
+
+
Summary statistics after filtering
+
+
+
+
General summary
+
+
+
+
Mean read length
+
1,589.5
+
+
+
Mean read quality
+
16.1
+
+
+
Median read length
+
1,011.0
+
+
+
Median read quality
+
17.4
+
+
+
Number of reads
+
10,000.0
+
+
+
Read length N50
+
2,584.0
+
+
+
STDEV read length
+
1,606.4
+
+
+
Total bases
+
15,894,925.0
+
+
+
Number, percentage and megabases of reads above quality cutoffs
+
+
+
+
>Q10
+
10000 (100.0%) 15.9Mb
+
+
+
>Q15
+
7452 (74.5%) 12.6Mb
+
+
+
>Q20
+
2169 (21.7%) 4.0Mb
+
+
+
>Q25
+
192 (1.9%) 0.2Mb
+
+
+
>Q30
+
18 (0.2%) 0.0Mb
+
+
+
Top 5 highest mean basecall quality scores and their read lengths
+
+
+
+
1
+
35.0 (989)
+
+
+
2
+
34.5 (1715)
+
+
+
3
+
34.2 (489)
+
+
+
4
+
33.9 (307)
+
+
+
5
+
33.9 (511)
+
+
+
Top 5 longest reads and their mean basecall quality score
+
+
+
+
1
+
24951 (10.3)
+
+
+
2
+
21731 (17.8)
+
+
+
3
+
19385 (16.7)
+
+
+
4
+
18470 (18.7)
+
+
+
5
+
16459 (22.0)
+
+
+
+
Plots
+
+
Weighted histogram of read lengths
+
+
+
+
+
Weighted histogram of read lengths after log transformation
+
+
+
+
+
Non weighted histogram of read lengths
+
+
+
+
+
Non weighted histogram of read lengths after log transformation
+
+
+
+
+
Yield by length
+
+
+
+
+
Read lengths vs Average read quality plot using dots
\ No newline at end of file
diff --git a/scripts/agm_tests/Non_weightedHistogramReadlength.png b/scripts/agm_tests/Non_weightedHistogramReadlength.png
new file mode 100644
index 0000000..9a26424
Binary files /dev/null and b/scripts/agm_tests/Non_weightedHistogramReadlength.png differ
diff --git a/scripts/agm_tests/Non_weightedLogTransformed_HistogramReadlength.html b/scripts/agm_tests/Non_weightedLogTransformed_HistogramReadlength.html
new file mode 100644
index 0000000..812d7df
--- /dev/null
+++ b/scripts/agm_tests/Non_weightedLogTransformed_HistogramReadlength.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/scripts/agm_tests/Non_weightedLogTransformed_HistogramReadlength.png b/scripts/agm_tests/Non_weightedLogTransformed_HistogramReadlength.png
new file mode 100644
index 0000000..c8ca09a
Binary files /dev/null and b/scripts/agm_tests/Non_weightedLogTransformed_HistogramReadlength.png differ
diff --git a/scripts/agm_tests/WeightedHistogramReadlength.html b/scripts/agm_tests/WeightedHistogramReadlength.html
new file mode 100644
index 0000000..c3d3664
--- /dev/null
+++ b/scripts/agm_tests/WeightedHistogramReadlength.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/scripts/agm_tests/WeightedHistogramReadlength.png b/scripts/agm_tests/WeightedHistogramReadlength.png
new file mode 100644
index 0000000..d08f891
Binary files /dev/null and b/scripts/agm_tests/WeightedHistogramReadlength.png differ
diff --git a/scripts/agm_tests/WeightedLogTransformed_HistogramReadlength.html b/scripts/agm_tests/WeightedLogTransformed_HistogramReadlength.html
new file mode 100644
index 0000000..cb49c59
--- /dev/null
+++ b/scripts/agm_tests/WeightedLogTransformed_HistogramReadlength.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/scripts/agm_tests/WeightedLogTransformed_HistogramReadlength.png b/scripts/agm_tests/WeightedLogTransformed_HistogramReadlength.png
new file mode 100644
index 0000000..fee26fb
Binary files /dev/null and b/scripts/agm_tests/WeightedLogTransformed_HistogramReadlength.png differ
diff --git a/scripts/agm_tests/Yield_By_Length.html b/scripts/agm_tests/Yield_By_Length.html
new file mode 100644
index 0000000..5ef7dec
--- /dev/null
+++ b/scripts/agm_tests/Yield_By_Length.html
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/scripts/agm_tests/Yield_By_Length.png b/scripts/agm_tests/Yield_By_Length.png
new file mode 100644
index 0000000..da5ef00
Binary files /dev/null and b/scripts/agm_tests/Yield_By_Length.png differ