Skip to content

Instantly share code, notes, and snippets.

@ebolyen
Last active October 3, 2025 19:58
Show Gist options
  • Select an option

  • Save ebolyen/4773c744400072215ebc3161f197956d to your computer and use it in GitHub Desktop.

Select an option

Save ebolyen/4773c744400072215ebc3161f197956d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "9694965b",
"metadata": {},
"source": [
"These data are derived from the Zenodo archive:\n",
"\n",
"[Upcycling Human Excrement: The Gut Microbiome to Soil Microbiome Axis (supporting data)](https://zenodo.org/records/13887457)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "85232fc5",
"metadata": {},
"outputs": [],
"source": [
"from qiime2 import Visualization\n",
"from q2templates.reports import matryoshka_template"
]
},
{
"cell_type": "markdown",
"id": "dff7e196",
"metadata": {},
"source": [
"# Upstream\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "01cfc4c2",
"metadata": {},
"outputs": [],
"source": [
"table = Visualization.load('asv-table.qzv')\n",
"seqs = Visualization.load('asv-seqs-ms10.qzv')\n",
"metadata = Visualization.load('sample-metadata.qzv')\n",
"\n",
"upstream = Visualization.make_report(matryoshka_template, {\n",
" 'Table Summary': table,\n",
" 'ASV Summary': seqs,\n",
" 'Sample Metadata': metadata,\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "48081ebc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Upstream.qzv'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"upstream.save('Upstream')"
]
},
{
"cell_type": "markdown",
"id": "6e1ba7b3",
"metadata": {},
"source": [
"# PCoA"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "4bcdff90",
"metadata": {},
"outputs": [],
"source": [
"jaccard = Visualization.load('jaccard.qzv')\n",
"braycurtis = Visualization.load('braycurtis.qzv')\n",
"uu = Visualization.load('unweighted_unifrac.qzv')\n",
"wu = Visualization.load('weighted_unifrac.qzv')\n",
"\n",
"pcoa = Visualization.make_report(matryoshka_template, {\n",
" 'Jaccard': jaccard,\n",
" 'Bray-Curtis': braycurtis,\n",
" 'Weighted UniFrac': wu,\n",
" 'Unweighted UniFrac': uu\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4146d97a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'PCoA.qzv'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pcoa.save('PCoA')"
]
},
{
"cell_type": "markdown",
"id": "7c15971b",
"metadata": {},
"source": [
"# Taxonomy"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9d70c3b4",
"metadata": {},
"outputs": [],
"source": [
"bk2 = Visualization.load('taxa-bar-plots-bucket2-gtdb-r214.1-weighted-stool-taxonomy.qzv')\n",
"bk3 = Visualization.load('taxa-bar-plots-bucket3-gtdb-r214.1-weighted-stool-taxonomy.qzv')\n",
"\n",
"\n",
"taxa = Visualization.make_report(matryoshka_template, {\n",
" 'Bucket 2': bk2,\n",
" 'Bucket 3': bk3\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "3433a221",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Taxa.qzv'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"taxa.save('Taxa')"
]
},
{
"cell_type": "markdown",
"id": "fb93156d",
"metadata": {},
"source": [
"# Other"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "7e21d73b",
"metadata": {},
"outputs": [],
"source": [
"rain = Visualization.load('hec-raincloud.qzv')\n",
"\n",
"other = Visualization.make_report(matryoshka_template, {\n",
" 'Raincloud Plots': rain\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "cbbf877b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Other.qzv'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"other.save('Other')"
]
},
{
"cell_type": "markdown",
"id": "46910f12",
"metadata": {},
"source": [
"# Full Collated Report"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "da882747",
"metadata": {},
"outputs": [],
"source": [
"final = Visualization.make_report(matryoshka_template, {\n",
" 'Summary': upstream,\n",
" 'PCoA': pcoa,\n",
" 'Taxonomy': taxa,\n",
" 'Additional': other\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "a1e487f7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'FinalAnalysis(1) actually-finished_Copy(2).qzv'"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"final.save('FinalAnalysis(1) actually-finished_Copy(2)')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "acea4b35",
"metadata": {},
"outputs": [],
"source": []
}
],
"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.14"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment