Skip to content

Commit

Permalink
🔥 Remove curator.add_validated_from (#2081)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun authored Oct 18, 2024
1 parent 76974dc commit a7027eb
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 186 deletions.
84 changes: 7 additions & 77 deletions docs/curate-df.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,50 +141,15 @@
"source": [
"## Register new metadata values\n",
"\n",
"If you see \"non-validated\" values, you'll need to decide whether to add them to your registries or \"fix\" them in your dataset.\n",
"\n",
"Because our current registries are still empty, we'll start by populating our {class}`~bionty.CellType` registry with values from a public ontology."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bcb388d8",
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [],
"source": [
"# this adds cell types that were validated based on a public ontology\n",
"curate.add_validated_from(\"cell_type\")"
]
},
{
"cell_type": "markdown",
"id": "5bcfc09f",
"metadata": {},
"source": [
"If we call `validate()` again, we see that one cell type still doesn't pass validation."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "104f9932",
"metadata": {},
"outputs": [],
"source": [
"curate.validate()"
"If you see \"non-validated\" values, you'll need to decide whether to add them to your registries or \"fix\" them in your dataset."
]
},
{
"cell_type": "markdown",
"id": "8c2417c7",
"metadata": {},
"source": [
"Hence, let's understand which cell type in the public ontology might be the actual match."
"For `cell_type`, we saw that 'cerebral pyramidal neuron' is not validated, let's understand which cell type in the public ontology might be the actual match."
]
},
{
Expand All @@ -198,7 +163,7 @@
},
"outputs": [],
"source": [
"# use a lookup object to get the correct spelling of categories from a public ontology\n",
"# use a lookup object to get the correct spelling of categories from a public ontology via `public=True`\n",
"lookup = curate.lookup(public=True)\n",
"lookup"
]
Expand Down Expand Up @@ -231,32 +196,15 @@
"outputs": [],
"source": [
"# fix the cell type\n",
"df.cell_type = df.cell_type.replace({\"cerebral pyramidal neuron\": cell_types.cerebral_cortex_pyramidal_neuron.name})\n",
"# now register curated and validated cell types\n",
"curate.add_validated_from(df.cell_type.name)"
"df.cell_type = df.cell_type.replace({\"cerebral pyramidal neuron\": cell_types.cerebral_cortex_pyramidal_neuron.name})"
]
},
{
"cell_type": "markdown",
"id": "752142a1",
"id": "1dc1028a",
"metadata": {},
"source": [
"Now, do the same for `\"assay_ontology_id`\" and `\"donor\"`."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ede057e8",
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [],
"source": [
"# this adds assays that were validated based on a public ontology\n",
"curate.add_validated_from(\"assay_ontology_id\")"
"For donor, we want to add the new donoers: 'D0001', 'D0002', 'DOOO3'"
]
},
{
Expand Down Expand Up @@ -362,24 +310,6 @@
"curate.validate()"
]
},
{
"cell_type": "markdown",
"id": "71a917d1",
"metadata": {},
"source": [
"Save the validated genes following the instruction:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e31dabcc",
"metadata": {},
"outputs": [],
"source": [
"curate.add_validated_from_var_index()"
]
},
{
"cell_type": "markdown",
"id": "614545ea",
Expand Down Expand Up @@ -535,7 +465,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.10.13"
},
"nbproject": {
"id": "WOK3vP0bNGLx",
Expand Down
17 changes: 0 additions & 17 deletions docs/curate-subclass.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,6 @@
"ehrcurator.validate()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide-output"
]
},
"outputs": [],
"source": [
"ehrcurator.add_validated_from(\"disease\")\n",
"ehrcurator.add_validated_from(\"phenotype\")\n",
"ehrcurator.add_validated_from(\"developmental_stage\")\n",
"\n",
"ehrcurator.validate()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading

0 comments on commit a7027eb

Please sign in to comment.