|
22 | 22 | "\n", |
23 | 23 | "High numbers of fluorescent microscopy images characterize cellular phenotypes in vitro based on morphology and protein expression (5-10 stains) across a range of conditions.\n", |
24 | 24 | "\n", |
25 | | - "- In this guide, you'll see how to query some of these data using LaminDB.\n", |
26 | | - "- If you'd like to transfer data into your own LaminDB instance, see the [transfer guide](inv:docs#transfer)." |
| 25 | + "In this guide, you'll see how to query some of these data using LaminDB.\n", |
| 26 | + "If you'd like to transfer data into your own LaminDB instance, see the [transfer guide](inv:docs#transfer)." |
27 | 27 | ] |
28 | 28 | }, |
29 | 29 | { |
|
32 | 32 | "metadata": {}, |
33 | 33 | "outputs": [], |
34 | 34 | "source": [ |
35 | | - "# !pip install 'lamindb[bionty,jupyter,gcp,wetlab]' duckdb\n", |
36 | | - "!lamin connect laminlabs/lamindata" |
| 35 | + "# !pip install 'lamindb[gcp]' duckdb\n", |
| 36 | + "!lamin init --modules bionty,wetlab --storage ./test-rxrx" |
37 | 37 | ] |
38 | 38 | }, |
39 | 39 | { |
40 | 40 | "cell_type": "code", |
41 | 41 | "execution_count": null, |
42 | | - "metadata": {}, |
| 42 | + "metadata": { |
| 43 | + "tags": [ |
| 44 | + "hide-output" |
| 45 | + ] |
| 46 | + }, |
43 | 47 | "outputs": [], |
44 | 48 | "source": [ |
45 | 49 | "import lamindb as ln\n", |
46 | 50 | "import bionty as bt\n", |
47 | 51 | "import wetlab as wl" |
48 | 52 | ] |
49 | 53 | }, |
| 54 | + { |
| 55 | + "cell_type": "markdown", |
| 56 | + "metadata": {}, |
| 57 | + "source": [ |
| 58 | + "Create the central query object for this instance:" |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "cell_type": "code", |
| 63 | + "execution_count": null, |
| 64 | + "metadata": { |
| 65 | + "tags": [ |
| 66 | + "hide-output" |
| 67 | + ] |
| 68 | + }, |
| 69 | + "outputs": [], |
| 70 | + "source": [ |
| 71 | + "lamindata_db = ln.QueryDB(\"laminlabs/lamindata\")" |
| 72 | + ] |
| 73 | + }, |
50 | 74 | { |
51 | 75 | "cell_type": "markdown", |
52 | 76 | "metadata": {}, |
|
64 | 88 | { |
65 | 89 | "cell_type": "code", |
66 | 90 | "execution_count": null, |
67 | | - "metadata": {}, |
| 91 | + "metadata": { |
| 92 | + "tags": [ |
| 93 | + "hide-output" |
| 94 | + ] |
| 95 | + }, |
68 | 96 | "outputs": [], |
69 | 97 | "source": [ |
70 | | - "df = wl.GeneticPerturbation.df()\n", |
| 98 | + "df = lamindata_db.genetic_perturbations.to_dataframe()\n", |
71 | 99 | "df.shape" |
72 | 100 | ] |
73 | 101 | }, |
|
81 | 109 | { |
82 | 110 | "cell_type": "code", |
83 | 111 | "execution_count": null, |
84 | | - "metadata": {}, |
| 112 | + "metadata": { |
| 113 | + "tags": [ |
| 114 | + "hide-output" |
| 115 | + ] |
| 116 | + }, |
85 | 117 | "outputs": [], |
86 | 118 | "source": [ |
87 | | - "sirnas = wl.GeneticPerturbation.filter(system=\"siRNA\").lookup(return_field=\"name\")" |
| 119 | + "sirnas = lamindata_db.genetic_perturbations.filter(system=\"siRNA\").lookup(\n", |
| 120 | + " return_field=\"name\"\n", |
| 121 | + ")" |
88 | 122 | ] |
89 | 123 | }, |
90 | 124 | { |
|
97 | 131 | { |
98 | 132 | "cell_type": "code", |
99 | 133 | "execution_count": null, |
100 | | - "metadata": {}, |
| 134 | + "metadata": { |
| 135 | + "tags": [ |
| 136 | + "hide-output" |
| 137 | + ] |
| 138 | + }, |
101 | 139 | "outputs": [], |
102 | 140 | "source": [ |
103 | | - "cell_lines = bt.CellLine.lookup(return_field=\"abbr\")\n", |
104 | | - "wells = wl.Well.lookup(return_field=\"name\")" |
| 141 | + "cell_lines = lamindata_db.cell_lines.lookup(return_field=\"abbr\")\n", |
| 142 | + "wells = lamindata_db.wells.lookup(return_field=\"name\")" |
105 | 143 | ] |
106 | 144 | }, |
107 | 145 | { |
|
135 | 173 | }, |
136 | 174 | "outputs": [], |
137 | 175 | "source": [ |
138 | | - "collection = ln.Collection.get(\"Br2Z1lVSQBAkkbbt7ILu\")\n", |
| 176 | + "collection = lamindata_db.collections.get(\"Br2Z1lVSQBAkkbbt7ILu\")\n", |
139 | 177 | "collection.view_lineage()\n", |
140 | 178 | "collection.describe()" |
141 | 179 | ] |
|
150 | 188 | { |
151 | 189 | "cell_type": "code", |
152 | 190 | "execution_count": null, |
153 | | - "metadata": {}, |
| 191 | + "metadata": { |
| 192 | + "tags": [ |
| 193 | + "hide-output" |
| 194 | + ] |
| 195 | + }, |
154 | 196 | "outputs": [], |
155 | 197 | "source": [ |
156 | 198 | "collection.meta_artifact.load().head()" |
|
189 | 231 | { |
190 | 232 | "cell_type": "code", |
191 | 233 | "execution_count": null, |
192 | | - "metadata": {}, |
| 234 | + "metadata": { |
| 235 | + "tags": [ |
| 236 | + "hide-output" |
| 237 | + ] |
| 238 | + }, |
193 | 239 | "outputs": [], |
194 | 240 | "source": [ |
195 | 241 | "query = df[\n", |
|
212 | 258 | { |
213 | 259 | "cell_type": "code", |
214 | 260 | "execution_count": null, |
215 | | - "metadata": {}, |
| 261 | + "metadata": { |
| 262 | + "tags": [ |
| 263 | + "hide-output" |
| 264 | + ] |
| 265 | + }, |
216 | 266 | "outputs": [], |
217 | 267 | "source": [ |
218 | 268 | "collection.data_artifact.storage.root" |
|
221 | 271 | { |
222 | 272 | "cell_type": "code", |
223 | 273 | "execution_count": null, |
224 | | - "metadata": {}, |
| 274 | + "metadata": { |
| 275 | + "tags": [ |
| 276 | + "hide-output" |
| 277 | + ] |
| 278 | + }, |
225 | 279 | "outputs": [], |
226 | 280 | "source": [ |
227 | 281 | "images = [f\"{collection.data_artifact.storage.root}/{key}\" for key in query.path]\n", |
|
238 | 292 | { |
239 | 293 | "cell_type": "code", |
240 | 294 | "execution_count": null, |
241 | | - "metadata": {}, |
| 295 | + "metadata": { |
| 296 | + "tags": [ |
| 297 | + "hide-output" |
| 298 | + ] |
| 299 | + }, |
242 | 300 | "outputs": [], |
243 | 301 | "source": [ |
244 | 302 | "path = ln.UPath(images[1])\n", |
|
248 | 306 | { |
249 | 307 | "cell_type": "code", |
250 | 308 | "execution_count": null, |
251 | | - "metadata": {}, |
| 309 | + "metadata": { |
| 310 | + "tags": [ |
| 311 | + "hide-output" |
| 312 | + ] |
| 313 | + }, |
252 | 314 | "outputs": [], |
253 | 315 | "source": [ |
254 | 316 | "from IPython.display import Image\n", |
|
273 | 335 | { |
274 | 336 | "cell_type": "code", |
275 | 337 | "execution_count": null, |
276 | | - "metadata": {}, |
| 338 | + "metadata": { |
| 339 | + "tags": [ |
| 340 | + "hide-output" |
| 341 | + ] |
| 342 | + }, |
277 | 343 | "outputs": [], |
278 | 344 | "source": [ |
279 | 345 | "import duckdb\n", |
280 | 346 | "\n", |
281 | | - "features = ln.Feature.lookup(return_field=\"name\")\n", |
| 347 | + "features = lamindata_db.features.lookup(return_field=\"name\")\n", |
282 | 348 | "\n", |
283 | 349 | "filter = (\n", |
284 | 350 | " f\"{features.cell_line} == '{cell_lines.hep_g2_cell}' and {features.sirna} ==\"\n", |
285 | 351 | " f\" '{sirnas.s15652}' and {features.well} == '{wells.m15}' and \"\n", |
286 | 352 | " f\"{features.plate} == '1' and {features.site} == '2'\"\n", |
287 | 353 | ")\n", |
288 | 354 | "\n", |
289 | | - "region = ln.setup.settings.storage.region\n", |
290 | 355 | "parquet_data = duckdb.from_parquet(\n", |
291 | | - " collection.meta_artifact.path.as_posix() + f\"?s3_region={region}\"\n", |
| 356 | + " collection.meta_artifact.path.as_posix() + \"?s3_region=us-east-1\"\n", |
292 | 357 | ")\n", |
293 | 358 | "\n", |
294 | 359 | "parquet_data.filter(filter)" |
|
0 commit comments