Open CodeByDrescher opened 1 week ago
Are you running run_time_course_with_output(['Time', '[Time]'])
that succeeds here. since the error message comes from __build_result_from_ts
the time series object is being used, that one will have the species name without the brackets. And it would not be using the data handler.
But yes, the lookup by DisplayName only will fail if the name is not unique. I can add a method that goes through all model elements disambiguating elements with the same name.
@CodeByDrescher I've released 0.76 that avoids this issue:
Duplicate column names in time series consider using use_sbml_id=True, or running ensure_unique_names()
ensure_unique_names()
appends a count to the name ensuring uniquenessThis release avoids the exception you encountered, though it would return a dataframe where multiple columns would have the same name. You could avoid that by calling ensure_unique_names
, or using the flag on import:
>>> import_sbml("BIOMD0000000465_url.xml", ensure_unique_names=True)
>>> get_species("Time")
compartment type unit initial_concentration ... key sbml_id transition_time display_name
name ...
Time (1) Cell reactions nmol/l 0.0 ... Metabolite_25 s23 0.0 Time (1)
[1 rows x 15 columns]
Specifically, the call:
df.set_index('Time')
Causes an exception in Pandas, as it will find two Columns named "Time".
The example SBML model attached has a model with id="s23" and name="Time". ExampleSBML.zip
A Data Handler is initialized with both "Time" and "[Time]"
After running the time course, the resulting DataFrame has two columns with "Time" as its label.
When Basico tries to set the index to time, Pandas generates a ValueError.