BioSIMI-Python/modules/Subsystem.py
def mergeSubsystemModels(self, ListOfSubsystems):
        '''
        The ListOfSubsystems are merged together. All components are 
        merged together except the Species.
        '''
        # functions, units, compartments, species, parameters, 
        # initial assignments, rules, constraints, reactions, and events
        document = self.getSubsystemDoc()
        check(document,'retreiving document in mergeSubsystem')
        model_base = ListOfSubsystems[0].getSubsystemDoc().getModel()
        check(model_base,'retreiving model in mergeSubsystems')
        model = self.createNewModel('merged_model',model_base.getTimeUnits(), model_base.getExtentUnits(), model_base.getSubstanceUnits())
        check(document.setModel(model),'setting model for document in mergeSubsystem')
        for subsystem in ListOfSubsystems:
            mod = subsystem.getSubsystemDoc().getModel()
            check(mod,'retreiving model in mergeSubsystem')
            # Obsolete in SBML Level 3 
            # if mod.getNumCompartmentTypes() != 0:
            #     for each_compartmentType in mod.getListOfCompartmentType():
            #         model.addCompartmentType(each_compartmentType)
            if mod.getNumConstraints() != 0:
                for each_constraint in mod.getListOfConstraints():
                    model.addConstraint(each_constraint)
            if mod.getNumInitialAssignments() != 0:
                for each_initialAssignment in mod.getListOfInitialAssignments():
                    model.addInitialAssignment(each_initialAssignment)
            if mod.getNumFunctionDefinitions() != 0:
                for each_functionDefinition in mod.getListOfFunctionDefinitions():
                    model.addFunctionDefinition(each_functionDefinition)
            if mod.getNumRules() != 0:
                for each_rule in mod.getListOfRules():
                    model.addRule(each_rule)
            if mod.getNumEvents() != 0:
                for each_event in mod.getListOfEvents():
                    model.addEvent(each_event)
            if mod.getNumCompartments() != 0:
                for each_compartment in mod.getListOfCompartments():
                    model.addCompartment(each_compartment)
            if mod.getNumParameters() != 0:
                for each_parameter in mod.getListOfParameters():
                    model.addParameter(each_parameter)
            if mod.getNumUnitDefinitions() != 0:
                for each_unit in mod.getListOfUnitDefinitions():
                    model.addUnitDefinition(each_unit)
            if mod.getNumReactions() != 0:
                for each_reaction in mod.getListOfReactions():
                    model.addReaction(each_reaction)
            model.setAreaUnits(mod.getAreaUnits())
            model.setExtentUnits(mod.getExtentUnits())
            model.setLengthUnits(mod.getLengthUnits())
            model.setSubstanceUnits(mod.getSubstanceUnits())
            model.setTimeUnits(mod.getTimeUnits())
            model.setVolumeUnits(mod.getVolumeUnits())

        The ListOfSubsystems are merged together. All components are 
        merged together except the Species.
        
The ListOfSubsystems are merged together. All components are
merged together except the Species.
The ListOfSubsystems are merged together . All components are merged together except the Species .
def mergeSubsystemModels(self, ListOfSubsystems):
        document = self.getSubsystemDoc()
        check(document,'retreiving document in mergeSubsystem')
        model_base = ListOfSubsystems[0].getSubsystemDoc().getModel()
        check(model_base,'retreiving model in mergeSubsystems')
        model = self.createNewModel('merged_model',model_base.getTimeUnits(), model_base.getExtentUnits(), model_base.getSubstanceUnits())
        check(document.setModel(model),'setting model for document in mergeSubsystem')
        for subsystem in ListOfSubsystems:
            mod = subsystem.getSubsystemDoc().getModel()
            check(mod,'retreiving model in mergeSubsystem')
            if mod.getNumConstraints() != 0:
                for each_constraint in mod.getListOfConstraints():
                    model.addConstraint(each_constraint)
            if mod.getNumInitialAssignments() != 0:
                for each_initialAssignment in mod.getListOfInitialAssignments():
                    model.addInitialAssignment(each_initialAssignment)
            if mod.getNumFunctionDefinitions() != 0:
                for each_functionDefinition in mod.getListOfFunctionDefinitions():
                    model.addFunctionDefinition(each_functionDefinition)
            if mod.getNumRules() != 0:
                for each_rule in mod.getListOfRules():
                    model.addRule(each_rule)
            if mod.getNumEvents() != 0:
                for each_event in mod.getListOfEvents():
                    model.addEvent(each_event)
            if mod.getNumCompartments() != 0:
                for each_compartment in mod.getListOfCompartments():
                    model.addCompartment(each_compartment)
            if mod.getNumParameters() != 0:
                for each_parameter in mod.getListOfParameters():
                    model.addParameter(each_parameter)
            if mod.getNumUnitDefinitions() != 0:
                for each_unit in mod.getListOfUnitDefinitions():
                    model.addUnitDefinition(each_unit)
            if mod.getNumReactions() != 0:
                for each_reaction in mod.getListOfReactions():
                    model.addReaction(each_reaction)
            model.setAreaUnits(mod.getAreaUnits())
            model.setExtentUnits(mod.getExtentUnits())
            model.setLengthUnits(mod.getLengthUnits())
            model.setSubstanceUnits(mod.getSubstanceUnits())
            model.setTimeUnits(mod.getTimeUnits())
            model.setVolumeUnits(mod.getVolumeUnits())
def mergeSubsystemModels ( self , ListOfSubsystems ) : document = self . getSubsystemDoc ( ) check ( document , 'retreiving document in mergeSubsystem' ) model_base = ListOfSubsystems [ 0 ] . getSubsystemDoc ( ) . getModel ( ) check ( model_base , 'retreiving model in mergeSubsystems' ) model = self . createNewModel ( 'merged_model' , model_base . getTimeUnits ( ) , model_base . getExtentUnits ( ) , model_base . getSubstanceUnits ( ) ) check ( document . setModel ( model ) , 'setting model for document in mergeSubsystem' ) for subsystem in ListOfSubsystems : mod = subsystem . getSubsystemDoc ( ) . getModel ( ) check ( mod , 'retreiving model in mergeSubsystem' ) if mod . getNumConstraints ( ) != 0 : for each_constraint in mod . getListOfConstraints ( ) : model . addConstraint ( each_constraint ) if mod . getNumInitialAssignments ( ) != 0 : for each_initialAssignment in mod . getListOfInitialAssignments ( ) : model . addInitialAssignment ( each_initialAssignment ) if mod . getNumFunctionDefinitions ( ) != 0 : for each_functionDefinition in mod . getListOfFunctionDefinitions ( ) : model . addFunctionDefinition ( each_functionDefinition ) if mod . getNumRules ( ) != 0 : for each_rule in mod . getListOfRules ( ) : model . addRule ( each_rule ) if mod . getNumEvents ( ) != 0 : for each_event in mod . getListOfEvents ( ) : model . addEvent ( each_event ) if mod . getNumCompartments ( ) != 0 : for each_compartment in mod . getListOfCompartments ( ) : model . addCompartment ( each_compartment ) if mod . getNumParameters ( ) != 0 : for each_parameter in mod . getListOfParameters ( ) : model . addParameter ( each_parameter ) if mod . getNumUnitDefinitions ( ) != 0 : for each_unit in mod . getListOfUnitDefinitions ( ) : model . addUnitDefinition ( each_unit ) if mod . getNumReactions ( ) != 0 : for each_reaction in mod . getListOfReactions ( ) : model . addReaction ( each_reaction ) model . setAreaUnits ( mod . getAreaUnits ( ) ) model . setExtentUnits ( mod . getExtentUnits ( ) ) model . setLengthUnits ( mod . getLengthUnits ( ) ) model . setSubstanceUnits ( mod . getSubstanceUnits ( ) ) model . setTimeUnits ( mod . getTimeUnits ( ) ) model . setVolumeUnits ( mod . getVolumeUnits ( ) )
The ListOfSubsystems are merged together.
The ListOfSubsystems are merged together .
'''
        The ListOfSubsystems are merged together. All components are 
        merged together except the Species.
        ''' # functions, units, compartments, species, parameters,  # initial assignments, rules, constraints, reactions, and events # Obsolete in SBML Level 3  # if mod.getNumCompartmentTypes() != 0: #     for each_compartmentType in mod.getListOfCompartmentType(): #         model.addCompartmentType(each_compartmentType)
self
ListOfSubsystems