Skip to content
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
2 changes: 1 addition & 1 deletion damn/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.1"
__version__ = "0.1.3"
21 changes: 21 additions & 0 deletions damn/models/ecoli/M28_OD_20.csv

Large diffs are not rendered by default.

281 changes: 281 additions & 0 deletions damn/models/ecoli/M28_media.csv

Large diffs are not rendered by default.

177,359 changes: 177,359 additions & 0 deletions damn/models/ecoli/iML1515_duplicated.xml

Large diffs are not rendered by default.

174,334 changes: 174,334 additions & 0 deletions damn/models/putida/IJN1463EXP_duplicated.xml

Large diffs are not rendered by default.

Binary file added damn/models/putida/modul.zip
Binary file not shown.
21 changes: 21 additions & 0 deletions damn/models/putida/putida_OD_81.csv

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions damn/models/putida/putida_media_81.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
ID,glc__D_e,xyl__D_e,succ_e,ala__L_e,arg__L_e,asn__L_e,asp__L_e,cys__L_e,glu__L_e,gln__L_e,gly_e,his__L_e,ile__L_e,leu__L_e,lys__L_e,met__L_e,phe__L_e,pro__L_e,ser__L_e,thr__L_e,trp__L_e,tyr__L_e,val__L_e,ade_e,gua_e,csn_e,ura_e,thymd_e
1,0,0,0,0,1.742,0,0,0.242,0,0,0,0.776,0,0,0.731,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
2,0,0,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
3,0,0,0,0.891,0,1.321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
4,0,0,0,0.891,0,1.321,0,0,0,0,0,0.776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5,0,0,0,0,0,0,0,0,1.471,1.462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
6,0,0,0,0,1.742,0,0,0,0,0,0,0,0,0,0,0,0,1.151,0,0,0,0,0,0,0,0,0,0
7,0,0,0,0,0,0,0,0,0,0,0,0,1.312,1.312,0,0,0,0,0,0,0,0,1.172,0,0,0,0,0
8,0,0,0,0,1.742,0,0,0.242,0,0,0,0,0,0,0,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
9,0,0,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,0,0,0,0,0,0,0,0,0,0,0,0
10,3.964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.222,0.224,0.484
11,3.964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0.222,0.224,0.484
12,3.964,0,0,0,1.742,0,0,0.242,0,0,0,0.776,0,0,0.731,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
13,3.964,0,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
14,3.964,0,0,0,0,0,0,0,0,0,0.751,0,0,0,0,0,0,0,1.051,1.191,0,0,0,0,0,0,0,0
15,3.964,0,0,0.891,0,1.321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
16,3.964,0,0,0.891,0,1.321,0,0,0,0,0,0.776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
17,3.964,0,0,0,0,0,0,0,1.471,1.462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
18,3.964,0,0,0,1.742,0,0,0,0,0,0,0,0,0,0,0,0,1.151,0,0,0,0,0,0,0,0,0,0
19,3.964,0,0,0,0,0,0,0,0,0,0,0,1.312,1.312,0,0,0,0,0,0,0,0,1.172,0,0,0,0,0
20,3.964,0,0,0,0,0,0,0.242,0,0,0,0,0,0,0,0.746,0,0,0,0,0,0,0,0,0,0,0,0
21,3.964,0,0,0,1.742,0,0,0.242,0,0,0,0,0,0,0,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
22,3.964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
23,3.964,0,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,0,0,0,0,0,0,0,0,0,0,0,0
24,3.964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0,0,0
25,0,3.603,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.222,0.224,0.484
26,0,3.603,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0.222,0.224,0.484
27,0,3.603,0,0,1.742,0,0,0.242,0,0,0,0.776,0,0,0.731,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
28,0,3.603,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
29,0,3.603,0,0,0,0,0,0,0,0,0.751,0,0,0,0,0,0,0,1.051,1.191,0,0,0,0,0,0,0,0
30,0,3.603,0,0.891,0,1.321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
31,0,3.603,0,0.891,0,1.321,0,0,0,0,0,0.776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
32,0,3.603,0,0,0,0,0,0,1.471,1.462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
33,0,3.603,0,0,1.742,0,0,0,0,0,0,0,0,0,0,0,0,1.151,0,0,0,0,0,0,0,0,0,0
34,0,3.603,0,0,0,0,0,0,0,0,0,0,1.312,1.312,0,0,0,0,0,0,0,0,1.172,0,0,0,0,0
35,0,3.603,0,0,0,0,0,0.242,0,0,0,0,0,0,0,0.746,0,0,0,0,0,0,0,0,0,0,0,0
36,0,3.603,0,0,1.742,0,0,0.242,0,0,0,0,0,0,0,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
37,0,3.603,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
38,0,3.603,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,0,0,0,0,0,0,0,0,0,0,0,0
39,0,3.603,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0,0,0
40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.222,0.224,0.484
41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0.222,0.224,0.484
42,0,0,0,0,1.742,0,0,0.242,0,0,0,0.776,0,0,0.731,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
43,0,0,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
44,0,0,0,0,0,0,0,0,0,0,0.751,0,0,0,0,0,0,0,1.051,1.191,0,0,0,0,0,0,0,0
45,0,0,0,0.891,0,1.321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
46,0,0,0,0.891,0,1.321,0,0,0,0,0,0.776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
47,0,0,0,0,0,0,0,0,1.471,1.462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
48,0,0,0,0,1.742,0,0,0,0,0,0,0,0,0,0,0,0,1.151,0,0,0,0,0,0,0,0,0,0
49,0,0,0,0,0,0,0,0,0,0,0,0,1.312,1.312,0,0,0,0,0,0,0,0,1.172,0,0,0,0,0
50,0,0,0,0,0,0,0,0.242,0,0,0,0,0,0,0,0.746,0,0,0,0,0,0,0,0,0,0,0,0
51,0,0,0,0,1.742,0,0,0.242,0,0,0,0,0,0,0,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
53,0,0,0,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,0,0,0,0,0,0,0,0,0,0,0,0
54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0,0,0
55,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.222,0.224,0.484
56,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0.222,0.224,0.484
57,0,0,1.161,0,1.742,0,0,0.242,0,0,0,0.776,0,0,0.731,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
58,0,0,1.161,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
59,0,0,1.161,0,0,0,0,0,0,0,0.751,0,0,0,0,0,0,0,1.051,1.191,0,0,0,0,0,0,0,0
60,0,0,1.161,0.891,0,1.321,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
61,0,0,1.161,0.891,0,1.321,0,0,0,0,0,0.776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
62,0,0,1.161,0,0,0,0,0,1.471,1.462,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
63,0,0,1.161,0,1.742,0,0,0,0,0,0,0,0,0,0,0,0,1.151,0,0,0,0,0,0,0,0,0,0
64,0,0,1.161,0,0,0,0,0,0,0,0,0,1.312,1.312,0,0,0,0,0,0,0,0,1.172,0,0,0,0,0
65,0,0,1.161,0,0,0,0,0.242,0,0,0,0,0,0,0,0.746,0,0,0,0,0,0,0,0,0,0,0,0
66,0,0,1.161,0,1.742,0,0,0.242,0,0,0,0,0,0,0,0.746,0,1.151,0,0,0,0,0,0,0,0,0,0
67,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,1.652,0,0,0,1.021,0.906,0,0,0,0,0,0
68,0,0,1.161,0,0,0,0,0,0,0,0,0.776,0,0,0.731,0,0,0,0,0,0,0,0,0,0,0,0,0
69,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.27,0.302,0,0,0
70,3.964,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
71,0,3.603,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
73,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
75,0,0,0,0,0,0,0,0,0,0,0.751,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
76,0,0,0,0.891,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
78,0,0,1.161,0.891,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
79,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
80,0,0,1.161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
81,0,0,0,0.891,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
22 changes: 15 additions & 7 deletions damn/train.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import os
import numpy as np
import tensorflow as tf
from importlib.resources import files
import damn
from damn import model
from damn import plot

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
DAMN_DIR = os.path.dirname(os.path.abspath(damn.__file__))
PROJECT_ROOT = os.path.dirname(DAMN_DIR)
DOCS_DIR = os.path.join(PROJECT_ROOT, "docs")
#DAMN_DIR = os.path.dirname(os.path.abspath(damn.__file__))
#PROJECT_ROOT = os.path.dirname(DAMN_DIR)
#DOCS_DIR = os.path.join(PROJECT_ROOT, "docs")


def get_default_model(organism):
if organism.lower() == "putida":
return str(files("damn.models.putida").joinpath("IJN1463EXP_duplicated.xml"))
elif organism.lower() == "ecoli":
return str(files("damn.models.ecoli").joinpath("iML1515_duplicated.xml"))
else:
raise ValueError("Custom model must be provided")

def train_damn(
organism="custom",
Expand Down Expand Up @@ -48,8 +58,7 @@ def train_damn(
"file_name": "putida_OD_81",
"od_file": "putida_OD_81.csv",
"media_file": "putida_media_81.csv",
"cobra_model_file": os.path.join(
DOCS_DIR, "putida", "IJN1463EXP_duplicated.xml"),
"cobra_model_file": get_default_model('putida'),
"biomass_rxn_id": "BIOMASS_KT2440_WT3",
"seed": 1,
"num_epochs": 500,
Expand All @@ -62,8 +71,7 @@ def train_damn(
"file_name": "M28_OD_20",
"od_file": "M28_OD_20.csv",
"media_file": "M28_media.csv",
"cobra_model_file": os.path.join(
DOCS_DIR, "putida","iML1515_duplicated.xml"),
"cobra_model_file": get_default_model('ecoli'),
"biomass_rxn_id": "BIOMASS_Ec_iML1515_core_75p37M",
"seed": 30,
"num_epochs": 1000,
Expand Down
Loading