Closed jmrohwer closed 3 years ago
It would be fixed by the following diff:
diff --git a/pyenzyme/enzymeml/core/measurement.py b/pyenzyme/enzymeml/core/measurement.py
index bd53a83..b86fd8f 100644
--- a/pyenzyme/enzymeml/core/measurement.py
+++ b/pyenzyme/enzymeml/core/measurement.py
@@ -79,33 +79,28 @@ class Measurement(EnzymeMLBase):
measurements = dict()
- # Combine Replicate objects for each reaction
- for reactionID, reaction in self.__speciesDict.items():
-
- proteins = self.__combineReplicates(
- measurementSpecies=reaction['proteins'],
- reactionID=reactionID,
- enzmldoc=enzmldoc,
- speciesType='proteins'
- )
- reactants = self.__combineReplicates(
- measurementSpecies=reaction['reactants'],
- reactionID=reactionID,
- enzmldoc=enzmldoc,
- speciesType='reactants'
- )
+ # Combine Replicate objects
+ proteins = self.__combineReplicates(
+ measurementSpecies=self.__speciesDict['proteins'],
+ enzmldoc=enzmldoc,
+ speciesType='proteins'
+ )
+ reactants = self.__combineReplicates(
+ measurementSpecies=self.__speciesDict['reactants'],
+ enzmldoc=enzmldoc,
+ speciesType='reactants'
+ )
- measurements[reactionID] = {
- "proteins": proteins,
- "reactants": reactants
- }
+ measurements = {
+ "proteins": proteins,
+ "reactants": reactants
+ }
return measurements
def __combineReplicates(
self,
measurementSpecies,
- reactionID,
enzmldoc,
speciesType
):
@@ -114,7 +109,6 @@ class Measurement(EnzymeMLBase):
columns = [self.__globalTime]
header = [f"time/{self.__globalTimeUnit}"]
initConcs = dict()
- stoichiometries = dict()
# Iterate over measurementData to fill columns
for speciesID, data in measurementSpecies.items():
@@ -133,19 +127,12 @@ class Measurement(EnzymeMLBase):
# Fetch initial concentration
initConcs[speciesID] = (data.getInitConc(), data.getUnit())
- # Fetch the stoichiometry of the reactant
- if speciesType == 'reactants' and enzmldoc is not None:
- stoichiometries[speciesID] = self.__getStoichiometry(
- reaction=enzmldoc.getReaction(reactionID),
- speciesID=speciesID
- )
-
- if len(columns) > 1:
- return {
- "data": pd.DataFrame(np.array(columns).T, columns=header),
- "initConc": initConcs,
- "stoichiometries": stoichiometries
- }
+ return {
+ 'data': pd.DataFrame(np.array(columns).T, columns=header)
+ if len(columns) > 1
+ else None,
+ 'initConc': initConcs,
+ }
def __getStoichiometry(self, reaction, speciesID):
Thanks for bringing this up! The function was fixed in cc7929c.
After the reaction hierarchy has been removed from the
Measurement
class, theexportData()
method no longer works: