Skip to content

Commit 434bb15

Browse files
authored
Merge pull request #398 from scverse/preprocess-tutorial
add preprocessing tutorial with multiple examples
2 parents 7f51d21 + bd2c2b9 commit 434bb15

14 files changed

+10351
-9182
lines changed

atac/PeakVI.ipynb

Lines changed: 1407 additions & 1287 deletions
Large diffs are not rendered by default.

atac/PoissonVI.ipynb

Lines changed: 66 additions & 57 deletions
Large diffs are not rendered by default.

multimodal/MultiVI_tutorial.ipynb

Lines changed: 734 additions & 1498 deletions
Large diffs are not rendered by default.

multimodal/totalVI.ipynb

Lines changed: 1228 additions & 1768 deletions
Large diffs are not rendered by default.

r/DestVI_in_R.ipynb

Lines changed: 155 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,23 @@
1919
"## Loading and processing data with Seurat"
2020
]
2121
},
22+
{
23+
"cell_type": "markdown",
24+
"metadata": {},
25+
"source": [
26+
"```{note}\n",
27+
"For general pre-processing for various datatypes used by scvi-tools models, see the [preprocessing tutorial](https://docs.scvi-tools.org/en/stable/tutorials/notebooks/use_cases/preprocessing.html#spatial-transcriptomics).\n",
28+
"```"
29+
]
30+
},
2231
{
2332
"cell_type": "code",
2433
"execution_count": 1,
25-
"metadata": {},
34+
"metadata": {
35+
"vscode": {
36+
"languageId": "r"
37+
}
38+
},
2639
"outputs": [],
2740
"source": [
2841
"# install.packages(\"Seurat\")\n",
@@ -41,7 +54,11 @@
4154
{
4255
"cell_type": "code",
4356
"execution_count": 2,
44-
"metadata": {},
57+
"metadata": {
58+
"vscode": {
59+
"languageId": "r"
60+
}
61+
},
4562
"outputs": [
4663
{
4764
"name": "stderr",
@@ -109,7 +126,11 @@
109126
{
110127
"cell_type": "code",
111128
"execution_count": 3,
112-
"metadata": {},
129+
"metadata": {
130+
"vscode": {
131+
"languageId": "r"
132+
}
133+
},
113134
"outputs": [],
114135
"source": [
115136
"cortex_sc_data <- readRDS(url(\"https://www.dropbox.com/s/cuowvm4vrf65pvq/allen_cortex.rds?dl=1\"))"
@@ -119,7 +140,10 @@
119140
"cell_type": "code",
120141
"execution_count": 4,
121142
"metadata": {
122-
"tags": []
143+
"tags": [],
144+
"vscode": {
145+
"languageId": "r"
146+
}
123147
},
124148
"outputs": [
125149
{
@@ -235,7 +259,10 @@
235259
"cell_type": "code",
236260
"execution_count": 5,
237261
"metadata": {
238-
"tags": []
262+
"tags": [],
263+
"vscode": {
264+
"languageId": "r"
265+
}
239266
},
240267
"outputs": [
241268
{
@@ -332,7 +359,10 @@
332359
"cell_type": "code",
333360
"execution_count": 6,
334361
"metadata": {
335-
"tags": []
362+
"tags": [],
363+
"vscode": {
364+
"languageId": "r"
365+
}
336366
},
337367
"outputs": [
338368
{
@@ -3840,7 +3870,11 @@
38403870
{
38413871
"cell_type": "code",
38423872
"execution_count": 7,
3843-
"metadata": {},
3873+
"metadata": {
3874+
"vscode": {
3875+
"languageId": "r"
3876+
}
3877+
},
38443878
"outputs": [
38453879
{
38463880
"data": {
@@ -3862,7 +3896,10 @@
38623896
"cell_type": "code",
38633897
"execution_count": 8,
38643898
"metadata": {
3865-
"tags": []
3899+
"tags": [],
3900+
"vscode": {
3901+
"languageId": "r"
3902+
}
38663903
},
38673904
"outputs": [
38683905
{
@@ -3886,7 +3923,11 @@
38863923
{
38873924
"cell_type": "code",
38883925
"execution_count": 9,
3889-
"metadata": {},
3926+
"metadata": {
3927+
"vscode": {
3928+
"languageId": "r"
3929+
}
3930+
},
38903931
"outputs": [],
38913932
"source": [
38923933
"cortex_sc_data <- NormalizeData(cortex_sc_data, normalization.method = \"LogNormalize\", scale.factor = 10000)\n",
@@ -3898,7 +3939,11 @@
38983939
{
38993940
"cell_type": "code",
39003941
"execution_count": 10,
3901-
"metadata": {},
3942+
"metadata": {
3943+
"vscode": {
3944+
"languageId": "r"
3945+
}
3946+
},
39023947
"outputs": [
39033948
{
39043949
"data": {
@@ -3929,7 +3974,11 @@
39293974
{
39303975
"cell_type": "code",
39313976
"execution_count": 11,
3932-
"metadata": {},
3977+
"metadata": {
3978+
"vscode": {
3979+
"languageId": "r"
3980+
}
3981+
},
39333982
"outputs": [
39343983
{
39353984
"name": "stderr",
@@ -3973,7 +4022,11 @@
39734022
{
39744023
"cell_type": "code",
39754024
"execution_count": 12,
3976-
"metadata": {},
4025+
"metadata": {
4026+
"vscode": {
4027+
"languageId": "r"
4028+
}
4029+
},
39774030
"outputs": [],
39784031
"source": [
39794032
"library(reticulate)\n",
@@ -3994,7 +4047,11 @@
39944047
{
39954048
"cell_type": "code",
39964049
"execution_count": 13,
3997-
"metadata": {},
4050+
"metadata": {
4051+
"vscode": {
4052+
"languageId": "r"
4053+
}
4054+
},
39984055
"outputs": [],
39994056
"source": [
40004057
"cortex_sc_adata <- convertFormat(cortex_sc_data, from=\"seurat\", to=\"anndata\", main_layer=\"counts\", drop_single_values=FALSE)\n",
@@ -4011,7 +4068,11 @@
40114068
{
40124069
"cell_type": "code",
40134070
"execution_count": 14,
4014-
"metadata": {},
4071+
"metadata": {
4072+
"vscode": {
4073+
"languageId": "r"
4074+
}
4075+
},
40154076
"outputs": [
40164077
{
40174078
"data": {
@@ -4037,7 +4098,11 @@
40374098
{
40384099
"cell_type": "code",
40394100
"execution_count": 15,
4040-
"metadata": {},
4101+
"metadata": {
4102+
"vscode": {
4103+
"languageId": "r"
4104+
}
4105+
},
40414106
"outputs": [
40424107
{
40434108
"data": {
@@ -4057,7 +4122,11 @@
40574122
{
40584123
"cell_type": "code",
40594124
"execution_count": 16,
4060-
"metadata": {},
4125+
"metadata": {
4126+
"vscode": {
4127+
"languageId": "r"
4128+
}
4129+
},
40614130
"outputs": [
40624131
{
40634132
"name": "stderr",
@@ -4104,7 +4173,11 @@
41044173
{
41054174
"cell_type": "code",
41064175
"execution_count": 17,
4107-
"metadata": {},
4176+
"metadata": {
4177+
"vscode": {
4178+
"languageId": "r"
4179+
}
4180+
},
41084181
"outputs": [
41094182
{
41104183
"data": {
@@ -4123,7 +4196,11 @@
41234196
{
41244197
"cell_type": "code",
41254198
"execution_count": 18,
4126-
"metadata": {},
4199+
"metadata": {
4200+
"vscode": {
4201+
"languageId": "r"
4202+
}
4203+
},
41274204
"outputs": [
41284205
{
41294206
"data": {
@@ -4143,7 +4220,11 @@
41434220
{
41444221
"cell_type": "code",
41454222
"execution_count": 19,
4146-
"metadata": {},
4223+
"metadata": {
4224+
"vscode": {
4225+
"languageId": "r"
4226+
}
4227+
},
41474228
"outputs": [
41484229
{
41494230
"name": "stderr",
@@ -4190,7 +4271,11 @@
41904271
{
41914272
"cell_type": "code",
41924273
"execution_count": 20,
4193-
"metadata": {},
4274+
"metadata": {
4275+
"vscode": {
4276+
"languageId": "r"
4277+
}
4278+
},
41944279
"outputs": [],
41954280
"source": [
41964281
"cortex_st_adata$obsm[\"proportions\"] <- stlvm$get_proportions()"
@@ -4199,7 +4284,11 @@
41994284
{
42004285
"cell_type": "code",
42014286
"execution_count": 21,
4202-
"metadata": {},
4287+
"metadata": {
4288+
"vscode": {
4289+
"languageId": "r"
4290+
}
4291+
},
42034292
"outputs": [
42044293
{
42054294
"data": {
@@ -4297,7 +4386,11 @@
42974386
{
42984387
"cell_type": "code",
42994388
"execution_count": 22,
4300-
"metadata": {},
4389+
"metadata": {
4390+
"vscode": {
4391+
"languageId": "r"
4392+
}
4393+
},
43014394
"outputs": [],
43024395
"source": [
43034396
"cortex_st_data[[\"predictions\"]] <- CreateAssayObject(data = t(py_to_r(cortex_st_adata$obsm$get(\"proportions\"))))"
@@ -4306,7 +4399,11 @@
43064399
{
43074400
"cell_type": "code",
43084401
"execution_count": 27,
4309-
"metadata": {},
4402+
"metadata": {
4403+
"vscode": {
4404+
"languageId": "r"
4405+
}
4406+
},
43104407
"outputs": [
43114408
{
43124409
"name": "stderr",
@@ -4360,7 +4457,11 @@
43604457
{
43614458
"cell_type": "code",
43624459
"execution_count": 30,
4363-
"metadata": {},
4460+
"metadata": {
4461+
"vscode": {
4462+
"languageId": "r"
4463+
}
4464+
},
43644465
"outputs": [
43654466
{
43664467
"name": "stderr",
@@ -4400,7 +4501,11 @@
44004501
{
44014502
"cell_type": "code",
44024503
"execution_count": 36,
4403-
"metadata": {},
4504+
"metadata": {
4505+
"vscode": {
4506+
"languageId": "r"
4507+
}
4508+
},
44044509
"outputs": [
44054510
{
44064511
"data": {
@@ -4510,7 +4615,11 @@
45104615
{
45114616
"cell_type": "code",
45124617
"execution_count": 43,
4513-
"metadata": {},
4618+
"metadata": {
4619+
"vscode": {
4620+
"languageId": "r"
4621+
}
4622+
},
45144623
"outputs": [],
45154624
"source": [
45164625
"ct_name <- \"L6 IT\"\n",
@@ -4527,7 +4636,11 @@
45274636
{
45284637
"cell_type": "code",
45294638
"execution_count": 44,
4530-
"metadata": {},
4639+
"metadata": {
4640+
"vscode": {
4641+
"languageId": "r"
4642+
}
4643+
},
45314644
"outputs": [],
45324645
"source": [
45334646
"filtered_st_data <- cortex_st_data[, indices]\n",
@@ -4537,7 +4650,11 @@
45374650
{
45384651
"cell_type": "code",
45394652
"execution_count": 45,
4540-
"metadata": {},
4653+
"metadata": {
4654+
"vscode": {
4655+
"languageId": "r"
4656+
}
4657+
},
45414658
"outputs": [
45424659
{
45434660
"name": "stderr",
@@ -4578,7 +4695,11 @@
45784695
{
45794696
"cell_type": "code",
45804697
"execution_count": 46,
4581-
"metadata": {},
4698+
"metadata": {
4699+
"vscode": {
4700+
"languageId": "r"
4701+
}
4702+
},
45824703
"outputs": [
45834704
{
45844705
"name": "stdout",
@@ -4612,7 +4733,11 @@
46124733
{
46134734
"cell_type": "code",
46144735
"execution_count": null,
4615-
"metadata": {},
4736+
"metadata": {
4737+
"vscode": {
4738+
"languageId": "r"
4739+
}
4740+
},
46164741
"outputs": [],
46174742
"source": []
46184743
}

0 commit comments

Comments
 (0)