[med-svn] [Git][med-team/adapterremoval][master] 5 commits: Convert benchmark scripts from Python2 to Python3 using 2to3 even if not used in package

Andreas Tille gitlab at salsa.debian.org
Sun Dec 15 14:51:07 GMT 2019



Andreas Tille pushed to branch master at Debian Med / adapterremoval


Commits:
a277e55e by Andreas Tille at 2019-12-15T14:16:36Z
Convert benchmark scripts from Python2 to Python3 using 2to3 even if not used in package

- - - - -
9d2f2770 by Andreas Tille at 2019-12-15T14:21:14Z
routine-update: Standards-Version: 4.4.1

- - - - -
8e8982f9 by Andreas Tille at 2019-12-15T14:21:14Z
R-U: autopkgtest: s/ADTTMP/AUTOPKGTEST_TMP/g

- - - - -
fdd17356 by Andreas Tille at 2019-12-15T14:21:20Z
Set upstream metadata fields: Bug-Database, Repository, Repository-Browse.
- - - - -
bb4d0b2f by Andreas Tille at 2019-12-15T14:24:50Z
routine-update: Ready to upload to unstable

- - - - -


6 changed files:

- debian/changelog
- debian/control
- + debian/patches/2to3.patch
- debian/patches/series
- debian/tests/run-unit-test
- debian/upstream/metadata


Changes:

=====================================
debian/changelog
=====================================
@@ -1,8 +1,15 @@
-adapterremoval (2.3.1-2) UNRELEASED; urgency=medium
+adapterremoval (2.3.1-2) unstable; urgency=medium
 
   * Build-Depends: markdown instead of python-markdown
-
- -- Andreas Tille <tille at debian.org>  Mon, 02 Sep 2019 08:59:12 +0200
+    Closes: #942927
+  * Convert benchmark scripts from Python2 to Python3 using 2to3 even
+    if not used in package
+  * Standards-Version: 4.4.1
+  * autopkgtest: s/ADTTMP/AUTOPKGTEST_TMP/g
+  * Set upstream metadata fields: Bug-Database, Repository, Repository-
+    Browse.
+
+ -- Andreas Tille <tille at debian.org>  Sun, 15 Dec 2019 15:21:21 +0100
 
 adapterremoval (2.3.1-1) unstable; urgency=medium
 


=====================================
debian/control
=====================================
@@ -9,7 +9,7 @@ Build-Depends: debhelper-compat (= 12),
                libbz2-dev,
                libgtest-dev,
                markdown
-Standards-Version: 4.4.0
+Standards-Version: 4.4.1
 Vcs-Browser: https://salsa.debian.org/med-team/adapterremoval
 Vcs-Git: https://salsa.debian.org/med-team/adapterremoval.git
 Homepage: https://github.com/MikkelSchubert/adapterremoval
@@ -46,7 +46,7 @@ Description: rapid adapter trimming, identification, and read merging (example d
 #Package: adapter-benchmark
 #Architecture: all
 #Depends: ${misc:Depends},
-#         python,
+#         python3,
 #         adapterremoval,
 #         cutadapt,
 #         ea-utils,


=====================================
debian/patches/2to3.patch
=====================================
@@ -0,0 +1,320 @@
+Description: Convert benchmark scripts from Python2 to Python3 using 2to3 even if not used in package
+Bug-Debian: https://bugs.debian.org/942927
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Sun, 15 Dec 2019 15:12:53 +0100
+
+--- a/benchmark/benchmark.sh
++++ b/benchmark/benchmark.sh
+@@ -194,7 +194,7 @@ function shuffle_and_run()
+     echo > /dev/stderr
+     echo "Shuffling batch ..." > /dev/stderr
+ 
+-    python -c "import sys, random
++    python3 -c "import sys, random
+ lines = sys.stdin.readlines()
+ random.shuffle(lines)
+ sys.stdout.write(''.join(lines))" |
+--- a/benchmark/scripts/evaluate.py
++++ b/benchmark/scripts/evaluate.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -131,10 +131,10 @@ class Summary(object):
+ def missing_reads(expectations, se_mode):
+     if se_mode:
+         reads = [(key, [pair[0], None])
+-                 for key, pair in expectations.iteritems()
++                 for key, pair in expectations.items()
+                  if pair[0] is not None]
+     else:
+-        reads = [(key, pair) for key, pair in expectations.iteritems()
++        reads = [(key, pair) for key, pair in expectations.items()
+                  if pair != [None, None]]
+ 
+     max_errors = 0
+@@ -238,7 +238,7 @@ def evaluate(args, expectations, trimmed
+         eval_func(args, expectations, stat, record)
+ 
+     if args.dimers_are_discarded:
+-        for key, pair in expectations.items():
++        for key, pair in list(expectations.items()):
+             if args.read_mode in ("SE", "MIXED_SE"):
+                 pair[1] = None
+ 
+@@ -313,7 +313,7 @@ def read_expected_lengths(args):
+     results = collections.defaultdict(lambda: [None, None])
+     for line in open_ro(args.read_info):
+         if line.startswith("@"):
+-            record = dict(zip(header, line.rstrip().split('\t')))
++            record = dict(list(zip(header, line.rstrip().split('\t'))))
+ 
+             name = record["readId"][1:]
+             name, mate = name.split("/")
+--- a/benchmark/scripts/evaluate_dmux.py
++++ b/benchmark/scripts/evaluate_dmux.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -54,7 +54,7 @@ def read_barcodes(filename):
+     results = {}
+     for line in open_ro(filename):
+         if line.startswith("@"):
+-            record = dict(zip(header, line.rstrip().split('\t')))
++            record = dict(list(zip(header, line.rstrip().split('\t'))))
+ 
+             name = record["readId"].split("/")[0]
+             results[name] = "_".join((record["barcode_1"], record["barcode_2"]))
+@@ -90,7 +90,7 @@ def main(argv):
+                 if expectations[name] == barcode:
+                     correct += 1
+                 else:
+-                    print expectations[name], barcode
++                    print(expectations[name], barcode)
+                 total += 1
+ 
+                 handle.readline()
+@@ -98,7 +98,7 @@ def main(argv):
+                 handle.readline()
+                 header = handle.readline()
+ 
+-    print total, correct
++    print(total, correct)
+ 
+     return 0
+ 
+--- a/benchmark/scripts/evaluate_id.py
++++ b/benchmark/scripts/evaluate_id.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -56,7 +56,7 @@ class evalulate_minion(object):
+     def __call__(self, readlen, insert_mean, replicate, fpath):
+         prefix = os.path.join(fpath, "mate")
+ 
+-        for method, result in self._parse_report_minion(prefix).items():
++        for method, result in list(self._parse_report_minion(prefix).items()):
+             self._results[(readlen, insert_mean, method)][replicate] = result
+ 
+     def finalize(self):
+@@ -88,7 +88,7 @@ class evalulate_minion(object):
+                         results.append(result)
+                         result = {}
+                 else:
+-                    key, value = map(str.strip, line.split("=", 1))
++                    key, value = list(map(str.strip, line.split("=", 1)))
+                     result[key] = value
+ 
+             if result:
+@@ -132,13 +132,13 @@ class evalulate_adapterrm(object):
+ def print_rows(program, results):
+     rows = []
+     for (readlen, insert_mean, method), replicates in sorted(results.items()):
+-        mean_pcr1 = numpy.mean([repl["PCR1"] for repl in replicates.values()])
+-        mean_pcr2 = numpy.mean([repl["PCR2"] for repl in replicates.values()])
++        mean_pcr1 = numpy.mean([repl["PCR1"] for repl in list(replicates.values())])
++        mean_pcr2 = numpy.mean([repl["PCR2"] for repl in list(replicates.values())])
+ 
+         rows.append((method, readlen, insert_mean, mean_pcr1, mean_pcr2))
+ 
+     for row in sorted(rows):
+-        print "\t".join(map(str, row))
++        print("\t".join(map(str, row)))
+ 
+ 
+ def main(argv):
+@@ -149,14 +149,14 @@ def main(argv):
+     }
+ 
+     for run in os.listdir(args.root):
+-        readlen, insert_mean, replicate = map(int, run.split("_"))
++        readlen, insert_mean, replicate = list(map(int, run.split("_")))
+ 
+         for program in os.listdir(os.path.join(args.root, run)):
+             if program in eval_funcs:
+                 fpath = os.path.join(args.root, run, program)
+                 eval_funcs[program](readlen, insert_mean, replicate, fpath)
+ 
+-    print "\t".join(("Method", "ReadLen", "InsertMean", "PCR1", "PCR2"))
++    print("\t".join(("Method", "ReadLen", "InsertMean", "PCR1", "PCR2")))
+     for program, func in sorted(eval_funcs.items()):
+         print_rows(program, func.finalize())
+ 
+--- a/benchmark/scripts/extend_profile.py
++++ b/benchmark/scripts/extend_profile.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -84,13 +84,13 @@ def main(argv):
+                 elif not line_s or line_s.startswith("#") or line_s == "<<END":
+                     if rows:
+                         for row in sorted(rows):
+-                            print "\t".join(map(str, row))
++                            print("\t".join(map(str, row)))
+                     rows = []
+                     in_table = False
+                     in_table_header = None
+                 else:
+-                    row = dict(zip(in_table_header,
+-                                   map(try_cast, line_s.split('\t'))))
++                    row = dict(list(zip(in_table_header,
++                                   list(map(try_cast, line_s.split('\t'))))))
+                     row["Cycle"] = row["Cycle"] * 2
+                     rows.append(tuple(row[key] for key in in_table_header))
+                     row["Cycle"] = row["Cycle"] - 1
+@@ -99,10 +99,10 @@ def main(argv):
+             elif line.startswith("["):
+                 in_table = True
+ 
+-            print line,
++            print(line, end=' ')
+ 
+         for row in sorted(rows):
+-            print "\t".join(map(str, row))
++            print("\t".join(map(str, row)))
+ 
+     return 0
+ 
+--- a/benchmark/scripts/merge_tables.py
++++ b/benchmark/scripts/merge_tables.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -58,18 +58,18 @@ def main(argv):
+                         assert False, fpath
+ 
+                 for line in handle:
+-                    rows.append(dict(zip(header, line.rstrip().split('\t'))))
++                    rows.append(dict(list(zip(header, line.rstrip().split('\t')))))
+                     rows[-1]["Nth"] = str(int(replicate))  # Strip leading zeros
+                     rows[-1]["ReadLen"] = readlen
+ 
+     keys.insert(0, "Nth")
+     keys.insert(0, "ReadLen")
+-    print "\t".join(keys)
++    print("\t".join(keys))
+     rows = ["\t".join(row.get(key, "NA") for key in keys) for row in rows]
+     rows.sort()
+ 
+     for row in rows:
+-        print row
++        print(row)
+ 
+     return 0
+ 
+--- a/benchmark/scripts/shuffle_fasta.py
++++ b/benchmark/scripts/shuffle_fasta.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -55,15 +55,15 @@ def shuffle(rng, seq):
+ def main(argv):
+     args = parse_args(argv)
+     if args.seed is None:
+-        args.seed = random.randint(0, sys.maxint)
++        args.seed = random.randint(0, sys.maxsize)
+     rng = random.Random(args.seed)
+     name, sequence = read_fasta(args.file)
+ 
+-    print "Seed =", args.seed
+-    print "Seq  =", sequence
++    print("Seed =", args.seed)
++    print("Seq  =", sequence)
+ 
+-    for _ in xrange(args.replicates - 1):
+-        print "New  =", shuffle(rng, sequence)
++    for _ in range(args.replicates - 1):
++        print("New  =", shuffle(rng, sequence))
+ 
+     return 0
+ 
+--- a/benchmark/scripts/tabulate.py
++++ b/benchmark/scripts/tabulate.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2014 Mikkel Schubert <MikkelSch at gmail.com>
+ #
+@@ -43,7 +43,7 @@ def read_table(fpath, filter_func):
+         for line in handle:
+             fields = line.rstrip().split("\t")
+             assert len(fields) == len(header), (header, fields)
+-            row = dict(zip(header, fields))
++            row = dict(list(zip(header, fields)))
+ 
+             name = row["Name"]
+             if name.endswith("_gz") or name.endswith("_bz2"):
+@@ -90,17 +90,17 @@ def _collapse_basic(rows):
+ 
+         subdd[key_nth] = row
+ 
+-    for key, values in results.iteritems():
++    for key, values in results.items():
+         assert len(values) == max_nth and max(values) == max_nth, values
+ 
+     collapsed_rows = []
+     value_keys = ("SEN", "SPC", "PPV", "NPV", "MCC", "Rate")
+-    for rows in results.itervalues():
++    for rows in results.values():
+         result = {}
+ 
+         for key in value_keys:
+-            if any((key in row) for row in rows.itervalues()):
+-                values = tuple(float(row[key]) for row in rows.itervalues())
++            if any((key in row) for row in rows.values()):
++                values = tuple(float(row[key]) for row in rows.values())
+                 result[key] = "%.3f" % (numpy.mean(values),)
+ 
+         for key in keys:
+@@ -138,17 +138,17 @@ def _collapse_throughput(rows):
+ 
+         subdd[key] = row["Rate"]
+ 
+-    for key, values in results.iteritems():
++    for key, values in results.items():
+         assert len(values) == max_nth and max(values) == max_nth, values
+ 
+     collapsed_rows = []
+     value_keys = tuple(sorted(rate_keys))
+-    for rows in results.itervalues():
++    for rows in results.values():
+         result = {}
+ 
+         for key in value_keys:
+-            if any((key in row) for row in rows.itervalues()):
+-                values = tuple(float(row[key]) for row in rows.itervalues())
++            if any((key in row) for row in rows.values()):
++                values = tuple(float(row[key]) for row in rows.values())
+                 result[key] = "%.1f" % (numpy.mean(values),)
+ 
+         for key in keys:
+@@ -193,9 +193,9 @@ def main(argv):
+     for row in sorted(rows):
+         output_rows.append(tuple(str(row.get(key, "NA")) for key in keys))
+ 
+-    print "\t".join(keys)
++    print("\t".join(keys))
+     for row in sorted(output_rows):
+-        print "\t".join(row)
++        print("\t".join(row))
+ 
+     return 0
+ 


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 adapt-benchmarking.patch
 reduce_benchmark_length.patch
 delete_adapterremoval1x_completely.patch
+2to3.patch


=====================================
debian/tests/run-unit-test
=====================================
@@ -1,10 +1,10 @@
 #!/bin/sh -e
 
 pkg=adapterremoval
-if [ "$ADTTMP" = "" ] ; then
-  ADTTMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
+if [ "$AUTOPKGTEST_TMP" = "" ] ; then
+  AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
 fi
-cd $ADTTMP
+cd $AUTOPKGTEST_TMP
 cp -a /usr/share/doc/${pkg}/examples/* .
 find . -name "*.gz" -exec gunzip \{\} \;
 


=====================================
debian/upstream/metadata
=====================================
@@ -1,8 +1,8 @@
 Reference:
   Author: Mikkel Schubert and Stinus Lindgreen and Ludovic Orlando
   Title: >
-   AdapterRemoval v2: rapid adapter trimming, identification,
-   and read merging
+    AdapterRemoval v2: rapid adapter trimming, identification,
+    and read merging
   Journal: BMC Research Notes
   Year: 2016
   Volume: 9
@@ -10,13 +10,16 @@ Reference:
   DOI: 10.1186/s13104-016-1900-2
   PMID: 26868221
   URL: |
-   http://bmcresnotes.biomedcentral.com/articles/10.1186/s13104-016-1900-2
+    http://bmcresnotes.biomedcentral.com/articles/10.1186/s13104-016-1900-2
   eprint: |
-   http://bmcresnotes.biomedcentral.com/track/pdf/10.1186/s13104-016-1900-2
+    http://bmcresnotes.biomedcentral.com/track/pdf/10.1186/s13104-016-1900-2
 Registry:
-  - Name: OMICtools
-    Entry: OMICS_01081
-  - Name: bio.tools
-    Entry: NA
-  - Name: SciCrunch
-    Entry: SCR_011834
+- Name: OMICtools
+  Entry: OMICS_01081
+- Name: bio.tools
+  Entry: NA
+- Name: SciCrunch
+  Entry: SCR_011834
+Bug-Database: https://github.com/MikkelSchubert/adapterremoval/issues
+Repository: https://github.com/MikkelSchubert/adapterremoval.git
+Repository-Browse: https://github.com/MikkelSchubert/adapterremoval



View it on GitLab: https://salsa.debian.org/med-team/adapterremoval/compare/66da507481041f1aa19da8222e1af44410f88820...bb4d0b2f8d10602a43ffe9dfb2d21dcbfcb5b525

-- 
View it on GitLab: https://salsa.debian.org/med-team/adapterremoval/compare/66da507481041f1aa19da8222e1af44410f88820...bb4d0b2f8d10602a43ffe9dfb2d21dcbfcb5b525
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191215/a67114d9/attachment-0001.html>


More information about the debian-med-commit mailing list