{
"cells": [
{
"cell_type": "markdown",
"id": "4d78551c-fecb-4264-8902-fbb99e12f7cd",
"metadata": {},
"source": [
"Tutorial 1: Finding Antibodies for Gating a Specific Cell Population\n",
"====================================================================\n",
"\n",
"In this tutorial, we demonstrate how to use the ImmunoPheno library to identify commercial antibodies that can be used to gate a specific cell population. Specifically, we are going to perform a data-driven analysis to identify antibodies that can separate transitional stage B cells from other B cells. Transitional stage B cells are an intermediate stage population of cells that occur after the pro-B cell stage but before the mature B cell stage during B cell development. Due to their low abundance and transitory character, they are a relatively difficult population to isolate in cell sorting experiments. \n",
"\n",
"Note that you may get slightly different results when running this tutorial, as the reference information in the ImmunoPhenoDB database is frequently updated."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "4f405cb0-99a7-44f5-807c-564c64a638de",
"metadata": {},
"outputs": [],
"source": [
"# Choose the adequate plotly renderer for visualizing plotly graphs in your system\n",
"import plotly.io as pio\n",
"pio.renderers.default = 'notebook_connected'"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "a50ec94f-4e9a-47e9-ac80-71e7a2ab4ea3",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import plotly.express as px\n",
"from immunopheno.connect import ImmunoPhenoDB_Connect"
]
},
{
"cell_type": "markdown",
"id": "f4754c09-9464-4311-81fd-42667f235b3d",
"metadata": {},
"source": [
"We first create an instance of `ImmunoPhenoDB_Connect` that will allows us to make queries to the ImmunoPheno database."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "680549ee-5fa1-4227-b555-ea6e6f534447",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loading necessary files...\n",
"Connecting to database...\n",
"Connected to database.\n"
]
}
],
"source": [
"cxn = ImmunoPhenoDB_Connect(\"http://www.immunopheno.org\")"
]
},
{
"cell_type": "markdown",
"id": "b56d7d31-767f-4186-80be-f3b59a51dc5b",
"metadata": {},
"source": [
"We can see a summary of what is currently in the database using the command `db_stats()`"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "9f768a75-7db7-43e8-901b-99f330cde962",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Database Statistics\n",
"===================\n",
"Number of experiments: 18\n",
"Number of tissues: 6\n",
"Number of cells: 115979\n",
"Number of antibodies: 646\n",
"Number of antibody targets: 294\n",
"Number of antibody clones: 390\n",
"Average number of experiments per antibody: 2.68\n"
]
}
],
"source": [
"cxn.db_stats()"
]
},
{
"cell_type": "markdown",
"id": "213475b1-1908-474c-8b0b-aa55ad41273d",
"metadata": {},
"source": [
"Let us now search for cell ontologies for which there is information in the database and that contain the word \"B cell\""
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d173d0a5-ead6-4b82-b588-d26f69f5e74a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idCL | \n",
" label | \n",
" idExperiment_used | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" CL:0000236 | \n",
" B cell | \n",
" 10 | \n",
"
\n",
" \n",
" | 1 | \n",
" CL:0000787 | \n",
" memory B cell | \n",
" 1,2,3,4,5,6,7,8,11,12,13,14,15,16 | \n",
"
\n",
" \n",
" | 2 | \n",
" CL:0000788 | \n",
" naive B cell | \n",
" 1,2,3,4,5,6,7,8,11,12,15,16,17,18 | \n",
"
\n",
" \n",
" | 3 | \n",
" CL:0000816 | \n",
" immature B cell | \n",
" 5,17,18 | \n",
"
\n",
" \n",
" | 4 | \n",
" CL:0000817 | \n",
" precursor B cell | \n",
" 10,12,18 | \n",
"
\n",
" \n",
" | 5 | \n",
" CL:0000818 | \n",
" transitional stage B cell | \n",
" 10,12 | \n",
"
\n",
" \n",
" | 6 | \n",
" CL:0000826 | \n",
" pro-B cell | \n",
" 12 | \n",
"
\n",
" \n",
" | 7 | \n",
" CL:0000955 | \n",
" pre-B-II cell | \n",
" 5 | \n",
"
\n",
" \n",
" | 8 | \n",
" CL:0000970 | \n",
" unswitched memory B cell | \n",
" 17,18 | \n",
"
\n",
" \n",
" | 9 | \n",
" CL:0000972 | \n",
" class switched memory B cell | \n",
" 17,18 | \n",
"
\n",
" \n",
" | 10 | \n",
" CL:2000006 | \n",
" tonsil germinal center B cell | \n",
" 4,5 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idCL label \\\n",
"0 CL:0000236 B cell \n",
"1 CL:0000787 memory B cell \n",
"2 CL:0000788 naive B cell \n",
"3 CL:0000816 immature B cell \n",
"4 CL:0000817 precursor B cell \n",
"5 CL:0000818 transitional stage B cell \n",
"6 CL:0000826 pro-B cell \n",
"7 CL:0000955 pre-B-II cell \n",
"8 CL:0000970 unswitched memory B cell \n",
"9 CL:0000972 class switched memory B cell \n",
"10 CL:2000006 tonsil germinal center B cell \n",
"\n",
" idExperiment_used \n",
"0 10 \n",
"1 1,2,3,4,5,6,7,8,11,12,13,14,15,16 \n",
"2 1,2,3,4,5,6,7,8,11,12,15,16,17,18 \n",
"3 5,17,18 \n",
"4 10,12,18 \n",
"5 10,12 \n",
"6 12 \n",
"7 5 \n",
"8 17,18 \n",
"9 17,18 \n",
"10 4,5 "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.which_celltypes(\"B cell\")"
]
},
{
"cell_type": "markdown",
"id": "728c5dfb-d4f0-475b-8394-3718ba526a2c",
"metadata": {},
"source": [
"We see that the [OBO Foundry Cell Ontology](https://www.ebi.ac.uk/ols4/ontologies/cl) ID for transitional stage B cells is `CL:0000818` and there is currently information from 2 experiments in the ImmunoPheno database. We can find more information about these experiments using the command `find_experiments()`. For example,"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c3520095-4b13-4981-a02e-99de76725ad7",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idExperiment | \n",
" nameExp | \n",
" typeExp | \n",
" pmid | \n",
" doi | \n",
" idBTO | \n",
" tissue | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 10 | \n",
" An immunophenotype-coupled transcriptomic atla... | \n",
" CITE | \n",
" 38514887 | \n",
" https://doi.org/10.1038/s41590-024-01782-4 | \n",
" BTO:0000141 | \n",
" bone marrow | \n",
"
\n",
" \n",
" | 1 | \n",
" 12 | \n",
" Comprehensive Integration of Single-Cell Data | \n",
" CITE | \n",
" 31178118 | \n",
" https://doi.org/10.1016/j.cell.2019.05.031 | \n",
" BTO:0000141 | \n",
" bone marrow | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idExperiment nameExp typeExp \\\n",
"0 10 An immunophenotype-coupled transcriptomic atla... CITE \n",
"1 12 Comprehensive Integration of Single-Cell Data CITE \n",
"\n",
" pmid doi idBTO \\\n",
"0 38514887 https://doi.org/10.1038/s41590-024-01782-4 BTO:0000141 \n",
"1 31178118 https://doi.org/10.1016/j.cell.2019.05.031 BTO:0000141 \n",
"\n",
" tissue \n",
"0 bone marrow \n",
"1 bone marrow "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.find_experiments(idCL=['CL:0000818'])"
]
},
{
"cell_type": "markdown",
"id": "af1cda07-a197-4c88-afcb-fe406e807ab2",
"metadata": {},
"source": [
"As expected, all datasets containing information about transitional stage B cells are from the bone marrow. \n",
"\n",
"The cell ontology ID of B cells is `CL:0000236`. This ontology contains transitional stage B cells (`CL:0000818`) as a descendant ontology:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "a07f94c1-ee09-4e06-b4b3-28432a270a76",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cxn.plot_db_graph(root=\"CL:0000236\")"
]
},
{
"cell_type": "markdown",
"id": "ee3e8627-6bd7-4214-bb33-7de39610f41f",
"metadata": {},
"source": [
"In this graph, the nodes in red indicate cell ontologies for which there is data in the ImmunoPhenoDB database explicitly annotated with those ontologies. Nodes in blue indicate cell ontologies corresponding to derived annotations from the annotations in the ImmunoPhenoDB database.\n",
"\n",
"We now look for antibodies that distinguish transitional B cells from other B cells in present in the bone marrow,"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "3dfeb56e-1da3-4a4f-8de0-c3f2b001b20f",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" target | \n",
" coeff | \n",
" stderr | \n",
" p_val | \n",
" q_val | \n",
" CL:0000818 | \n",
" CL:0000236 | \n",
"
\n",
" \n",
" \n",
" \n",
" | AB_2750556 | \n",
" CD38 | \n",
" 7.109 | \n",
" 0.977 | \n",
" 0.000000e+00 | \n",
" 0.000000e+00 | \n",
" 1.000000 | \n",
" 0.440799 | \n",
"
\n",
" \n",
" | AB_2750381 | \n",
" CD102 | \n",
" 1.106 | \n",
" 0.208 | \n",
" 1.007000e-07 | \n",
" 2.135600e-06 | \n",
" 0.354232 | \n",
" 0.241144 | \n",
"
\n",
" \n",
" | AB_2734286 | \n",
" CD10 | \n",
" 0.790 | \n",
" 0.139 | \n",
" 1.410000e-08 | \n",
" 4.967000e-07 | \n",
" 0.952978 | \n",
" 0.684974 | \n",
"
\n",
" \n",
" | AB_2783249 | \n",
" CD63 | \n",
" 0.781 | \n",
" 0.141 | \n",
" 3.260000e-08 | \n",
" 8.639000e-07 | \n",
" 0.227273 | \n",
" 0.089002 | \n",
"
\n",
" \n",
" | AB_2734267 | \n",
" CD45RA | \n",
" 0.687 | \n",
" 0.131 | \n",
" 1.535000e-07 | \n",
" 2.712700e-06 | \n",
" 0.806886 | \n",
" 0.915740 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | AB_2750357 | \n",
" CD197 | \n",
" -1.271 | \n",
" 0.546 | \n",
" 1.998851e-02 | \n",
" 9.444172e-02 | \n",
" 0.066667 | \n",
" 0.103809 | \n",
"
\n",
" \n",
" | AB_2749971 | \n",
" CD11c | \n",
" -1.280 | \n",
" 0.703 | \n",
" 6.844322e-02 | \n",
" 2.418327e-01 | \n",
" 0.000000 | \n",
" 0.192551 | \n",
"
\n",
" \n",
" | AB_2750000 | \n",
" CD27 | \n",
" -2.912 | \n",
" 0.732 | \n",
" 6.983760e-05 | \n",
" 8.225319e-04 | \n",
" 0.000000 | \n",
" 0.677479 | \n",
"
\n",
" \n",
" | AB_2749972 | \n",
" CD34 | \n",
" -3.383 | \n",
" 0.800 | \n",
" 2.359320e-05 | \n",
" 3.126100e-04 | \n",
" 0.066667 | \n",
" 0.290628 | \n",
"
\n",
" \n",
" | AB_2750347 | \n",
" CD79b | \n",
" -5.646 | \n",
" 0.870 | \n",
" 1.000000e-10 | \n",
" 4.500000e-09 | \n",
" 0.200000 | \n",
" 0.704257 | \n",
"
\n",
" \n",
"
\n",
"
106 rows × 7 columns
\n",
"
"
],
"text/plain": [
" target coeff stderr p_val q_val CL:0000818 \\\n",
"AB_2750556 CD38 7.109 0.977 0.000000e+00 0.000000e+00 1.000000 \n",
"AB_2750381 CD102 1.106 0.208 1.007000e-07 2.135600e-06 0.354232 \n",
"AB_2734286 CD10 0.790 0.139 1.410000e-08 4.967000e-07 0.952978 \n",
"AB_2783249 CD63 0.781 0.141 3.260000e-08 8.639000e-07 0.227273 \n",
"AB_2734267 CD45RA 0.687 0.131 1.535000e-07 2.712700e-06 0.806886 \n",
"... ... ... ... ... ... ... \n",
"AB_2750357 CD197 -1.271 0.546 1.998851e-02 9.444172e-02 0.066667 \n",
"AB_2749971 CD11c -1.280 0.703 6.844322e-02 2.418327e-01 0.000000 \n",
"AB_2750000 CD27 -2.912 0.732 6.983760e-05 8.225319e-04 0.000000 \n",
"AB_2749972 CD34 -3.383 0.800 2.359320e-05 3.126100e-04 0.066667 \n",
"AB_2750347 CD79b -5.646 0.870 1.000000e-10 4.500000e-09 0.200000 \n",
"\n",
" CL:0000236 \n",
"AB_2750556 0.440799 \n",
"AB_2750381 0.241144 \n",
"AB_2734286 0.684974 \n",
"AB_2783249 0.089002 \n",
"AB_2734267 0.915740 \n",
"... ... \n",
"AB_2750357 0.103809 \n",
"AB_2749971 0.192551 \n",
"AB_2750000 0.677479 \n",
"AB_2749972 0.290628 \n",
"AB_2750347 0.704257 \n",
"\n",
"[106 rows x 7 columns]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result_df1, plot_dict1 = cxn.find_antibodies(id_CLs=[\"CL:0000818\"], background_id_CLs=[\"CL:0000236\"], idBTO=[\"BTO:0000141\"])\n",
"result_df1"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "06216a5c-6524-4431-a03d-ef772670ad8f",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" target | \n",
" coeff | \n",
" stderr | \n",
" p_val | \n",
" q_val | \n",
" CL:0000818 | \n",
" CL:0000236 | \n",
"
\n",
" \n",
" \n",
" \n",
" | AB_2750556 | \n",
" CD38 | \n",
" 7.109 | \n",
" 0.977 | \n",
" 0.000000e+00 | \n",
" 0.000000e+00 | \n",
" 1.000000 | \n",
" 0.440799 | \n",
"
\n",
" \n",
" | AB_2734286 | \n",
" CD10 | \n",
" 0.790 | \n",
" 0.139 | \n",
" 1.410000e-08 | \n",
" 4.967000e-07 | \n",
" 0.952978 | \n",
" 0.684974 | \n",
"
\n",
" \n",
" | AB_2734267 | \n",
" CD45RA | \n",
" 0.687 | \n",
" 0.131 | \n",
" 1.535000e-07 | \n",
" 2.712700e-06 | \n",
" 0.806886 | \n",
" 0.915740 | \n",
"
\n",
" \n",
" | AB_2832712 | \n",
" HLA-DR DP DQ | \n",
" 0.491 | \n",
" 0.099 | \n",
" 7.618000e-07 | \n",
" 1.153550e-05 | \n",
" 0.998433 | \n",
" 0.958333 | \n",
"
\n",
" \n",
" | AB_2734256 | \n",
" CD19 | \n",
" -0.622 | \n",
" 0.282 | \n",
" 2.749450e-02 | \n",
" 1.040863e-01 | \n",
" 1.000000 | \n",
" 0.986301 | \n",
"
\n",
" \n",
" | AB_2750001 | \n",
" HLA-DR | \n",
" -1.189 | \n",
" 0.336 | \n",
" 4.054752e-04 | \n",
" 3.907306e-03 | \n",
" 0.866667 | \n",
" 0.622432 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" target coeff stderr p_val q_val \\\n",
"AB_2750556 CD38 7.109 0.977 0.000000e+00 0.000000e+00 \n",
"AB_2734286 CD10 0.790 0.139 1.410000e-08 4.967000e-07 \n",
"AB_2734267 CD45RA 0.687 0.131 1.535000e-07 2.712700e-06 \n",
"AB_2832712 HLA-DR DP DQ 0.491 0.099 7.618000e-07 1.153550e-05 \n",
"AB_2734256 CD19 -0.622 0.282 2.749450e-02 1.040863e-01 \n",
"AB_2750001 HLA-DR -1.189 0.336 4.054752e-04 3.907306e-03 \n",
"\n",
" CL:0000818 CL:0000236 \n",
"AB_2750556 1.000000 0.440799 \n",
"AB_2734286 0.952978 0.684974 \n",
"AB_2734267 0.806886 0.915740 \n",
"AB_2832712 0.998433 0.958333 \n",
"AB_2734256 1.000000 0.986301 \n",
"AB_2750001 0.866667 0.622432 "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result_df1[result_df1[\"CL:0000818\"]>0.8]"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "b0e11c39-404b-43d5-bafb-4a408ac55c25",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot_dict1[\"CL:0000818\"]"
]
},
{
"cell_type": "markdown",
"id": "5bf95e6b-0a33-4f4f-9e8f-4915656ea56e",
"metadata": {},
"source": [
"`find_antibodies()` runs a linear mixed effects model to identify antobody levels that differ between the two populations. Positive (negative) coefficients indicate antibodies upreguated (downregulated) in the cell populations specified in `id_CLs` and their descendant cell ontologies, while negative coefficients. The optional `idBTO=\"BTO:000141\"` argument restricts the analysis to data from bone marrow, which correspond to the [BRENDA tissue ontology](https://www.ebi.ac.uk/ols4/ontologies/bto) ID `BTO:000141` (as it can be seen from the output of `find_experiments()` above). If a tissue or list of tissues is not specified, all tissues in the ImmunoPheno database are considered. We observe that among the 106 antibodies that were tested, anti-CD38 `AB:2750556` and anti-CD10 `AB:2734286` are significantly upregulated in transitional stage B cells and detected in >95% of this population, compared to the general B-cell population in the bone marrow. \n",
"\n",
"We can now look at which cell populations in the bone marrow are positive for these two antibodies:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "5c00cd41-b10b-4eab-9dfb-faf124bc212d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"result_dict, plot_dict_ct = cxn.find_celltypes([\"AB_2750556\", \"AB_2734286\"], idBTO=[\"BTO:0000141\"])\n",
"plot_dict_ct[\"AB_2750556\"]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8a0bc38d-a48d-486b-9dac-5c3764f2d868",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot_dict_ct[\"AB_2734286\"]"
]
},
{
"cell_type": "markdown",
"id": "85c5ae9e-3bc2-4375-94fe-bb8f64dd4238",
"metadata": {},
"source": [
"`find_celltypes()` uses a linear mixed effects model to identify cell populations on which a given antibody or set of antibodies is upregulated or downregulated in comparisson to all the other cell populations. We can look at the results of the test in the table returned by `find_celltypes()`"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "48aa9889-f7f9-4572-8520-4c5955ee2840",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" cellType | \n",
" coeff | \n",
" stderr | \n",
" p_val | \n",
" q_val | \n",
" expressed | \n",
"
\n",
" \n",
" \n",
" \n",
" | CL:0000980 | \n",
" plasmablast | \n",
" 12.555 | \n",
" 1.253 | \n",
" 1.262152e-23 | \n",
" 3.029164e-23 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | CL:0001054 | \n",
" CD14-positive monocyte | \n",
" 6.667 | \n",
" 0.127 | \n",
" 0.000000e+00 | \n",
" 0.000000e+00 | \n",
" 0.993635 | \n",
"
\n",
" \n",
" | CL:0000818 | \n",
" transitional stage B cell | \n",
" 6.598 | \n",
" 0.920 | \n",
" 0.000000e+00 | \n",
" 0.000000e+00 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | CL:0000817 | \n",
" precursor B cell | \n",
" 6.369 | \n",
" 1.400 | \n",
" 5.370900e-06 | \n",
" 8.593500e-06 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | CL:0000557 | \n",
" granulocyte monocyte progenitor cell | \n",
" 5.488 | \n",
" 0.346 | \n",
" 1.111304e-56 | \n",
" 5.334258e-56 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | CL:0000549 | \n",
" basophilic erythroblast | \n",
" 4.453 | \n",
" 2.916 | \n",
" 1.268099e-01 | \n",
" 1.521719e-01 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | CL:0002032 | \n",
" hematopoietic oligopotent progenitor cell | \n",
" 4.384 | \n",
" 1.909 | \n",
" 2.166646e-02 | \n",
" 3.058794e-02 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | CL:0000826 | \n",
" pro-B cell | \n",
" 4.141 | \n",
" 1.909 | \n",
" 3.011700e-02 | \n",
" 4.015600e-02 | \n",
" 0.857143 | \n",
"
\n",
" \n",
" | CL:0000623 | \n",
" natural killer cell | \n",
" 3.553 | \n",
" 0.251 | \n",
" 2.337678e-45 | \n",
" 8.014897e-45 | \n",
" 0.824645 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" cellType coeff stderr \\\n",
"CL:0000980 plasmablast 12.555 1.253 \n",
"CL:0001054 CD14-positive monocyte 6.667 0.127 \n",
"CL:0000818 transitional stage B cell 6.598 0.920 \n",
"CL:0000817 precursor B cell 6.369 1.400 \n",
"CL:0000557 granulocyte monocyte progenitor cell 5.488 0.346 \n",
"CL:0000549 basophilic erythroblast 4.453 2.916 \n",
"CL:0002032 hematopoietic oligopotent progenitor cell 4.384 1.909 \n",
"CL:0000826 pro-B cell 4.141 1.909 \n",
"CL:0000623 natural killer cell 3.553 0.251 \n",
"\n",
" p_val q_val expressed \n",
"CL:0000980 1.262152e-23 3.029164e-23 1.000000 \n",
"CL:0001054 0.000000e+00 0.000000e+00 0.993635 \n",
"CL:0000818 0.000000e+00 0.000000e+00 1.000000 \n",
"CL:0000817 5.370900e-06 8.593500e-06 1.000000 \n",
"CL:0000557 1.111304e-56 5.334258e-56 1.000000 \n",
"CL:0000549 1.268099e-01 1.521719e-01 1.000000 \n",
"CL:0002032 2.166646e-02 3.058794e-02 1.000000 \n",
"CL:0000826 3.011700e-02 4.015600e-02 0.857143 \n",
"CL:0000623 2.337678e-45 8.014897e-45 0.824645 "
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result_dict[\"AB_2750556\"][result_dict[\"AB_2750556\"][\"expressed\"]>0.8]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "66958ef9-cfbe-479f-be7a-e06e43cf13b7",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" cellType | \n",
" coeff | \n",
" stderr | \n",
" p_val | \n",
" q_val | \n",
" expressed | \n",
"
\n",
" \n",
" \n",
" \n",
" | CL:0010001 | \n",
" stromal cell of bone marrow | \n",
" 9.564 | \n",
" 0.122 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.968978 | \n",
"
\n",
" \n",
" | CL:0000818 | \n",
" transitional stage B cell | \n",
" 8.165 | \n",
" 0.115 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.952978 | \n",
"
\n",
" \n",
" | CL:0000817 | \n",
" precursor B cell | \n",
" 7.513 | \n",
" 0.106 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.886968 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" cellType coeff stderr p_val q_val \\\n",
"CL:0010001 stromal cell of bone marrow 9.564 0.122 0.0 0.0 \n",
"CL:0000818 transitional stage B cell 8.165 0.115 0.0 0.0 \n",
"CL:0000817 precursor B cell 7.513 0.106 0.0 0.0 \n",
"\n",
" expressed \n",
"CL:0010001 0.968978 \n",
"CL:0000818 0.952978 \n",
"CL:0000817 0.886968 "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result_dict[\"AB_2734286\"][result_dict[\"AB_2734286\"][\"expressed\"]>0.8]"
]
},
{
"cell_type": "markdown",
"id": "4fd6ae76-5632-45a6-89a1-05b1ed997bc2",
"metadata": {},
"source": [
"We observe that among B cell populations in the bone marrow, pro-B cells and precursor B cells are also positive for `AB:2750556` and `AB:2734286`. We would therefore like to identify another antibody that we can combine with these antibodies to fully separate transitional B cells from other B cell populations in the bone marrow. We can achieve this by running again `find_antibodies()`, this time using pro-B cells and precursor B cells as background cell populations."
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "724deb74-d7b1-4979-91f4-07ada706aa0f",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" target | \n",
" coeff | \n",
" stderr | \n",
" p_val | \n",
" q_val | \n",
" CL:0000818 | \n",
" CL:0000826 | \n",
" CL:0000817 | \n",
"
\n",
" \n",
" \n",
" \n",
" | AB_2734256 | \n",
" CD19 | \n",
" 3.496 | \n",
" 0.817 | \n",
" 1.881360e-05 | \n",
" 1.552120e-04 | \n",
" 1.000000 | \n",
" 0.000000 | \n",
" 1.000000 | \n",
"
\n",
" \n",
" | AB_2750001 | \n",
" HLA-DR | \n",
" 3.292 | \n",
" 1.164 | \n",
" 4.679777e-03 | \n",
" 2.316489e-02 | \n",
" 0.866667 | \n",
" 0.142857 | \n",
" 0.769231 | \n",
"
\n",
" \n",
" | AB_2734267 | \n",
" CD45RA | \n",
" 2.345 | \n",
" 0.232 | \n",
" 4.725649e-24 | \n",
" 2.339196e-22 | \n",
" 0.806886 | \n",
" 0.428571 | \n",
" 0.588235 | \n",
"
\n",
" \n",
" | AB_2750381 | \n",
" CD102 | \n",
" 1.877 | \n",
" 0.225 | \n",
" 7.333399e-17 | \n",
" 0.000000e+00 | \n",
" 0.354232 | \n",
" NaN | \n",
" 0.162234 | \n",
"
\n",
" \n",
" | AB_2750347 | \n",
" CD79b | \n",
" 1.554 | \n",
" 1.015 | \n",
" 1.257598e-01 | \n",
" 2.895400e-01 | \n",
" 0.200000 | \n",
" 0.142857 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | AB_2800911 | \n",
" CD305 | \n",
" -0.940 | \n",
" 0.230 | \n",
" 4.528130e-05 | \n",
" 3.448343e-04 | \n",
" 0.683386 | \n",
" NaN | \n",
" 0.764628 | \n",
"
\n",
" \n",
" | AB_2750000 | \n",
" CD27 | \n",
" -1.325 | \n",
" 0.588 | \n",
" 2.427334e-02 | \n",
" 8.900226e-02 | \n",
" 0.000000 | \n",
" 0.142857 | \n",
" 0.153846 | \n",
"
\n",
" \n",
" | AB_2734247 | \n",
" CD4 | \n",
" -2.238 | \n",
" 0.962 | \n",
" 2.003938e-02 | \n",
" 7.630377e-02 | \n",
" 0.066667 | \n",
" 0.428571 | \n",
" 0.230769 | \n",
"
\n",
" \n",
" | AB_2734366 | \n",
" CD127 | \n",
" -2.385 | \n",
" 0.772 | \n",
" 2.005962e-03 | \n",
" 1.103279e-02 | \n",
" 0.000000 | \n",
" 0.714286 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" | AB_2749972 | \n",
" CD34 | \n",
" -10.517 | \n",
" 0.984 | \n",
" 1.110806e-26 | \n",
" 1.099698e-24 | \n",
" 0.066667 | \n",
" 0.857143 | \n",
" 0.923077 | \n",
"
\n",
" \n",
"
\n",
"
99 rows × 8 columns
\n",
"
"
],
"text/plain": [
" target coeff stderr p_val q_val CL:0000818 \\\n",
"AB_2734256 CD19 3.496 0.817 1.881360e-05 1.552120e-04 1.000000 \n",
"AB_2750001 HLA-DR 3.292 1.164 4.679777e-03 2.316489e-02 0.866667 \n",
"AB_2734267 CD45RA 2.345 0.232 4.725649e-24 2.339196e-22 0.806886 \n",
"AB_2750381 CD102 1.877 0.225 7.333399e-17 0.000000e+00 0.354232 \n",
"AB_2750347 CD79b 1.554 1.015 1.257598e-01 2.895400e-01 0.200000 \n",
"... ... ... ... ... ... ... \n",
"AB_2800911 CD305 -0.940 0.230 4.528130e-05 3.448343e-04 0.683386 \n",
"AB_2750000 CD27 -1.325 0.588 2.427334e-02 8.900226e-02 0.000000 \n",
"AB_2734247 CD4 -2.238 0.962 2.003938e-02 7.630377e-02 0.066667 \n",
"AB_2734366 CD127 -2.385 0.772 2.005962e-03 1.103279e-02 0.000000 \n",
"AB_2749972 CD34 -10.517 0.984 1.110806e-26 1.099698e-24 0.066667 \n",
"\n",
" CL:0000826 CL:0000817 \n",
"AB_2734256 0.000000 1.000000 \n",
"AB_2750001 0.142857 0.769231 \n",
"AB_2734267 0.428571 0.588235 \n",
"AB_2750381 NaN 0.162234 \n",
"AB_2750347 0.142857 0.000000 \n",
"... ... ... \n",
"AB_2800911 NaN 0.764628 \n",
"AB_2750000 0.142857 0.153846 \n",
"AB_2734247 0.428571 0.230769 \n",
"AB_2734366 0.714286 0.000000 \n",
"AB_2749972 0.857143 0.923077 \n",
"\n",
"[99 rows x 8 columns]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result_df1, plot_dict1 = cxn.find_antibodies(id_CLs=[\"CL:0000818\"], background_id_CLs=[\"CL:0000826\", \"CL:0000817\"], idBTO=[\"BTO:0000141\"])\n",
"result_df1"
]
},
{
"cell_type": "markdown",
"id": "57576b41-b4f3-437b-a85c-f3adc3838264",
"metadata": {},
"source": [
"From this analysis, we observe that anti-CD34 antibody `AB:2749972` is detected in >85% of the precursor B cells and pro-B cells, but only in 7% of the transitional stage B cells. Plotting the distribution of normalized expression levels confirms this observation,"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "df26e24d-e54a-46f3-9cb1-9660f34b17b6",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"result_dict, plot_dict_ct = cxn.find_celltypes([\"AB_2749972\"], idBTO=[\"BTO:0000141\"])\n",
"plot_dict_ct[\"AB_2749972\"]"
]
},
{
"cell_type": "markdown",
"id": "5a61462e-2ba0-48c4-b051-84298b6cbb7a",
"metadata": {},
"source": [
"We therefore conclude that using a combination of the antibodies `AB:2750556`, `AB:2734286`, and `AB:2749972` is an effective strategy to isolate transtional B cells in the bone marrow. Let us know now look for some more information about these antibodies:"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "b2628ef2-7280-4262-af4a-86f6eb1dad8a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idAntibody | \n",
" abName | \n",
" abTarget | \n",
" clonality | \n",
" citation | \n",
" comments | \n",
" cloneID | \n",
" host | \n",
" vendor | \n",
" catalogNum | \n",
" idExperiment_used | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" AB_2750556 | \n",
" TotalSeq(TM)-A0557 anti-mouse CD38 | \n",
" CD38 | \n",
" monoclonal | \n",
" (BioLegend Cat# 102733, RRID:AB_2750556) | \n",
" Applications: PG | \n",
" 90 | \n",
" rat | \n",
" BioLegend | \n",
" 102733 | \n",
" 12 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idAntibody abName abTarget clonality \\\n",
"0 AB_2750556 TotalSeq(TM)-A0557 anti-mouse CD38 CD38 monoclonal \n",
"\n",
" citation comments cloneID host \\\n",
"0 (BioLegend Cat# 102733, RRID:AB_2750556) Applications: PG 90 rat \n",
"\n",
" vendor catalogNum idExperiment_used \n",
"0 BioLegend 102733 12 "
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.which_antibodies(\"AB_2750556\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "9e24abce-b706-476b-8574-0e036df39149",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idAntibody | \n",
" abName | \n",
" abTarget | \n",
" clonality | \n",
" citation | \n",
" comments | \n",
" cloneID | \n",
" host | \n",
" vendor | \n",
" catalogNum | \n",
" idExperiment_used | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" AB_2734286 | \n",
" TotalSeq(TM)-A0062 anti-human CD10 | \n",
" CD10 | \n",
" monoclonal | \n",
" (BioLegend Cat# 312231, RRID:AB_2734286) | \n",
" Applications: PG | \n",
" HI10a | \n",
" mouse | \n",
" BioLegend | \n",
" 312231 | \n",
" 7,10 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idAntibody abName abTarget clonality \\\n",
"0 AB_2734286 TotalSeq(TM)-A0062 anti-human CD10 CD10 monoclonal \n",
"\n",
" citation comments cloneID host \\\n",
"0 (BioLegend Cat# 312231, RRID:AB_2734286) Applications: PG HI10a mouse \n",
"\n",
" vendor catalogNum idExperiment_used \n",
"0 BioLegend 312231 7,10 "
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.which_antibodies(\"AB_2734286\")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "0f93c927-f439-46a6-9a4e-ca96c0bca65a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idAntibody | \n",
" abName | \n",
" abTarget | \n",
" clonality | \n",
" citation | \n",
" comments | \n",
" cloneID | \n",
" host | \n",
" vendor | \n",
" catalogNum | \n",
" idExperiment_used | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" AB_2749972 | \n",
" TotalSeq(TM)-A0054 anti-human CD34 | \n",
" CD34 | \n",
" monoclonal | \n",
" (BioLegend Cat# 343537, RRID:AB_2749972) | \n",
" Applications: PG | \n",
" 581 | \n",
" mouse | \n",
" BioLegend | \n",
" 343537 | \n",
" 7,12 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idAntibody abName abTarget clonality \\\n",
"0 AB_2749972 TotalSeq(TM)-A0054 anti-human CD34 CD34 monoclonal \n",
"\n",
" citation comments cloneID host \\\n",
"0 (BioLegend Cat# 343537, RRID:AB_2749972) Applications: PG 581 mouse \n",
"\n",
" vendor catalogNum idExperiment_used \n",
"0 BioLegend 343537 7,12 "
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.which_antibodies(\"AB_2749972\")"
]
},
{
"cell_type": "markdown",
"id": "a71fc3a9-1984-4774-a77f-565ebe08ced2",
"metadata": {},
"source": [
"Finally, we can find in which experiments of the ImmunoPhenoDB database these antibodies have been used:"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "a8be399b-0f58-4e3a-94bd-11664e8e8aee",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idExperiment | \n",
" nameExp | \n",
" typeExp | \n",
" pmid | \n",
" doi | \n",
" idBTO | \n",
" tissue | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 12 | \n",
" Comprehensive Integration of Single-Cell Data | \n",
" CITE | \n",
" 31178118 | \n",
" https://doi.org/10.1016/j.cell.2019.05.031 | \n",
" BTO:0000141 | \n",
" bone marrow | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idExperiment nameExp typeExp \\\n",
"0 12 Comprehensive Integration of Single-Cell Data CITE \n",
"\n",
" pmid doi idBTO \\\n",
"0 31178118 https://doi.org/10.1016/j.cell.2019.05.031 BTO:0000141 \n",
"\n",
" tissue \n",
"0 bone marrow "
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.find_experiments(ab=[\"AB_2750556\"])"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "f347f0fa-2de9-4e81-9114-46726ac18e0b",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idExperiment | \n",
" nameExp | \n",
" typeExp | \n",
" pmid | \n",
" doi | \n",
" idBTO | \n",
" tissue | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 7 | \n",
" PBMC from influenza vaccination | \n",
" CITE | \n",
" 32094927 | \n",
" https://doi.org/10.1038/s41591-020-0769-8 | \n",
" BTO:0001025 | \n",
" peripheral blood mononuclear cell | \n",
"
\n",
" \n",
" | 1 | \n",
" 10 | \n",
" An immunophenotype-coupled transcriptomic atla... | \n",
" CITE | \n",
" 38514887 | \n",
" https://doi.org/10.1038/s41590-024-01782-4 | \n",
" BTO:0000141 | \n",
" bone marrow | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idExperiment nameExp typeExp \\\n",
"0 7 PBMC from influenza vaccination CITE \n",
"1 10 An immunophenotype-coupled transcriptomic atla... CITE \n",
"\n",
" pmid doi idBTO \\\n",
"0 32094927 https://doi.org/10.1038/s41591-020-0769-8 BTO:0001025 \n",
"1 38514887 https://doi.org/10.1038/s41590-024-01782-4 BTO:0000141 \n",
"\n",
" tissue \n",
"0 peripheral blood mononuclear cell \n",
"1 bone marrow "
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.find_experiments(ab=[\"AB_2734286\"])"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "a91e629e-be82-49e9-9ece-c92378ad025d",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idExperiment | \n",
" nameExp | \n",
" typeExp | \n",
" pmid | \n",
" doi | \n",
" idBTO | \n",
" tissue | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 7 | \n",
" PBMC from influenza vaccination | \n",
" CITE | \n",
" 32094927 | \n",
" https://doi.org/10.1038/s41591-020-0769-8 | \n",
" BTO:0001025 | \n",
" peripheral blood mononuclear cell | \n",
"
\n",
" \n",
" | 1 | \n",
" 12 | \n",
" Comprehensive Integration of Single-Cell Data | \n",
" CITE | \n",
" 31178118 | \n",
" https://doi.org/10.1016/j.cell.2019.05.031 | \n",
" BTO:0000141 | \n",
" bone marrow | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" idExperiment nameExp typeExp \\\n",
"0 7 PBMC from influenza vaccination CITE \n",
"1 12 Comprehensive Integration of Single-Cell Data CITE \n",
"\n",
" pmid doi idBTO \\\n",
"0 32094927 https://doi.org/10.1038/s41591-020-0769-8 BTO:0001025 \n",
"1 31178118 https://doi.org/10.1016/j.cell.2019.05.031 BTO:0000141 \n",
"\n",
" tissue \n",
"0 peripheral blood mononuclear cell \n",
"1 bone marrow "
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cxn.find_experiments(ab=[\"AB_2749972\"])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}