Skip to content

Commit

Permalink
division fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed Apr 30, 2024
1 parent 0bd3285 commit bd4064e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 9 additions & 3 deletions jcvi/formats/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys

from collections import OrderedDict
from itertools import groupby, islice, cycle
from itertools import cycle, groupby, islice

from Bio import SeqIO
from ..apps.base import (
Expand Down Expand Up @@ -337,7 +337,13 @@ def timestamp():
return "{0}{1:02d}{2:02d}".format(dt.now().year, dt.now().month, dt.now().day)


def must_open(filename, mode="r", checkexists=False, skipcheck=False, oappend=False):
def must_open(
filename: str,
mode: str = "r",
checkexists: bool = False,
skipcheck: bool = False,
oappend: bool = False,
):
"""
Accepts filename and returns filehandle.
Expand Down Expand Up @@ -385,7 +391,7 @@ def must_open(filename, mode="r", checkexists=False, skipcheck=False, oappend=Fa

elif filename.endswith(".bz2"):
if "r" in mode:
cmd = "bzcat {0}".format(filename)
cmd = f"bzcat {filename}"
fp = popen(cmd, debug=False)
elif "w" in mode:
import bz2
Expand Down
2 changes: 1 addition & 1 deletion jcvi/formats/bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def gffline(self, type="match", source="default"):
score,
strand,
".",
"ID=" + self.accn,
f"ID={self.accn}",
)
)
return row
Expand Down
6 changes: 3 additions & 3 deletions jcvi/graphics/landscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def linearray(binfile, chr, window, shift):
m, n = zip(*mn)

m = np.array(m, dtype="float")
w = window / shift
w = window // shift
m = moving_sum(m, window=w)
return m

Expand Down Expand Up @@ -883,7 +883,7 @@ def heatmap(args):

owindow = clen / 100
if owindow > window:
window = owindow / shift * shift
window = owindow // shift * shift

stackplot(ax, stackbins, nbins, palette, chr, window, shift)
ax.text(
Expand Down Expand Up @@ -958,7 +958,7 @@ def draw_gauge(ax, margin, maxl, rightmargin=None):
ax.plot([margin, 1 - rightmargin], [1 - margin, 1 - margin], "k-", lw=2)

best_stride = autoscale(maxl)
nintervals = maxl * 1.0 / best_stride
nintervals = maxl / best_stride

xx, yy = margin, 1 - margin
tip = 0.005
Expand Down

0 comments on commit bd4064e

Please sign in to comment.