Skip to content
Snippets Groups Projects
Commit 36cf7219 authored by Peter Schubert's avatar Peter Schubert
Browse files

value info in targets sheet corrected

parent beeecd08
No related branches found
No related tags found
No related merge requests found
......@@ -53,9 +53,17 @@ class RbaMacromolecules:
tree.write(file_name)
def to_df(self):
if len(self.components) > 0:
df_comp = pd.DataFrame([item.to_dict() for item in self.components.values()])
else:
df_comp = pd.DataFrame(columns=['component', 'name', 'type', 'weight'])
df_comp.set_index('component', inplace=True)
if len(self.macromolecules) > 0:
df_mm = pd.DataFrame([item.to_dict() for item in self.macromolecules.values()])
else:
df_mm = pd.DataFrame(columns=['id', 'compartment'])
df_mm.set_index('id', inplace=True)
cols = ['compartment'] + df_comp.index.to_list()
df = pd.concat((df_comp.T, df_mm)).reindex(columns=cols)
......
......@@ -81,9 +81,12 @@ class RbaModel:
for idx, row in m_dict['densities'].iterrows():
first_value = row['targetValue'].split('=')[1]
m_dict['densities'].at[idx, 'value_info'] = self.parameters.get_value_info(first_value)
# we temporarily create a unique index for table update
m_dict['targets'].reset_index(inplace=True)
for idx, row in m_dict['targets'].iterrows():
first_value = row['targetValue'].split('=')[1]
m_dict['targets'].at[idx, 'value_info'] = self.parameters.get_value_info(first_value)
m_dict['targets'].set_index('targetGroup', inplace=True)
with pd.ExcelWriter(xlsx_name) as writer:
for name, df in m_dict.items():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment