Skip to content

Add example for selecting a subset from a backed adata #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 32 additions & 21 deletions docs/notebooks/demo_060121.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "yellow-earthquake",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"processing: 100%|██████████| 1/1 [00:00<00:00, 1.14it/s]"
"processing: 100%|██████████| 1/1 [00:00<00:00, 1.10it/s]"
]
},
{
Expand Down Expand Up @@ -109,17 +109,17 @@
},
{
"cell_type": "code",
"execution_count": 81,
"execution_count": 5,
"id": "legal-background",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.1472320556640625"
"3.620655059814453"
]
},
"execution_count": 81,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -130,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 82,
"execution_count": 6,
"id": "framed-webcam",
"metadata": {},
"outputs": [
Expand All @@ -139,8 +139,8 @@
"output_type": "stream",
"text": [
" total used free shared buff/cache available\r\n",
"Mem: 15Gi 9.0Gi 3.8Gi 880Mi 2.6Gi 5.1Gi\r\n",
"Swap: 2.0Gi 1.8Gi 250Mi\r\n"
"Mem: 15Gi 10Gi 504Mi 1.3Gi 4.7Gi 3.6Gi\r\n",
"Swap: 2.0Gi 1.5Gi 545Mi\r\n"
]
}
],
Expand All @@ -150,17 +150,17 @@
},
{
"cell_type": "code",
"execution_count": 83,
"execution_count": 7,
"id": "fifty-payday",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03861083984375002"
"0.04756774902343752"
]
},
"execution_count": 83,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -172,15 +172,15 @@
},
{
"cell_type": "code",
"execution_count": 84,
"execution_count": 8,
"id": "frozen-banner",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"processing: 100%|██████████| 8/8 [00:01<00:00, 6.26it/s]"
"processing: 100%|██████████| 6/6 [00:01<00:00, 5.23it/s]"
]
},
{
Expand All @@ -206,12 +206,24 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 21,
"id": "alpha-cooper",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"AnnData object with n_obs × n_vars = 999 × 24057 backed at 'data/normalized_subset.h5ad'\n",
" var: 'highly_variable'\n",
" uns: 'hvg'\n"
]
}
],
"source": [
"my_normalized_adata = normalized_adata[1:1000,:]"
"# if wanting to work with a subset of data in backed mode (here choosing the first 1000 cells):\n",
"normalized_adata = normalized_adata[:1000,:].copy(filename='./data/normalized_subset.h5ad')\n",
"print(normalized_adata)"
]
},
{
Expand All @@ -227,15 +239,15 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 18,
"id": "1fde50fb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"AnnData object with n_obs × n_vars = 1809 × 24057 backed at 'data/normalized16.h5ad'\n",
"AnnData object with n_obs × n_vars = 999 × 24057 backed at 'data/normalized_subset.h5ad'\n",
" var: 'highly_variable'\n",
" uns: 'hvg'\n"
]
Expand All @@ -259,15 +271,15 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 19,
"id": "caroline-indonesia",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2021-07-14 23:09:48,849 root WARNING Ignoring svd_solver, using IncrementalPCA\n"
"2021-07-23 16:19:25,832 root WARNING Ignoring svd_solver, using IncrementalPCA\n"
]
},
{
Expand Down Expand Up @@ -418,7 +430,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "0d929b8f",
"metadata": {},
Expand Down