Skip to content

support for numpy 20 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gene_trajectory/extract_gene_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def extract_gene_trajectory(
logger.warning(f"Early stop reached. {i - 1} gene trajectories were retrieved.")
break

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

seed_idx = np.argmax(dist_to_origin)
logger.info(f'Generating trajectory from {gene_names[seed_idx]}')
Expand Down
2 changes: 1 addition & 1 deletion gene_trajectory/gene_distance_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def cal_ot_mat(
else:
pairs = gene_pairs
npairs = len(gene_pairs)
emd_mat = np.full((ngenes, ngenes), fill_value=np.NaN)
emd_mat = np.full((ngenes, ngenes), fill_value=np.nan)

with SharedMemoryManager() as manager:
start_time = time.perf_counter()
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "gene-trajectory"
version = "1.0.3"
version = "1.0.4"
description = "Compute gene trajectories"
license = {file = "LICENSE"}
readme = "README.md"
Expand All @@ -30,7 +30,7 @@ requires-python = ">=3.9"
dependencies = [
"igraph>=0.10",
"matplotlib>=3.6",
"numpy>=1.23",
"numpy>=1.25",
"pandas>=1.5",
"pot>=0.8.2",
"scanpy>=1.9.3",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
igraph>=0.10
matplotlib>=3.6
numpy>=1.23
numpy>=1.25
pandas>=1.5
pot>=0.8.2
scanpy>=1.9.3
Expand Down
6 changes: 3 additions & 3 deletions tests/test_gene_distance_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ def test_gene_distance_shared(self):
np.testing.assert_almost_equal(self.expected_emd, mt, 6)

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

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

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

def test_cal_ot_mat_gene_pairs(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ def test_validate_matrix(self):

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

with self.assertRaisesRegexp(ValueError, '.*does not have 3 rows.*'):
with self.assertRaisesRegex(ValueError, '.*does not have 3 rows.*'):
validate_matrix(m, nrows=3)
with self.assertRaisesRegexp(ValueError, '.*does not have 8 columns.*'):
with self.assertRaisesRegex(ValueError, '.*does not have 8 columns.*'):
validate_matrix(m, ncols=8)
with self.assertRaisesRegexp(ValueError, '.*does not have shape \\(1, 1\\)'):
with self.assertRaisesRegex(ValueError, '.*does not have shape \\(1, 1\\)'):
validate_matrix(m, shape=(1, 1))
with self.assertRaisesRegexp(ValueError, '.*Min_size: 3.*'):
with self.assertRaisesRegex(ValueError, '.*Min_size: 3.*'):
validate_matrix(m, min_size=3)
with self.assertRaisesRegexp(ValueError, '.*should not have values less than 5.*'):
with self.assertRaisesRegex(ValueError, '.*should not have values less than 5.*'):
validate_matrix(m, min_value=5)
with self.assertRaisesRegexp(ValueError, '.*should not have values greater than 1.*'):
with self.assertRaisesRegex(ValueError, '.*should not have values greater than 1.*'):
validate_matrix(m, max_value=1)


Expand Down
Loading