Skip to content

Commit a3cd3e6

Browse files
authored
Merge pull request #14 from KlugerLab/12-support-for-numpy-20
support for numpy 20
2 parents 1359bd8 + cc81683 commit a3cd3e6

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

gene_trajectory/extract_gene_trajectory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def extract_gene_trajectory(
136136
logger.warning(f"Early stop reached. {i - 1} gene trajectories were retrieved.")
137137
break
138138

139-
dist_to_origin[df.selected != other] = -np.infty
139+
dist_to_origin[df.selected != other] = -np.inf
140140

141141
seed_idx = np.argmax(dist_to_origin)
142142
logger.info(f'Generating trajectory from {gene_names[seed_idx]}')

gene_trajectory/gene_distance_shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def cal_ot_mat(
5656
else:
5757
pairs = gene_pairs
5858
npairs = len(gene_pairs)
59-
emd_mat = np.full((ngenes, ngenes), fill_value=np.NaN)
59+
emd_mat = np.full((ngenes, ngenes), fill_value=np.nan)
6060

6161
with SharedMemoryManager() as manager:
6262
start_time = time.perf_counter()

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
44

55
[project]
66
name = "gene-trajectory"
7-
version = "1.0.3"
7+
version = "1.0.4"
88
description = "Compute gene trajectories"
99
license = {file = "LICENSE"}
1010
readme = "README.md"
@@ -30,7 +30,7 @@ requires-python = ">=3.9"
3030
dependencies = [
3131
"igraph>=0.10",
3232
"matplotlib>=3.6",
33-
"numpy>=1.23",
33+
"numpy>=1.25",
3434
"pandas>=1.5",
3535
"pot>=0.8.2",
3636
"scanpy>=1.9.3",

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
igraph>=0.10
22
matplotlib>=3.6
3-
numpy>=1.23
3+
numpy>=1.25
44
pandas>=1.5
55
pot>=0.8.2
66
scanpy>=1.9.3

tests/test_gene_distance_shared.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ def test_gene_distance_shared(self):
2929
np.testing.assert_almost_equal(self.expected_emd, mt, 6)
3030

3131
def test_gene_distance_input_validation(self):
32-
with self.assertRaisesRegexp(ValueError, 'Cost Matrix does not have shape.*'):
32+
with self.assertRaisesRegex(ValueError, 'Cost Matrix does not have shape.*'):
3333
cal_ot_mat(ot_cost=self.gdm, gene_expr=np.ones(shape=(6, 3)), show_progress_bar=False)
3434

35-
with self.assertRaisesRegexp(ValueError, 'Cost Matrix does not have shape.*'):
35+
with self.assertRaisesRegex(ValueError, 'Cost Matrix does not have shape.*'):
3636
cal_ot_mat(ot_cost=np.ones(shape=(6, 3)), gene_expr=self.gem.T, show_progress_bar=False)
3737

38-
with self.assertRaisesRegexp(ValueError, 'Gene Expression Matrix should not have values less than 0.*'):
38+
with self.assertRaisesRegex(ValueError, 'Gene Expression Matrix should not have values less than 0.*'):
3939
cal_ot_mat(ot_cost=np.ones(shape=(6, 3)), gene_expr=self.gem.T - 1, show_progress_bar=False)
4040

4141
def test_cal_ot_mat_gene_pairs(self):

tests/test_input_validation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ def test_validate_matrix(self):
1111

1212
validate_matrix(m, min_value=1, max_value=4, square=True, shape=(2, 2))
1313

14-
with self.assertRaisesRegexp(ValueError, '.*does not have 3 rows.*'):
14+
with self.assertRaisesRegex(ValueError, '.*does not have 3 rows.*'):
1515
validate_matrix(m, nrows=3)
16-
with self.assertRaisesRegexp(ValueError, '.*does not have 8 columns.*'):
16+
with self.assertRaisesRegex(ValueError, '.*does not have 8 columns.*'):
1717
validate_matrix(m, ncols=8)
18-
with self.assertRaisesRegexp(ValueError, '.*does not have shape \\(1, 1\\)'):
18+
with self.assertRaisesRegex(ValueError, '.*does not have shape \\(1, 1\\)'):
1919
validate_matrix(m, shape=(1, 1))
20-
with self.assertRaisesRegexp(ValueError, '.*Min_size: 3.*'):
20+
with self.assertRaisesRegex(ValueError, '.*Min_size: 3.*'):
2121
validate_matrix(m, min_size=3)
22-
with self.assertRaisesRegexp(ValueError, '.*should not have values less than 5.*'):
22+
with self.assertRaisesRegex(ValueError, '.*should not have values less than 5.*'):
2323
validate_matrix(m, min_value=5)
24-
with self.assertRaisesRegexp(ValueError, '.*should not have values greater than 1.*'):
24+
with self.assertRaisesRegex(ValueError, '.*should not have values greater than 1.*'):
2525
validate_matrix(m, max_value=1)
2626

2727

0 commit comments

Comments
 (0)