Skip to content

Commit fd33a1c

Browse files
committed
fix decoupler
1 parent 56c67a5 commit fd33a1c

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

docs/notebooks/basic-scrna-tutorial.ipynb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,15 +1173,15 @@
11731173
"name": "stderr",
11741174
"output_type": "stream",
11751175
"text": [
1176-
"\r",
1176+
"\r\n",
11771177
"0.00B [00:00, ?B/s]"
11781178
]
11791179
},
11801180
{
11811181
"name": "stderr",
11821182
"output_type": "stream",
11831183
"text": [
1184-
"\r",
1184+
"\r\n",
11851185
"56.5kB [00:00, 168MB/s]"
11861186
]
11871187
},
@@ -1204,39 +1204,39 @@
12041204
"name": "stderr",
12051205
"output_type": "stream",
12061206
"text": [
1207-
"\r",
1207+
"\r\n",
12081208
"0.00B [00:00, ?B/s]"
12091209
]
12101210
},
12111211
{
12121212
"name": "stderr",
12131213
"output_type": "stream",
12141214
"text": [
1215-
"\r",
1215+
"\r\n",
12161216
"449kB [00:00, 4.59MB/s]"
12171217
]
12181218
},
12191219
{
12201220
"name": "stderr",
12211221
"output_type": "stream",
12221222
"text": [
1223-
"\r",
1223+
"\r\n",
12241224
"1.78MB [00:00, 6.86MB/s]"
12251225
]
12261226
},
12271227
{
12281228
"name": "stderr",
12291229
"output_type": "stream",
12301230
"text": [
1231-
"\r",
1231+
"\r\n",
12321232
"4.76MB [00:00, 15.6MB/s]"
12331233
]
12341234
},
12351235
{
12361236
"name": "stderr",
12371237
"output_type": "stream",
12381238
"text": [
1239-
"\r",
1239+
"\r\n",
12401240
"5.91MB [00:00, 15.9MB/s]"
12411241
]
12421242
},
@@ -1398,7 +1398,7 @@
13981398
],
13991399
"source": [
14001400
"# Query Omnipath and get PanglaoDB\n",
1401-
"markers = dc.get_resource(name=\"PanglaoDB\", organism=\"human\")\n",
1401+
"markers = dc.op.resource(name=\"PanglaoDB\", organism=\"human\")\n",
14021402
"# Keep canonical cell type markers alone\n",
14031403
"markers = markers[markers[\"canonical_marker\"]]\n",
14041404
"\n",
@@ -1424,31 +1424,31 @@
14241424
"name": "stderr",
14251425
"output_type": "stream",
14261426
"text": [
1427-
"\r",
1427+
"\r\n",
14281428
" 0%| | 0/2 [00:00<?, ?it/s]"
14291429
]
14301430
},
14311431
{
14321432
"name": "stderr",
14331433
"output_type": "stream",
14341434
"text": [
1435-
"\r",
1435+
"\r\n",
14361436
" 50%|█████ | 1/2 [00:05<00:05, 5.44s/it]"
14371437
]
14381438
},
14391439
{
14401440
"name": "stderr",
14411441
"output_type": "stream",
14421442
"text": [
1443-
"\r",
1443+
"\r\n",
14441444
"100%|██████████| 2/2 [00:09<00:00, 4.45s/it]"
14451445
]
14461446
},
14471447
{
14481448
"name": "stderr",
14491449
"output_type": "stream",
14501450
"text": [
1451-
"\r",
1451+
"\r\n",
14521452
"100%|██████████| 2/2 [00:09<00:00, 4.60s/it]"
14531453
]
14541454
},
@@ -1461,15 +1461,15 @@
14611461
}
14621462
],
14631463
"source": [
1464-
"dc.run_mlm(mat=adata, net=markers, weight=None, source=\"cell_type\", target=\"genesymbol\", verbose=True, use_raw=False)"
1464+
"dc.mt.mlm(adata, net=markers.rename(columns=dict(cell_type=\"source\", genesymbol=\"target\")), verbose=True)"
14651465
]
14661466
},
14671467
{
14681468
"cell_type": "markdown",
14691469
"id": "2e01e50a-238f-459f-a9f6-f25880b78a2c",
14701470
"metadata": {},
14711471
"source": [
1472-
"The obtained results are stored in the .obsm key, with `mlm_estimate` representing coefficient t-values:"
1472+
"The obtained results are stored in `.obsm`, with `\"score_mlm\"` representing coefficient t-values, and `\"padj_mlm\"` representing adjusted p-values.:"
14731473
]
14741474
},
14751475
{
@@ -1714,7 +1714,7 @@
17141714
}
17151715
],
17161716
"source": [
1717-
"adata.obsm[\"mlm_estimate\"].head()"
1717+
"adata.obsm[\"score_mlm\"].head()"
17181718
]
17191719
},
17201720
{
@@ -1749,7 +1749,7 @@
17491749
}
17501750
],
17511751
"source": [
1752-
"acts = dc.get_acts(adata=adata, obsm_key=\"mlm_estimate\")\n",
1752+
"acts = dc.pp.get_obsm(adata, \"score_mlm\")\n",
17531753
"sc.pl.umap(\n",
17541754
" acts,\n",
17551755
" color=[\n",
@@ -1780,8 +1780,8 @@
17801780
"metadata": {},
17811781
"outputs": [],
17821782
"source": [
1783-
"mean_enr = dc.summarize_acts(acts, groupby=\"leiden_res0_5\", min_std=1.0)\n",
1784-
"annotation_dict = dc.assign_groups(mean_enr)\n",
1783+
"enr = dc.tl.rankby_group(acts, groupby=\"leiden_res0_5\")\n",
1784+
"annotation_dict = enr[enr[\"stat\"] > 0].groupby(\"group\").head(1).set_index(\"group\")[\"name\"].to_dict()\n",
17851785
"adata.obs[\"dc_anno\"] = [annotation_dict[clust] for clust in adata.obs[\"leiden_res0_5\"]]"
17861786
]
17871787
},

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ lint.select = [
9292
]
9393
lint.ignore = [
9494
"B008", # Errors from function calls in argument defaults. These are fine when the result is immutable.
95+
"C408", # dict() is nice for some use cases
9596
"D100", # Missing docstring in public module
9697
"D104", # Missing docstring in public package
9798
"D105", # __magic__ methods are often self-explanatory, allow missing docstrings

0 commit comments

Comments
 (0)