Skip to content

Commit

Permalink
Merge branch 'main' into adata_0109
Browse files Browse the repository at this point in the history
  • Loading branch information
Zethson authored Aug 30, 2024
2 parents 0b00885 + 2bee7b5 commit 6355a26
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 52 deletions.
26 changes: 22 additions & 4 deletions docs/curate-df.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"id": "c7d74af9",
"metadata": {},
"source": [
"Define validation criteria and create a {class}`~lamindb.Curate` object."
"Define validation criteria and create a {class}`~lamindb.Curator` object."
]
},
{
Expand All @@ -109,7 +109,7 @@
"}\n",
"\n",
"# pass validation criteria\n",
"curate = ln.Curate.from_df(df, categoricals=categoricals)"
"curate = ln.Curator.from_df(df, categoricals=categoricals)"
]
},
{
Expand Down Expand Up @@ -340,7 +340,7 @@
},
"outputs": [],
"source": [
"curate = ln.Curate.from_anndata(\n",
"curate = ln.Curator.from_anndata(\n",
" adata, \n",
" var_index=bt.Gene.ensembl_gene_id, # validate var.index against Gene.ensembl_gene_id\n",
" categoricals=categoricals, \n",
Expand All @@ -362,6 +362,24 @@
"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 @@ -421,7 +439,7 @@
},
"outputs": [],
"source": [
"curate = ln.Curate.from_anndata(\n",
"curate = ln.Curator.from_anndata(\n",
" adata_validated, \n",
" var_index=bt.Gene.ensembl_gene_id, # validate var.index against Gene.ensembl_gene_id\n",
" categoricals=categoricals, \n",
Expand Down
17 changes: 9 additions & 8 deletions docs/introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's use the high-level {class}`~lamindb.Curate` class to curate a `DataFrame`."
"Let's use the high-level {class}`~lamindb.Curator` class to curate a `DataFrame`."
]
},
{
Expand All @@ -639,8 +639,8 @@
},
"outputs": [],
"source": [
"# construct a Curate object to validate & annotate a DataFrame\n",
"curate = ln.Curate.from_df(\n",
"# construct a Curator object to validate & annotate a DataFrame\n",
"curate = ln.Curator.from_df(\n",
" df_fixed_typo,\n",
" # define validation criteria\n",
" columns=ln.Feature.name, # map column names\n",
Expand Down Expand Up @@ -712,7 +712,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Had we used `ln.Curate` from the beginning, we would have caught the typo."
"Had we used `ln.Cuartor` from the beginning, we would have caught the typo."
]
},
{
Expand All @@ -725,8 +725,8 @@
},
"outputs": [],
"source": [
"# construct a Curate object to validate & annotate a DataFrame\n",
"curate = ln.Curate.from_df(\n",
"# construct a Curator object to validate & annotate a DataFrame\n",
"curate = ln.Curator.from_df(\n",
" df_with_typo,\n",
" # define validation criteria\n",
" columns=ln.Feature.name, # map column names\n",
Expand Down Expand Up @@ -810,7 +810,7 @@
"adata = ad.AnnData(df_fixed_typo[[\"CD8A\", \"CD4\", \"CD14\"]], obs=df_fixed_typo[[\"perturbation\"]])\n",
"\n",
"# create an annotation flow for an AnnData object\n",
"curate = ln.Curate.from_anndata(\n",
"curate = ln.Curator.from_anndata(\n",
" adata,\n",
" # define validation criteria\n",
" var_index=bt.Gene.symbol, # map .var.index onto Gene registry\n",
Expand Down Expand Up @@ -914,12 +914,13 @@
"adata = ad.AnnData(df[[\"CD8A\", \"CD4\", \"CD38\"]], obs=df[[\"perturbation\"]])\n",
"\n",
"# validate, curate and save a new artifact\n",
"curate = ln.Curate.from_anndata(\n",
"curate = ln.Curator.from_anndata(\n",
" adata,\n",
" var_index=bt.Gene.symbol,\n",
" categoricals={adata.obs.perturbation.name: ln.ULabel.name},\n",
" organism=\"human\"\n",
")\n",
"curate.add_validated_from_var_index()\n",
"curate.validate()\n",
"artifact2 = curate.save_artifact(description=\"my RNA-seq dataset 2\")"
]
Expand Down
Loading

0 comments on commit 6355a26

Please sign in to comment.