{ "cells": [ { "cell_type": "markdown", "id": "308becec-d420-4754-badf-7ce9914bade5", "metadata": {}, "source": [ "# KBase Workspace" ] }, { "cell_type": "code", "execution_count": 1, "id": "afbaad60-3c4d-476d-89bb-9b4f6eb1ca53", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "cobrakbase 0.2.8\n" ] } ], "source": [ "import cobrakbase" ] }, { "cell_type": "markdown", "id": "a0c9a8fc-7855-4dcf-8ff5-74837dfeb57a", "metadata": {}, "source": [ "## Initialize KBase client with a valid token" ] }, { "cell_type": "code", "execution_count": 2, "id": "3c8738d1-a7f0-4296-892c-41257d3d67bc", "metadata": {}, "outputs": [], "source": [ "kbase = cobrakbase.KBaseAPI() # or kbase = cobrakbase.KBaseAPI(YOUR_LOGIN_TOKEN)" ] }, { "cell_type": "code", "execution_count": null, "id": "ebe2b75f-7d34-460c-8c4f-de57b7e76eb0", "metadata": {}, "outputs": [], "source": [ "ws = \"filipeliu:narrative_1561151919387\"" ] }, { "cell_type": "markdown", "id": "7c64f6bc-656e-45ad-8356-4a423499f351", "metadata": {}, "source": [ "#### Get Object\n", "get_object returns raw dict object" ] }, { "cell_type": "code", "execution_count": 3, "id": "a064f6ad-2e1e-482b-bd6e-ea0a73fc9d12", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "__VERSION__ \n", "biochemistry_ref \n", "biomasses \n", "compartments \n", "compcompounds \n", "complexes \n", "compounds \n", "domain \n", "id \n", "name \n", "pathways \n", "reactions \n", "roles \n", "subsystems \n", "type \n" ] } ], "source": [ "data = kbase.get_object('GramNegModelTemplateV2', 'NewKBaseModelTemplates')\n", "for k in data:\n", " print(k, type(data[k]))" ] }, { "cell_type": "markdown", "id": "303659ad-2591-4cf9-ad45-b2e42ca53e69", "metadata": {}, "source": [ "get_from_ws returns ModelSEEDpy datatypes (e.g., Model, Genome, Media, Template)" ] }, { "cell_type": "code", "execution_count": 5, "id": "d8c518e4-6241-4644-92c9-642dc63b4e5f", "metadata": {}, "outputs": [], "source": [ "template = kbase.get_from_ws('GramNegModelTemplateV2', 'NewKBaseModelTemplates')" ] }, { "cell_type": "code", "execution_count": 6, "id": "657ee707-e88a-4b48-ab63-d3448a4e241d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
IDGramNegative.modeltemplate
Memory address0x07f8e8fb4c730
Number of metabolites6359
Number of species6884
Number of reactions8656
Number of roles20572
Number of complexes9764
" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "template" ] }, { "cell_type": "code", "execution_count": 7, "id": "8f458ab0-a68c-4564-8179-753815eb468d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Reaction identifierrxn00001_c
Namediphosphate phosphohydrolase
Memory address0x07f8e84198820
Stoichiometry\n", "

cpd00001_c + cpd00012_c --> 2 cpd00009_c + cpd00067_c

\n", "

H2O + PPi --> 2 Phosphate + H+

\n", "
GPRcpx01835 or cpx01834 or cpx34574 or cpx52693 or cpx01833
Lower bound0
Upper bound1000
\n", " " ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "template.reactions.rxn00001_c" ] }, { "cell_type": "code", "execution_count": null, "id": "c56f1fc5-4f7c-4b52-9623-11d4a6cf95dd", "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.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }