Skip to content

Commit 9847cd1

Browse files
committed
fix deprecation warnings and adapt code to matplotlib 3.5.0
1 parent 70cc11d commit 9847cd1

6 files changed

Lines changed: 10 additions & 9 deletions

File tree

hicstuff/digest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ def frag_len(
401401
ax.set_xlabel("Fragment length [bp]")
402402
ax.set_ylabel("Log10 number of fragments")
403403
ax.set_title("Distribution of restriction fragment length")
404-
ax.set_yscale("log", basey=10)
404+
ax.set_yscale("log", base=10)
405405
ax.annotate(
406406
"Total fragments: {}".format(nfrags),
407407
xy=(0.95, 0.95),

hicstuff/distance_law.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def logbins_xs(fragments, chr_segment_length, base=1.1, circular=False):
255255
# For each chromosome/arm compute a logspace to have the logbin
256256
# equivalent to the size of the arms and increasing size of bins
257257
xs[i] = np.unique(
258-
np.logspace(0, n_bins, num=n_bins + 1, base=base, dtype=np.int)
258+
np.logspace(0, n_bins, num=n_bins + 1, base=base, dtype=int)
259259
)
260260
return xs
261261

@@ -787,7 +787,7 @@ def plot_ps_slope(xs, ps, labels, fig_path=None, inf=3000, sup=None):
787787
for i in range(len(slope)):
788788
xs2[i] = xs[i][:-1]
789789
col = next(cols)
790-
ax2.semilogx(xs2[i], slope[i], label=labels[i], subsx=[2, 3, 4, 5, 6, 7, 8, 9])
790+
ax2.semilogx(xs2[i], slope[i], label=labels[i], subs=[2, 3, 4, 5, 6, 7, 8, 9])
791791
ax2.legend(loc="upper left", bbox_to_anchor=(1.02, 1.00), ncol=1, fontsize="large")
792792
# Save the figure in svg
793793
if fig_path is not None:

hicstuff/hicstuff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def distance_law_from_mat(matrix, indices=None, log_bins=True, base=1.1):
8989
else:
9090
n_bins = int(np.log(n) / np.log(base) + 1)
9191
logbin = np.unique(
92-
np.logspace(0, n_bins - 1, num=n_bins, base=base, dtype=np.int)
92+
np.logspace(0, n_bins - 1, num=n_bins, base=base, dtype=int)
9393
)
9494
logbin = np.insert(logbin, 0, 0)
9595
logbin[-1] = min(n, logbin[-1])
@@ -512,7 +512,7 @@ def mad(M, axis=None):
512512
else:
513513
if axis < 0:
514514
axis += 2
515-
dist = np.array(M.sum(axis=axis, dtype=np.float)).flatten()
515+
dist = np.array(M.sum(axis=axis, dtype=float)).flatten()
516516

517517
return np.median(np.absolute(dist - np.median(dist)))
518518

hicstuff/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ def flexible_hic_loader(
910910
# Guess if bin size is fixed based on MAD
911911
bg2 = pd.read_csv(mat, sep="\t")
912912
sizes = np.array(bg2.iloc[:, 2] - bg2.iloc[:, 1])
913-
size_mad = ss.median_absolute_deviation(sizes)
913+
size_mad = ss.median_abs_deviation(sizes, scale='normal')
914914
# Use only the bg2
915915
if size_mad > 0:
916916
mat, frags, chroms = load_bedgraph2d(mat)

tests/test_distance_law.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ def test_logbins_xs():
8181
xs = hcdl.logbins_xs(fragments, [60000, 20000])
8282
assert len(xs) == 2
8383
assert np.all(
84-
xs[0] == np.unique(np.logspace(0, 115, num=116, base=1.1, dtype=np.int))
84+
xs[0] == np.unique(np.logspace(0, 115, num=116, base=1.1, dtype=int))
8585
)
8686
# Test changing base.
8787
xs = hcdl.logbins_xs(fragments, [60000, 20000], base=1.5)
8888
assert np.all(
89-
xs[0] == np.unique(np.logspace(0, 27, num=28, base=1.5, dtype=np.int))
89+
xs[0] == np.unique(np.logspace(0, 27, num=28, base=1.5, dtype=int))
9090
)
9191
# Test with the circular option.
9292
xs = hcdl.logbins_xs(fragments, [60000, 20000], circular=True)
9393
assert np.all(
94-
xs[0] == np.unique(np.logspace(0, 108, num=109, base=1.1, dtype=np.int))
94+
xs[0] == np.unique(np.logspace(0, 108, num=109, base=1.1, dtype=int))
9595
)
9696

9797

tests/test_pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def test_full_pipeline_bin(mapping, aligner):
123123
distance_law=True,
124124
start_stage=stage,
125125
mat_fmt="cooler",
126+
no_cleanup=True,
126127
force=True,
127128
)
128129
shutil.rmtree("test_out2/")

0 commit comments

Comments
 (0)