From ecfbb3bc347fbc313f04ec35495b27d01bbac882 Mon Sep 17 00:00:00 2001 From: Helge Hecht Date: Mon, 3 Feb 2025 10:55:52 +0000 Subject: [PATCH 01/10] Update scatterplot.xml to use header names --- tools/scatterplot/scatterplot.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/scatterplot/scatterplot.xml b/tools/scatterplot/scatterplot.xml index 29b841f8..0983f81f 100644 --- a/tools/scatterplot/scatterplot.xml +++ b/tools/scatterplot/scatterplot.xml @@ -17,8 +17,8 @@ - - + + From df2fbf509d90cf6c6effc8ff2a056dbc99d90749 Mon Sep 17 00:00:00 2001 From: Helge Hecht Date: Mon, 3 Feb 2025 10:56:58 +0000 Subject: [PATCH 02/10] Update scatterplot.xml --- tools/scatterplot/scatterplot.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scatterplot/scatterplot.xml b/tools/scatterplot/scatterplot.xml index 0983f81f..d6c7904a 100644 --- a/tools/scatterplot/scatterplot.xml +++ b/tools/scatterplot/scatterplot.xml @@ -1,4 +1,4 @@ - + of two numeric columns numpy From a7015f788e5339fc6d72a47a74461025227b0aa3 Mon Sep 17 00:00:00 2001 From: hechth Date: Mon, 3 Feb 2025 13:35:44 +0100 Subject: [PATCH 03/10] fixed linting --- tools/scatterplot/.shed.yml | 1 + tools/scatterplot/scatterplot.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/scatterplot/.shed.yml b/tools/scatterplot/.shed.yml index cf028276..7fe3d832 100644 --- a/tools/scatterplot/.shed.yml +++ b/tools/scatterplot/.shed.yml @@ -8,4 +8,5 @@ long_description: | name: scatterplot owner: devteam remote_repository_url: https://github.com/galaxyproject/tools-devteam/tree/master/tools/scatterplot +homepage_url: https://github.com/galaxyproject/tools-devteam/ type: unrestricted diff --git a/tools/scatterplot/scatterplot.xml b/tools/scatterplot/scatterplot.xml index d6c7904a..e824b769 100644 --- a/tools/scatterplot/scatterplot.xml +++ b/tools/scatterplot/scatterplot.xml @@ -76,5 +76,6 @@ This tool creates a simple scatter plot between two variables containing numeric ]]> + 10.1038/s41586-020-2649-2 From 2b79bf913ab93420e90ae5ae59e773344298a08e Mon Sep 17 00:00:00 2001 From: hechth Date: Mon, 3 Feb 2025 13:40:58 +0100 Subject: [PATCH 04/10] linted python script --- tools/scatterplot/scatterplot.py | 51 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/tools/scatterplot/scatterplot.py b/tools/scatterplot/scatterplot.py index c9ffad9e..55bec8c8 100644 --- a/tools/scatterplot/scatterplot.py +++ b/tools/scatterplot/scatterplot.py @@ -24,9 +24,11 @@ def main(): in_fname = sys.argv[1] out_fname = sys.argv[2] try: - columns = int( sys.argv[3] ) - 1, int( sys.argv[4] ) - 1 - except: - stop_err( "Columns not specified, your query does not contain a column of numerical data." ) + columns = int(sys.argv[3]) - 1, int(sys.argv[4]) - 1 + except Exception: + stop_err( + "Columns not specified, your query does not contain a column of numerical data." + ) title = sys.argv[5] xlab = sys.argv[6] ylab = sys.argv[7] @@ -34,31 +36,31 @@ def main(): matrix = [] skipped_lines = 0 first_invalid_line = 0 - invalid_value = '' + invalid_value = "" invalid_column = 0 i = 0 - for i, line in enumerate( open( in_fname ) ): + for i, line in enumerate(open(in_fname)): valid = True - line = line.rstrip( '\r\n' ) - if line and not line.startswith( '#' ): + line = line.rstrip("\r\n") + if line and not line.startswith("#"): row = [] - fields = line.split( "\t" ) + fields = line.split("\t") for column in columns: try: val = fields[column] if val.lower() == "na": - row.append( float( "nan" ) ) + row.append(float("nan")) else: - row.append( float( fields[column] ) ) - except: + row.append(float(fields[column])) + except Exception: valid = False skipped_lines += 1 if not first_invalid_line: first_invalid_line = i + 1 try: invalid_value = fields[column] - except: - invalid_value = '' + except Exception: + invalid_value = "" invalid_column = column + 1 break else: @@ -68,22 +70,29 @@ def main(): first_invalid_line = i + 1 if valid: - matrix.append( row ) + matrix.append(row) if skipped_lines < i: try: - a = numpy2ri(array( matrix )) - r.pdf( out_fname, 8, 8 ) - r.plot( a, type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19 ) + a = numpy2ri(array(matrix)) + r.pdf(out_fname, 8, 8) + r.plot(a, type="p", main=title, xlab=xlab, ylab=ylab, col="blue", pch=19) r.dev_off() except Exception as exc: - stop_err( "%s" % str( exc ) ) + stop_err("%s" % str(exc)) else: - stop_err( "All values in both columns %s and %s are non-numeric or empty." % ( sys.argv[3], sys.argv[4] ) ) + stop_err( + "All values in both columns %s and %s are non-numeric or empty." + % (sys.argv[3], sys.argv[4]) + ) - print("Scatter plot on columns %s, %s. " % ( sys.argv[3], sys.argv[4] )) + print("Scatter plot on columns %s, %s. " % (sys.argv[3], sys.argv[4])) if skipped_lines > 0: - print("Skipped %d lines starting with line #%d, value '%s' in column %d is not numeric." % ( skipped_lines, first_invalid_line, invalid_value, invalid_column )) + print( + "Skipped %d lines starting with line #%d, value '%s' in column %d is not numeric." + % (skipped_lines, first_invalid_line, invalid_value, invalid_column) + ) + if __name__ == "__main__": main() From dce77d4ea50493c8d1ad5a878081089776f2066d Mon Sep 17 00:00:00 2001 From: hechth Date: Mon, 3 Feb 2025 13:44:01 +0100 Subject: [PATCH 05/10] lint --- tools/scatterplot/scatterplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scatterplot/scatterplot.py b/tools/scatterplot/scatterplot.py index 55bec8c8..eb6905a2 100644 --- a/tools/scatterplot/scatterplot.py +++ b/tools/scatterplot/scatterplot.py @@ -5,8 +5,8 @@ import sys -from numpy import array import rpy2.rpy_classic as rpy +from numpy import array from rpy2.robjects.numpy2ri import numpy2ri From 7e7e6625b5fa1c5221b774a794bfe3e73f3a3022 Mon Sep 17 00:00:00 2001 From: hechth Date: Mon, 3 Feb 2025 14:32:02 +0100 Subject: [PATCH 06/10] added missing dependency --- tools/scatterplot/scatterplot.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/scatterplot/scatterplot.xml b/tools/scatterplot/scatterplot.xml index e824b769..3fe990ed 100644 --- a/tools/scatterplot/scatterplot.xml +++ b/tools/scatterplot/scatterplot.xml @@ -3,6 +3,7 @@ numpy rpy2 + libgfortran Date: Tue, 4 Feb 2025 10:58:30 +0100 Subject: [PATCH 07/10] fixed bug introduced through changing import order --- tools/scatterplot/scatterplot.py | 2 +- tools/scatterplot/scatterplot.xml | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/scatterplot/scatterplot.py b/tools/scatterplot/scatterplot.py index eb6905a2..55bec8c8 100644 --- a/tools/scatterplot/scatterplot.py +++ b/tools/scatterplot/scatterplot.py @@ -5,8 +5,8 @@ import sys -import rpy2.rpy_classic as rpy from numpy import array +import rpy2.rpy_classic as rpy from rpy2.robjects.numpy2ri import numpy2ri diff --git a/tools/scatterplot/scatterplot.xml b/tools/scatterplot/scatterplot.xml index 3fe990ed..96257194 100644 --- a/tools/scatterplot/scatterplot.xml +++ b/tools/scatterplot/scatterplot.xml @@ -5,6 +5,11 @@ rpy2 libgfortran + + - - + + + + + + + + + + + + + + + From d372edf16a176591e6b822a7e0cbb792e58276e4 Mon Sep 17 00:00:00 2001 From: hechth Date: Tue, 4 Feb 2025 12:56:30 +0100 Subject: [PATCH 08/10] skip linting for this --- tools/scatterplot/scatterplot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/scatterplot/scatterplot.py b/tools/scatterplot/scatterplot.py index 55bec8c8..07882ebd 100644 --- a/tools/scatterplot/scatterplot.py +++ b/tools/scatterplot/scatterplot.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # Greg Von Kuster +# pylint: skip-file + from __future__ import print_function import sys From 91ca2de56b185d14edaa992045c5e15c08566cab Mon Sep 17 00:00:00 2001 From: hechth Date: Tue, 4 Feb 2025 13:05:39 +0100 Subject: [PATCH 09/10] ignore import error, hopefully --- tools/scatterplot/scatterplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scatterplot/scatterplot.py b/tools/scatterplot/scatterplot.py index 07882ebd..fa11f7e3 100644 --- a/tools/scatterplot/scatterplot.py +++ b/tools/scatterplot/scatterplot.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Greg Von Kuster -# pylint: skip-file +# noqa: I100 from __future__ import print_function From 3bae6a71438bcafed0e7ba36e695ee080c5bcfca Mon Sep 17 00:00:00 2001 From: hechth Date: Tue, 4 Feb 2025 13:27:57 +0100 Subject: [PATCH 10/10] ignore lint next attempt --- tools/scatterplot/scatterplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scatterplot/scatterplot.py b/tools/scatterplot/scatterplot.py index fa11f7e3..17fa9035 100644 --- a/tools/scatterplot/scatterplot.py +++ b/tools/scatterplot/scatterplot.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Greg Von Kuster -# noqa: I100 +# flake8: noqa from __future__ import print_function