Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gene name compliance with cobrapy #216

Merged
merged 2 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Thumbs.db
*.asv
*.m~
*.mex*
*.mlappinstall
*.mlappinstall
*.mltbx
*.mat
helpsearch*/
Expand All @@ -50,4 +50,8 @@ helpsearch*/
########################
*.xls
*.xlsx
*.tab
*.tab

# Python-related things #
#########################
*.ipynb_checkpoints/
353 changes: 353 additions & 0 deletions ComplementaryScripts/modelTests/cobrapy-compliance.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,353 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# cobrapy compliance\n",
"\n",
"Notebook for confirming that every field is preserved when the model is used with cobrapy."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Using license file C:\\Users\\bejsab\\gurobi.lic\n",
"Academic license - for non-commercial use only\n"
]
}
],
"source": [
"import cobra\n",
"model = cobra.io.read_sbml_model(\"../../ModelFiles/xml/yeastGEM.xml\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Metabolites"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <table>\n",
" <tr>\n",
" <td><strong>Metabolite identifier</strong></td><td>s_0001[ce]</td>\n",
" </tr><tr>\n",
" <td><strong>Name</strong></td><td>(1->3)-beta-D-glucan [cell envelope]</td>\n",
" </tr><tr>\n",
" <td><strong>Memory address</strong></td>\n",
" <td>0x01b5797c4d48</td>\n",
" </tr><tr>\n",
" <td><strong>Formula</strong></td><td>C6H10O5</td>\n",
" </tr><tr>\n",
" <td><strong>Compartment</strong></td><td>ce</td>\n",
" </tr><tr>\n",
" <td><strong>In 3 reaction(s)</strong></td><td>\n",
" r_0005, r_1543, r_4048</td>\n",
" </tr>\n",
" </table>"
],
"text/plain": [
"<Metabolite s_0001[ce] at 0x1b5797c4d48>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.metabolites[0]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.metabolites[0].charge"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sbo': ['SBO:0000247'],\n",
" 'chebi': 'CHEBI:37671',\n",
" 'kegg.compound': 'C00965',\n",
" 'metanetx.chemical': 'MNXM6492'}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.metabolites[0].annotation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Reactions"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <table>\n",
" <tr>\n",
" <td><strong>Reaction identifier</strong></td><td>r_2112</td>\n",
" </tr><tr>\n",
" <td><strong>Name</strong></td><td>kynurenine aminotransferase</td>\n",
" </tr><tr>\n",
" <td><strong>Memory address</strong></td>\n",
" <td>0x01b57fc40f88</td>\n",
" </tr><tr>\n",
" <td><strong>Stoichiometry</strong></td>\n",
" <td>\n",
" <p style='text-align:right'>s_1020[c] + s_1399[c] <=> s_0955[c] + s_2763[c]</p>\n",
" <p style='text-align:right'>L-kynurenine [cytoplasm] + pyruvate [cytoplasm] <=> L-alanine [cytoplasm] + kynurenic acid [cytoplasm]</p>\n",
" </td>\n",
" </tr><tr>\n",
" <td><strong>GPR</strong></td><td>YJL060W</td>\n",
" </tr><tr>\n",
" <td><strong>Lower bound</strong></td><td>-1000.0</td>\n",
" </tr><tr>\n",
" <td><strong>Upper bound</strong></td><td>1000.0</td>\n",
" </tr>\n",
" </table>\n",
" "
],
"text/plain": [
"<Reaction r_2112 at 0x1b57fc40f88>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.reactions.get_by_id(\"r_2112\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sbo': ['SBO:0000176'],\n",
" 'pubmed': '18205391',\n",
" 'ec-code': '2.6.1.7',\n",
" 'kegg.reaction': 'R01959',\n",
" 'metanetx.reaction': 'MNXR99596'}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.reactions.get_by_id(\"r_2112\").annotation"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'Confidence Level': '3'}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.reactions.get_by_id(\"r_2112\").notes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Genes"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <table>\n",
" <tr>\n",
" <td><strong>Gene identifier</strong></td><td>Q0045</td>\n",
" </tr><tr>\n",
" <td><strong>Name</strong></td><td>COX1</td>\n",
" </tr><tr>\n",
" <td><strong>Memory address</strong></td>\n",
" <td>0x01b57f39ba48</td>\n",
" </tr><tr>\n",
" <td><strong>Functional</strong></td><td>True</td>\n",
" </tr><tr>\n",
" <td><strong>In 1 reaction(s)</strong></td><td>\n",
" r_0438</td>\n",
" </tr>\n",
" </table>"
],
"text/plain": [
"<Gene Q0045 at 0x1b57f39ba48>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.genes[0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 4. Subsystems"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'sce00040 Pentose and glucuronate interconversions'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.groups[4].name"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{<Reaction r_0164 at 0x1b57f61d488>,\n",
" <Reaction r_0168 at 0x1b57f626888>,\n",
" <Reaction r_0171 at 0x1b57f62c288>,\n",
" <Reaction r_0181 at 0x1b57f648f08>,\n",
" <Reaction r_0184 at 0x1b57f6548c8>,\n",
" <Reaction r_0205 at 0x1b57f684848>,\n",
" <Reaction r_0323 at 0x1b57f77fd08>,\n",
" <Reaction r_0365 at 0x1b57f7c7c48>,\n",
" <Reaction r_0688 at 0x1b57f9ba308>,\n",
" <Reaction r_0691 at 0x1b57f9bf508>,\n",
" <Reaction r_0984 at 0x1b57f60a4c8>,\n",
" <Reaction r_1084 at 0x1b57fc24548>,\n",
" <Reaction r_1092 at 0x1b57fc32748>,\n",
" <Reaction r_1093 at 0x1b57fc32f88>,\n",
" <Reaction r_1094 at 0x1b57fc37808>}"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.groups[4].members"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
3 changes: 3 additions & 0 deletions ComplementaryScripts/saveYeastModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function saveYeastModel(model,upDATE)
model = addSBOterms(model);
cd ..

%Save "proteins" ("fbc:name" in the xml file) = "geneNames" ("fbc:label" in the xml file):
model.proteins = model.geneNames;

%Check if model is a valid SBML structure:
writeCbModel(model,'sbml','tempModel.xml');
[~,errors] = TranslateSBML('tempModel.xml');
Expand Down
Loading