Skip to content

Commit f5e80fe

Browse files
committed
Pin compatible package versions
1 parent 09b639d commit f5e80fe

13 files changed

Lines changed: 558 additions & 2397 deletions

compass/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.5.2"
1+
__version__ = "2.5.3"
22

33
from .main import PreTrainer, FineTuner, loadcompass
44

compass/projector/projector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def _genes_to_idxs(genes):
118118
# Move 'Reference' to the end
119119
noref = CELLPATHWAY[CELLPATHWAY.index != "Reference"]
120120
ref = CELLPATHWAY[CELLPATHWAY.index == "Reference"]
121-
CELLPATHWAY = noref._append(ref)
122-
121+
CELLPATHWAY = pd.concat([noref, ref])
122+
123123
self.GENESET = GENESET
124124
self.CELLPATHWAY = CELLPATHWAY
125125

compass/utils/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def loadcompass(file, **kwargs):
3737
file = temp_file_path
3838

3939
# Load the model
40-
model = torch.load(file, **kwargs)
40+
model = torch.load(file, weights_only=False, **kwargs)
4141

4242
# Clean up wandb settings if present
4343
if hasattr(model, "with_wandb") and model.with_wandb:

compass/utils/scorer.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88

99
def score(y_true, y_prob, y_pred):
10-
10+
y_true = y_true.astype(int)
11+
y_prob = y_prob.astype(float)
12+
y_pred = y_pred.astype(int)
13+
1114
select = ~y_true.isna()
1215
y_prob = y_prob[select]
1316
y_true = y_true[select]
@@ -28,12 +31,16 @@ def score(y_true, y_prob, y_pred):
2831

2932

3033
def score2(y_true, y_prob, y_pred):
31-
34+
35+
y_true = y_true.astype(int)
36+
y_prob = y_prob.astype(float)
37+
y_pred = y_pred.astype(int)
38+
3239
select = ~y_true.isna()
3340
y_prob = y_prob[select]
3441
y_true = y_true[select]
3542
y_pred = y_pred[select] # .map({'NR':0, 'R':1})
36-
43+
3744
if len(y_true.unique()) == 1:
3845
roc = np.nan
3946
prc = np.nan
@@ -62,6 +69,11 @@ def score3(y_true, y_prob, y_pred):
6269
tuple: roc, prc, f1, acc, mcc, fpr, fnr
6370
"""
6471
# Filter non-NA values
72+
73+
y_true = y_true.astype(int)
74+
y_prob = y_prob.astype(float)
75+
y_pred = y_pred.astype(int)
76+
6577
select = ~y_true.isna()
6678
y_prob = y_prob[select]
6779
y_true = y_true[select]

paper/00_pretrain/run_scripts/00_pretraining.ipynb

Lines changed: 27 additions & 98 deletions
Large diffs are not rendered by default.

paper/00_pretrain/run_scripts/01_loco_nft.ipynb

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@
66
"id": "26c64883-0781-4fc3-9d5c-a2de7ce6d480",
77
"metadata": {},
88
"outputs": [
9+
{
10+
"name": "stderr",
11+
"output_type": "stream",
12+
"text": [
13+
"/mnt/mamba_envs/envs/compass_tc2/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
14+
" from .autonotebook import tqdm as notebook_tqdm\n"
15+
]
16+
},
917
{
1018
"name": "stdout",
1119
"output_type": "stream",
1220
"text": [
13-
"Using COMPASS version: 2.4\n"
21+
"Using COMPASS version: 2.5.3\n"
1422
]
1523
}
1624
],
@@ -74,11 +82,19 @@
7482
"id": "3f073864-d64b-44c8-b3d0-b9ebbc7f71f9",
7583
"metadata": {},
7684
"outputs": [
85+
{
86+
"name": "stdout",
87+
"output_type": "stream",
88+
"text": [
89+
"missing_keys: []\n",
90+
"unexpected_keys: []\n"
91+
]
92+
},
7793
{
7894
"name": "stderr",
7995
"output_type": "stream",
8096
"text": [
81-
"100%|#################################################################################| 71/71 [00:02<00:00, 34.29it/s]\n"
97+
"100%|#############################################################################################################################################| 71/71 [00:02<00:00, 34.32it/s]\n"
8298
]
8399
}
84100
],
@@ -203,7 +219,10 @@
203219
" 'SD':'NR', 'CR':'R',\n",
204220
" 'NR':'NR', 'R':'R'})).join(pred_testy)\n",
205221
"\n",
206-
" y_true, y_prob, y_pred = dfp['R'], dfp[1], dfp[[0, 1]].idxmax(axis=1)\n",
222+
" y_true = dfp['R'].astype(int)\n",
223+
" y_prob = dfp[1].astype(float)\n",
224+
" y_pred = dfp[[0, 1]].idxmax(axis=1).astype(int)\n",
225+
"\n",
207226
" fig = plot_performance(y_true, y_prob, y_pred)\n",
208227
" fig.suptitle('cohort to cohort transfer: train: %s, test: %s' % (train_cohort_name, test_cohort), fontsize=16)\n",
209228
" fig.savefig(os.path.join(work_dir, 'CTCT_train_%s_test_%s.jpg' % (train_cohort_name, test_cohort)))\n",
@@ -231,7 +250,7 @@
231250
{
232251
"data": {
233252
"text/plain": [
234-
"(0.5313570569404332, 0.5572519522353203)"
253+
"(np.float64(0.5307582081409932), np.float64(0.5572519522353203))"
235254
]
236255
},
237256
"execution_count": 7,
@@ -245,29 +264,24 @@
245264
},
246265
{
247266
"cell_type": "code",
248-
"execution_count": null,
267+
"execution_count": 8,
249268
"id": "a528e043-7142-42c8-bafa-29defed5f280",
250269
"metadata": {},
251-
"outputs": [],
270+
"outputs": [
271+
{
272+
"data": {
273+
"text/plain": [
274+
"(0.5302643465917933, 0.5583392651130374)"
275+
]
276+
},
277+
"execution_count": 8,
278+
"metadata": {},
279+
"output_type": "execute_result"
280+
}
281+
],
252282
"source": [
253283
"(0.5302643465917933, 0.5583392651130374)"
254284
]
255-
},
256-
{
257-
"cell_type": "code",
258-
"execution_count": null,
259-
"id": "ccc086ed-f292-4e89-8ebe-185824565c9d",
260-
"metadata": {},
261-
"outputs": [],
262-
"source": []
263-
},
264-
{
265-
"cell_type": "code",
266-
"execution_count": null,
267-
"id": "fa71f74b-779c-43a4-9cf8-5dbe4eb82b11",
268-
"metadata": {},
269-
"outputs": [],
270-
"source": []
271285
}
272286
],
273287
"metadata": {
@@ -286,7 +300,7 @@
286300
"name": "python",
287301
"nbconvert_exporter": "python",
288302
"pygments_lexer": "ipython3",
289-
"version": "3.8.20"
303+
"version": "3.12.12"
290304
}
291305
},
292306
"nbformat": 4,

0 commit comments

Comments
 (0)