[med-svn] [Git][med-team/last-align][master] 2 commits: Use 2to3 to port to Python3

Andreas Tille gitlab at salsa.debian.org
Fri Nov 22 10:26:56 GMT 2019



Andreas Tille pushed to branch master at Debian Med / last-align


Commits:
9173bbfc by Andreas Tille at 2019-11-22T10:24:26Z
Use 2to3 to port to Python3

- - - - -
ea4b2c18 by Andreas Tille at 2019-11-22T10:26:06Z
Packaging metadata adapted to Python3

- - - - -


4 changed files:

- debian/changelog
- debian/control
- + debian/patches/2to3.patch
- + debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+last-align (984-2) UNRELEASED; urgency=medium
+
+  * Use 2to3 to port to Python3
+    Closes: #943148, #943446
+
+ -- Andreas Tille <tille at debian.org>  Fri, 22 Nov 2019 11:23:44 +0100
+
 last-align (984-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -6,7 +6,7 @@ Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 12),
                help2man,
-               python-pil,
+               python3-pil,
                zlib1g-dev
 Standards-Version: 4.4.0
 Vcs-Browser: https://salsa.debian.org/med-team/last-align
@@ -18,8 +18,8 @@ Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends},
          parallel
-Recommends: python,
-            python-pil
+Recommends: python3,
+            python3-pil
 Description: genome-scale comparison of biological sequences
  LAST is software for comparing and aligning sequences, typically DNA or
  protein sequences. LAST is similar to BLAST, but it copes better with very


=====================================
debian/patches/2to3.patch
=====================================
@@ -0,0 +1,242 @@
+diff --git a/scripts/last-dotplot b/scripts/last-dotplot
+index 441cbad..c5199f0 100755
+--- a/scripts/last-dotplot
++++ b/scripts/last-dotplot
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ 
+ # Read pair-wise alignments in MAF or LAST tabular format: write an
+ # "Oxford grid", a.k.a. dotplot.
+@@ -262,12 +262,12 @@ def mergedRanges(ranges):
+     yield oldBeg, maxEnd
+ 
+ def mergedRangesPerSeq(coverDict):
+-    for k, v in coverDict.items():
++    for k, v in list(coverDict.items()):
+         v.sort()
+         yield k, list(mergedRanges(v))
+ 
+ def coveredLength(mergedCoverDict):
+-    return sum(sum(e - b for b, e in v) for v in mergedCoverDict.values())
++    return sum(sum(e - b for b, e in v) for v in list(mergedCoverDict.values()))
+ 
+ def trimmed(seqRanges, coverDict, minAlignedBases, maxGapFrac, endPad, midPad):
+     maxEndGapFrac, maxMidGapFrac = twoValuesFromOption(maxGapFrac, ",")
+@@ -308,7 +308,7 @@ def rangesWithStrandInfo(seqRanges, strandOpt, alignments, seqIndex):
+ def natural_sort_key(my_string):
+     '''Return a sort key for "natural" ordering, e.g. chr9 < chr10.'''
+     parts = re.split(r'(\d+)', my_string)
+-    parts[1::2] = map(int, parts[1::2])
++    parts[1::2] = list(map(int, parts[1::2]))
+     return parts
+ 
+ def nameKey(oneSeqRanges):
+@@ -577,7 +577,7 @@ def drawJoins(im, alignments, bpPerPix, seqIndex, rangeDict1, rangeDict2):
+ def expandedSeqDict(seqDict):
+     '''Allow lookup by short sequence names, e.g. chr7 as well as hg19.chr7.'''
+     newDict = seqDict.copy()
+-    for name, x in seqDict.items():
++    for name, x in list(seqDict.items()):
+         if "." in name:
+             base = name.split(".")[-1]
+             if base in newDict:  # an ambiguous case was found:
+@@ -611,7 +611,7 @@ def readBed(fileName, rangeDict):
+         yield layer, color, seqName, beg, end
+ 
+ def commaSeparatedInts(text):
+-    return map(int, text.rstrip(",").split(","))
++    return list(map(int, text.rstrip(",").split(",")))
+ 
+ def readGenePred(opts, fileName, rangeDict):
+     for line in myOpen(fileName):
+diff --git a/scripts/last-map-probs b/scripts/last-map-probs
+index b05a362..0d133e2 100755
+--- a/scripts/last-map-probs
++++ b/scripts/last-map-probs
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ 
+ # Copyright 2010, 2011, 2012, 2014 Martin C. Frith
+ 
+@@ -7,7 +7,7 @@
+ # probabilities make the risky assumption that one of the alignments
+ # reported for each query is correct.
+ 
+-from __future__ import print_function
++
+ 
+ import gzip
+ import sys, os, math, optparse, signal
+diff --git a/scripts/last-postmask b/scripts/last-postmask
+index 6ce29a2..eb6d23e 100755
+--- a/scripts/last-postmask
++++ b/scripts/last-postmask
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ 
+ # Copyright 2014 Martin C. Frith
+ 
+@@ -12,7 +12,7 @@
+ # Limitations: doesn't (yet) handle sequence quality data,
+ # frameshifts, or generalized affine gaps.
+ 
+-from __future__ import print_function
++
+ 
+ import gzip
+ import optparse, os, signal, sys
+@@ -37,7 +37,7 @@ def complement(base):
+ 
+ def fastScoreMatrix(rowHeads, colHeads, matrix, deleteCost, insertCost):
+     matrixLen = 128
+-    defaultScore = min(map(min, matrix))
++    defaultScore = min(list(map(min, matrix)))
+     fastMatrix = [[defaultScore for i in range(matrixLen)]
+                   for j in range(matrixLen)]
+     for i, x in enumerate(rowHeads):
+@@ -111,7 +111,7 @@ def doOneFile(lines):
+                     if i.startswith("B="): bIns = int(i[2:])
+                     if i.startswith("e="): minScore = int(i[2:])
+                     if i.startswith("S="): strandParam = int(i[2:])
+-                if nf > 1 and max(map(len, fields)) == 1:
++                if nf > 1 and max(list(map(len, fields))) == 1:
+                     colHeads = fields[1:]
+             elif nf == len(colHeads) + 2 and len(fields[1]) == 1:
+                 rowHeads.append(fields[1])
+diff --git a/scripts/last-train b/scripts/last-train
+index 70f71e4..7fd0508 100755
+--- a/scripts/last-train
++++ b/scripts/last-train
+@@ -1,7 +1,7 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ # Copyright 2015 Martin C. Frith
+ 
+-from __future__ import print_function
++
+ 
+ import gzip
+ import math, optparse, os, random, signal, subprocess, sys, tempfile
+@@ -215,7 +215,7 @@ def writeMatrixWithLetters(outFile, matrix, prefix):
+     writeMatrixBody(outFile, prefix, left, body, "%6s")
+ 
+ def matProbsFromCounts(counts, opts):
+-    r = range(len(counts))
++    r = list(range(len(counts)))
+     if opts.revsym:  # add complement (reverse strand) substitutions
+         counts = [[counts[i][j] + counts[-1-i][-1-j] for j in r] for i in r]
+     if opts.matsym:  # symmetrize the substitution matrix
+diff --git a/scripts/maf-convert b/scripts/maf-convert
+index 3225b6d..ac1c895 100755
+--- a/scripts/maf-convert
++++ b/scripts/maf-convert
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ # Copyright 2010, 2011, 2013, 2014 Martin C. Frith
+ # Read MAF-format alignments: write them in other formats.
+ # Seems to work with Python 2.x, x>=6
+@@ -6,7 +6,7 @@
+ # By "MAF" we mean "multiple alignment format" described in the UCSC
+ # Genome FAQ, not e.g. "MIRA assembly format".
+ 
+-from __future__ import print_function
++
+ 
+ from itertools import *
+ import gzip
+diff --git a/scripts/maf-cut b/scripts/maf-cut
+index 9b9aa69..f21b036 100755
+--- a/scripts/maf-cut
++++ b/scripts/maf-cut
+@@ -1,6 +1,6 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
++
+ 
+-from __future__ import print_function
+ 
+ import gzip
+ import itertools
+@@ -70,12 +70,12 @@ def cutMafRecords(mafLines, alnBeg, alnEnd):
+ 
+ def mafFieldWidths(mafRecords):
+     sRecords = (i for i in mafRecords if i[0] == "s")
+-    sColumns = zip(*sRecords)
++    sColumns = list(zip(*sRecords))
+     for i in sColumns:
+-        yield max(map(len, i))
++        yield max(list(map(len, i)))
+ 
+ def printMafLine(fieldWidths, fields):
+-    formatParams = itertools.chain.from_iterable(zip(fieldWidths, fields))
++    formatParams = itertools.chain.from_iterable(list(zip(fieldWidths, fields)))
+     print("%*s %-*s %*s %*s %*s %*s %*s" % tuple(formatParams))
+ 
+ def cutOneMaf(cutRange, mafLines):
+diff --git a/scripts/maf-join b/scripts/maf-join
+index 49afca8..d3162a9 100755
+--- a/scripts/maf-join
++++ b/scripts/maf-join
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ 
+ # Copyright 2009, 2010, 2011 Martin C. Frith
+ 
+@@ -10,7 +10,7 @@
+ # WARNING: Alignment columns with a gap in the top genome are joined
+ # arbitrarily!!!
+ 
+-from __future__ import print_function
++
+ 
+ import functools
+ import sys, os, fileinput, optparse, signal
+@@ -229,7 +229,7 @@ def nextWindow(window, theInput, referenceMaf):
+         while True:
+             maf = theInput.peek()
+             if maf.after(referenceMaf): break
+-            maf = theInput.next()
++            maf = next(theInput)
+             if not maf.before(referenceMaf): yield maf
+     except StopIteration: pass
+ 
+diff --git a/scripts/maf-swap b/scripts/maf-swap
+index f009b26..9b3c930 100755
+--- a/scripts/maf-swap
++++ b/scripts/maf-swap
+@@ -1,4 +1,4 @@
+-#! /usr/bin/env python
++#!/usr/bin/python3
+ 
+ # Read MAF-format alignments, and write them, after moving the Nth
+ # sequence to the top in each alignment.
+@@ -7,7 +7,7 @@
+ # flip all the strands.  But don't do this if the top sequence is
+ # translated DNA.
+ 
+-from __future__ import print_function
++
+ 
+ import gzip
+ import itertools
+@@ -69,12 +69,12 @@ def flippedMafRecords(mafLines):
+ 
+ def sLineFieldWidths(mafLines):
+     sLines = (i for i in mafLines if i[0] == "s")
+-    sColumns = zip(*sLines)
++    sColumns = list(zip(*sLines))
+     for i in sColumns:
+-        yield max(map(len, i))
++        yield max(list(map(len, i)))
+ 
+ def joinedMafS(fieldWidths, words):
+-    formatParams = itertools.chain.from_iterable(zip(fieldWidths, words))
++    formatParams = itertools.chain.from_iterable(list(zip(fieldWidths, words)))
+     return "%*s %-*s %*s %*s %*s %*s %*s\n" % tuple(formatParams)
+ 
+ def joinedMafLine(words, fieldWidths):


=====================================
debian/patches/series
=====================================
@@ -0,0 +1 @@
+2to3.patch



View it on GitLab: https://salsa.debian.org/med-team/last-align/compare/093a59614214e88597c78ac37bb8b44c767e3072...ea4b2c1824e636d60b4d7ad73c420144a2edb2a2

-- 
View it on GitLab: https://salsa.debian.org/med-team/last-align/compare/093a59614214e88597c78ac37bb8b44c767e3072...ea4b2c1824e636d60b4d7ad73c420144a2edb2a2
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/20191122/1c2a4a72/attachment-0001.html>


More information about the debian-med-commit mailing list