|
1143 | 1143 | "\n",
|
1144 | 1144 | "for shape in [\"lasso\", \"my_shapes\", \"my_shapes_2\"]:\n",
|
1145 | 1145 | " for polygon in visium_sdata[shape].geometry:\n",
|
1146 |
| - " table = polygon_query(\n", |
1147 |
| - " visium_sdata, polygon=polygon, target_coordinate_system=\"aligned\"\n", |
1148 |
| - " )[\"table\"]\n", |
| 1146 | + " table = polygon_query(visium_sdata, polygon=polygon, target_coordinate_system=\"aligned\")[\"table\"]\n", |
1149 | 1147 | " filtered_tables_unmerged[shape].append(table)\n",
|
1150 | 1148 | " filtered_tables[shape] = ad.concat(filtered_tables_unmerged[shape])"
|
1151 | 1149 | ]
|
|
1302 | 1300 | "categories = [\"unassigned\"] + list(filtered_tables.keys())\n",
|
1303 | 1301 | "n = len(visium_sdata[\"table\"])\n",
|
1304 | 1302 | "\n",
|
1305 |
| - "visium_sdata[\"table\"].obs[\"annotation\"] = pd.Categorical(\n", |
1306 |
| - " [\"unassigned\" for _ in range(n)], categories=categories\n", |
1307 |
| - ")\n", |
| 1303 | + "visium_sdata[\"table\"].obs[\"annotation\"] = pd.Categorical([\"unassigned\" for _ in range(n)], categories=categories)\n", |
1308 | 1304 | "\n",
|
1309 | 1305 | "for shape, subtable in filtered_tables.items():\n",
|
1310 | 1306 | " in_shape = subtable.obs.index\n",
|
|
1389 | 1385 | "plt.figure(figsize=(12, 7))\n",
|
1390 | 1386 | "ax = plt.gca()\n",
|
1391 | 1387 | "(\n",
|
1392 |
| - " visium_sdata.pl.render_images(\n", |
1393 |
| - " \"CytAssist_FFPE_Human_Breast_Cancer_full_image\"\n", |
1394 |
| - " ).pl.render_shapes(\"CytAssist_FFPE_Human_Breast_Cancer\", color=\"annotation\")\n", |
| 1388 | + " visium_sdata.pl.render_images(\"CytAssist_FFPE_Human_Breast_Cancer_full_image\")\n", |
| 1389 | + " .pl.render_shapes(\"CytAssist_FFPE_Human_Breast_Cancer\", color=\"annotation\")\n", |
1395 | 1390 | " # .pl.render_shapes(\"lasso\", color=\"#00000040\")\n",
|
1396 | 1391 | " # .pl.render_shapes(\"my_shapes\", color=\"#00000040\")\n",
|
1397 | 1392 | " # .pl.render_shapes(\"my_shapes_2\", color=\"#00000040\")\n",
|
|
0 commit comments