Skip to content

Commit e899da8

Browse files
authored
Merge pull request #310 from tristan-f-r/dep-bump
chore: bump dependencies
2 parents b4e3aa5 + 9362f5f commit e899da8

File tree

7 files changed

+72
-44
lines changed

7 files changed

+72
-44
lines changed

environment.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,36 @@ name: spras
22
channels:
33
- conda-forge
44
dependencies:
5-
- adjusttext=0.7.3.1
6-
- bioconda::snakemake-minimal=8.17.0
7-
- docker-py=5.0
8-
- matplotlib=3.6
9-
- networkx=2.8
10-
- pandas=1.5
11-
- numpy=1.26.4
12-
- pre-commit=2.20 # Only required for development
13-
- go=1.24 # Only required for development
14-
- pytest=8.0 # Only required for development
15-
- python=3.11
5+
- adjusttext=1.3.0
6+
- bioconda::snakemake-minimal=9.6.2
7+
# Conda refers to pypi/docker as docker-py.
8+
- docker-py=7.1.0
9+
- matplotlib=3.10.3
10+
- networkx=3.5
11+
- pandas=2.3.0
12+
- numpy=2.3.1
13+
- requests=2.32.4
14+
- scikit-learn=1.7.0
15+
- seaborn=0.13.2
16+
- spython=0.3.14
17+
18+
# conda-specific for dsub
19+
- python-dateutil=2.9.0
20+
- pytz=2025.2
21+
- pyyaml=6.0.2
22+
- tenacity=9.1.2
23+
- tabulate=0.9.0
24+
25+
# toolchain deps
1626
- pip=22.1
17-
- requests=2.28
18-
- scikit-learn=1.2
19-
- seaborn=0.12
20-
- spython=0.2
21-
# for dsub
22-
- python-dateutil<=2.9.0
23-
- pytz<=2024.1
24-
- pyyaml<=6.0.1
25-
- tenacity<=8.2.3
26-
- tabulate<=0.9.0
27-
- sphinx=6.0
28-
- sphinx-rtd-theme=2.0.0
27+
# This should be the same as requires-python minus the >=.
28+
- python=3.11
29+
30+
# development dependencies
31+
- pre-commit=4.2.0
32+
- pytest=8.4.1
33+
# development dependencies - conda-specific
34+
- go=1.24
35+
2936
- pip:
3037
- dsub==0.4.13
31-

pyproject.toml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,26 @@ classifiers = [
1919
requires-python = ">=3.11"
2020
dependencies = [
2121
"adjusttext==0.7.3",
22-
# A bug was introduced in older versions of snakemake that prevent it from running. Update to fix
23-
"snakemake==8.17.0",
24-
"docker==5.0.3", # Switched from docker-py to docker because docker-py is not maintained in pypi. This appears to have no effect
25-
"matplotlib==3.6",
26-
"networkx==2.8",
27-
"pandas==1.5",
28-
"numpy==1.26.4",
22+
"snakemake==9.6.2",
23+
"docker==7.1.0",
24+
"matplotlib==3.10.3",
25+
"networkx==3.5",
26+
"pandas==2.3.0",
27+
"numpy==2.3.1",
28+
"requests==2.32.4",
29+
"scikit-learn==1.7.0",
30+
"seaborn==0.13.2",
31+
"spython==0.3.14",
32+
33+
# toolchain deps
2934
"pip==22.1",
30-
"requests==2.28",
31-
"scikit-learn==1.2",
32-
"seaborn==0.12",
33-
"spython==0.2",
34-
"sphinx==6.0",
35-
"sphinx-rtd-theme==2.0.0",
3635
]
3736

3837
[project.optional-dependencies]
3938
dev = [
4039
# Only required for development
41-
"pre-commit==2.20",
42-
"pytest==8.0",
40+
"pre-commit==4.2.0",
41+
"pytest==8.4.1",
4342
]
4443

4544
[project.urls]

spras/analysis/ml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def hac_horizontal(dataframe: pd.DataFrame, output_png: str, output_file: str, l
382382

383383
# plotting figure
384384
plt.figure(figsize=(10, 7))
385-
model = AgglomerativeClustering(linkage=linkage, affinity=metric,distance_threshold=0.5, n_clusters=None)
385+
model = AgglomerativeClustering(linkage=linkage, metric=metric,distance_threshold=0.5, n_clusters=None)
386386
model = model.fit(df)
387387
plt.figure(figsize=(10, 7))
388388
plt.title("Hierarchical Agglomerative Clustering Dendrogram")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
datapoint_labels PC1 PC2
2+
test-data-s1 -1.01220906 0.05003395
3+
test-data-s2 -0.84372464 -0.59953316
4+
test-data-s3 1.56185985 -0.48650911
5+
test-data-empty 0.29407385 1.03600832
6+
centroid 0.0 0.0
7+
kde_peak 0.65469949 0.06343901
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
datapoint_labels PC1 PC2
2+
centroid 0.0 0.0
3+
test-data-s1 0.94594398 -0.46508182
4+
test-data-s2 0.72014153 0.5090913
5+
test-data-s3 -1.66608552 -0.04400948
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
datapoint_labels PC1 PC2
2+
centroid 0.0 0.0
3+
test-data-s1 -0.94594398 -0.46508182
4+
test-data-s2 -0.72014153 0.5090913
5+
test-data-s3 1.66608552 -0.04400948

test/ml/test_ml.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,22 @@ def test_pca_kernel_density(self):
9999
OUT_DIR + 'pca-coordinates-kde.tsv', kde=True)
100100
coord = pd.read_table(OUT_DIR + 'pca-coordinates-kde.tsv')
101101
expected = pd.read_table(EXPECT_DIR + 'expected-pca-coordinates-kde.tsv')
102+
expected_negated = pd.read_table(EXPECT_DIR + 'expected-pca-coordinates-kde-negated.tsv')
102103
coord_kde_peak = coord.loc[coord['datapoint_labels'] == 'kde_peak'].round(5)
103104
expected_kde_peak = expected.loc[expected['datapoint_labels'] == 'kde_peak'].round(5)
105+
expected_kde_peak_negated = expected_negated.loc[expected_negated['datapoint_labels'] == 'kde_peak'].round(5)
104106

105-
assert coord_kde_peak.equals(expected_kde_peak)
107+
assert coord_kde_peak.equals(expected_kde_peak) or coord_kde_peak.equals(expected_kde_peak_negated)
106108

107109
def test_pca_robustness(self):
108110
dataframe = ml.summarize_networks([INPUT_DIR + 'test-data-s1/s1.txt', INPUT_DIR + 'test-data-s2/s2.txt',
109111
INPUT_DIR + 'test-data-s3/s3.txt'])
110-
expected = pd.read_table(EXPECT_DIR + 'expected-pca-coordinates.tsv')
112+
# PCA signage now depends on the input data: we need two differently signed PCA coordinate files.
113+
# See https://scikit-learn.org/stable/whats_new/v1.5.html#changed-models for more info.
114+
expected = pd.read_table(EXPECT_DIR + 'expected-pca-coordinates-sorted.tsv')
115+
expected_other = pd.read_table(EXPECT_DIR + 'expected-pca-coordinates-sorted-negated.tsv')
111116
expected = expected.round(5)
117+
expected_other = expected_other.round(5)
112118
expected.sort_values(by='datapoint_labels', ignore_index=True, inplace=True)
113119

114120
for _ in range(5):
@@ -118,7 +124,7 @@ def test_pca_robustness(self):
118124
coord = pd.read_table(OUT_DIR + 'pca-shuffled-columns-coordinates.tsv')
119125
coord = coord.round(5) # round values to 5 digits to account for numeric differences across machines
120126
coord.sort_values(by='datapoint_labels', ignore_index=True, inplace=True)
121-
assert coord.equals(expected)
127+
assert coord.equals(expected) or coord.equals(expected_other)
122128

123129
for _ in range(5):
124130
dataframe_shuffled = dataframe.sample(frac=1, axis=0) # permute the rows
@@ -128,7 +134,7 @@ def test_pca_robustness(self):
128134
coord = coord.round(5) # round values to 5 digits to account for numeric differences across machines
129135
coord.sort_values(by='datapoint_labels', ignore_index=True, inplace=True)
130136

131-
assert coord.equals(expected)
137+
assert coord.equals(expected) or coord.equals(expected_other)
132138

133139
def test_hac_horizontal(self):
134140
dataframe = ml.summarize_networks([INPUT_DIR + 'test-data-s1/s1.txt', INPUT_DIR + 'test-data-s2/s2.txt', INPUT_DIR + 'test-data-s3/s3.txt'])

0 commit comments

Comments
 (0)