Fix gz reading for Python3
authorMartin C. Frith
Mon Oct 29 08:23:59 2018 +0900 (2018-10-29)
changeset 957c54672c8892e
parent 956 83191e47259e
child 958 96b45da7bf0f
Fix gz reading for Python3
scripts/last-dotplot
scripts/last-map-probs
scripts/last-postmask
scripts/last-train
scripts/maf-convert
scripts/maf-cut
scripts/maf-swap
     1.1 --- a/scripts/last-dotplot	Mon Sep 10 20:12:26 2018 +0900
     1.2 +++ b/scripts/last-dotplot	Mon Oct 29 08:23:59 2018 +0900
     1.3 @@ -34,7 +34,7 @@
     1.4      if fileName == "-":
     1.5          return sys.stdin
     1.6      if fileName.endswith(".gz"):
     1.7 -        return gzip.open(fileName)
     1.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     1.9      return open(fileName)
    1.10  
    1.11  def warn(message):
     2.1 --- a/scripts/last-map-probs	Mon Sep 10 20:12:26 2018 +0900
     2.2 +++ b/scripts/last-map-probs	Mon Oct 29 08:23:59 2018 +0900
     2.3 @@ -16,7 +16,7 @@
     2.4      if fileName == "-":
     2.5          return sys.stdin
     2.6      if fileName.endswith(".gz"):
     2.7 -        return gzip.open(fileName)
     2.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     2.9      return open(fileName)
    2.10  
    2.11  def logsum(numbers):
     3.1 --- a/scripts/last-postmask	Mon Sep 10 20:12:26 2018 +0900
     3.2 +++ b/scripts/last-postmask	Mon Oct 29 08:23:59 2018 +0900
     3.3 @@ -26,7 +26,7 @@
     3.4      if fileName == "-":
     3.5          return sys.stdin
     3.6      if fileName.endswith(".gz"):
     3.7 -        return gzip.open(fileName)
     3.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     3.9      return open(fileName)
    3.10  
    3.11  def complement(base):
     4.1 --- a/scripts/last-train	Mon Sep 10 20:12:26 2018 +0900
     4.2 +++ b/scripts/last-train	Mon Oct 29 08:23:59 2018 +0900
     4.3 @@ -10,7 +10,7 @@
     4.4      if fileName == "-":
     4.5          return sys.stdin
     4.6      if fileName.endswith(".gz"):
     4.7 -        return gzip.open(fileName)
     4.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     4.9      return open(fileName)
    4.10  
    4.11  def randomSample(things, sampleSize):
     5.1 --- a/scripts/maf-convert	Mon Sep 10 20:12:26 2018 +0900
     5.2 +++ b/scripts/maf-convert	Mon Oct 29 08:23:59 2018 +0900
     5.3 @@ -21,7 +21,7 @@
     5.4      if fileName == "-":
     5.5          return sys.stdin
     5.6      if fileName.endswith(".gz"):
     5.7 -        return gzip.open(fileName)
     5.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     5.9      return open(fileName)
    5.10  
    5.11  def maxlen(s):
     6.1 --- a/scripts/maf-cut	Mon Sep 10 20:12:26 2018 +0900
     6.2 +++ b/scripts/maf-cut	Mon Oct 29 08:23:59 2018 +0900
     6.3 @@ -12,7 +12,7 @@
     6.4      if fileName == "-":
     6.5          return sys.stdin
     6.6      if fileName.endswith(".gz"):
     6.7 -        return gzip.open(fileName)
     6.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     6.9      return open(fileName)
    6.10  
    6.11  def alnBegFromSeqBeg(gappedSequence, seqBeg):
     7.1 --- a/scripts/maf-swap	Mon Sep 10 20:12:26 2018 +0900
     7.2 +++ b/scripts/maf-swap	Mon Oct 29 08:23:59 2018 +0900
     7.3 @@ -25,7 +25,7 @@
     7.4      if fileName == "-":
     7.5          return sys.stdin
     7.6      if fileName.endswith(".gz"):
     7.7 -        return gzip.open(fileName)
     7.8 +        return gzip.open(fileName, "rt")  # xxx dubious for Python2
     7.9      return open(fileName)
    7.10  
    7.11  def indexOfNthSequence(mafLines, n):