diff --git a/requirements.txt b/requirements.txt index 5f32c22..4c24d21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,13 @@ +# jupyter_contrib_nbextensions imports pkg_resources, which setuptools removed +# in v81; the python:3.13-slim base image no longer ships setuptools at all. +setuptools<81 awscli biopython ipywidgets jupyter_contrib_nbextensions nbconvert==6.5.0 -openpyxl xlrd statsmodels -onecodex[all,reports]==0.19.3 +onecodex[all,reports]==1.1.0 taxonomy widgetsnbextension diff --git a/test/notebooks/example.ipynb b/test/notebooks/example.ipynb index 71c4861..d981845 100644 --- a/test/notebooks/example.ipynb +++ b/test/notebooks/example.ipynb @@ -34,6 +34,10 @@ "\n", "import warnings\n", "\n", + "# filter warnings because the timestamp shows up in diff-pdf\n", + "warnings.filterwarnings(\"ignore\", message=\".*SampleCollection contains multiple.*\")\n", + "warnings.filterwarnings(\"ignore\", message=\".*is deprecated.*\")\n", + "\n", "from IPython.display import display\n", "\n", "project = ocx.Projects.get(\"d53ad03b010542e3\") # get DIABIMMUNE project by ID\n", @@ -50,7 +54,7 @@ " \"wheat\",\n", " \"rice\",\n", "]]\n", - " \n", + "\n", "display(md_table)" ] }, @@ -69,14 +73,9 @@ "metadata": {}, "outputs": [], "source": [ - "# filter warning because timestamp shows up in diff-pdf\n", - "with warnings.catch_warnings():\n", - " warnings.filterwarnings(\"ignore\", message=\".*SampleCollection contains multiple.*\")\n", - " warnings.filterwarnings(\"ignore\", message=\".*is deprecated.*\")\n", - " \n", - " observed_taxa = samples.plot_metadata(vaxis=\"observed_taxa\", haxis=\"geo_loc_name\", return_chart=True)\n", - " simpson = samples.plot_metadata(vaxis=\"simpson\", haxis=\"geo_loc_name\", return_chart=True)\n", - " shannon = samples.plot_metadata(vaxis=\"shannon\", haxis=\"geo_loc_name\", return_chart=True)\n", + "observed_taxa = samples.plot_metadata(vaxis=\"observed_taxa\", haxis=\"geo_loc_name\", return_chart=True)\n", + "simpson = samples.plot_metadata(vaxis=\"simpson\", haxis=\"geo_loc_name\", return_chart=True)\n", + "shannon = samples.plot_metadata(vaxis=\"shannon\", haxis=\"geo_loc_name\", return_chart=True)\n", "\n", "observed_taxa | simpson | shannon" ] @@ -128,18 +127,12 @@ "outputs": [], "source": [ "# generate a dataframe containing relative abundances\n", - "df_rel = samples.to_df(rank=\"genus\")\n", - "\n", "# fetch all samples for subject P014839\n", - "subject_metadata = samples.metadata.loc[samples.metadata[\"host_subject_id\"] == \"P014839\"]\n", - "subject_df = df_rel.loc[subject_metadata.index]\n", + "subject_df = samples.filter(lambda s: s.metadata.custom[\"host_subject_id\"] == \"P014839\")\n", "\n", - "# put them in order of sample date\n", - "subject_df = subject_df.loc[subject_metadata[\"host_age\"].sort_values().index]\n", - "\n", - "# you can access our library using the ocx accessor on pandas dataframes!\n", - "subject_df.ocx.plot_bargraph(\n", + "subject_df.plot_bargraph(\n", " rank=\"genus\",\n", + " metric=\"normalized_readcount_w_children\",\n", " label=lambda metadata: str(metadata[\"host_age\"]),\n", " title=\"Subject P014839 Over Time\",\n", " xlabel=\"Host Age at Sampling Time (days)\",\n", @@ -161,7 +154,7 @@ "metadata": {}, "outputs": [], "source": [ - "df_rel[:30].ocx.plot_heatmap(legend=\"Relative Abundance\", tooltip=\"geo_loc_name\")" + "samples[:30].plot_heatmap(legend=\"Relative Abundance\", tooltip=\"geo_loc_name\", rank='genus', metric='normalized_readcount_w_children')" ] }, { @@ -179,10 +172,7 @@ "metadata": {}, "outputs": [], "source": [ - "# generate a dataframe containing read counts\n", - "df_abs = samples.to_df()\n", - "\n", - "df_abs[:30].ocx.plot_distance(metric=\"weighted_unifrac\")" + "samples[:30].plot_distance(diversity_metric=\"weighted_unifrac\", metric='normalized_readcount_w_children')" ] }, { @@ -215,7 +205,11 @@ "outputs": [], "source": [ "samples.plot_mds(\n", - " metric=\"weighted_unifrac\", method=\"pcoa\", color=\"geo_loc_name\", title=\"My PCoA Plot\"\n", + " metric='abundance_w_children',\n", + " diversity_metric=\"weighted_unifrac\",\n", + " method=\"pcoa\",\n", + " color=\"geo_loc_name\",\n", + " title=\"My PCoA Plot\"\n", ")" ] }, diff --git a/test/notebooks/example_expected.pdf b/test/notebooks/example_expected.pdf index 5748a83..76606f1 100644 Binary files a/test/notebooks/example_expected.pdf and b/test/notebooks/example_expected.pdf differ