def deleteModelHierarchy(model_filename): doc = SbmlDocument() doc.readSbmlFromFile(model_filename) path = dirname(model_filename) if doc.useCompPackage: for dependency in doc.getExternalDocumentDependencies(): deleteModelHierarchy(join(path, dependency)) remove(model_filename)
def getModelHierarchy(model_filename): doc = SbmlDocument() doc.readSbmlFromFile(model_filename) path = dirname(model_filename) deps = [] if doc.useCompPackage: for dependency in doc.getExternalDocumentDependencies(): deps.append(dependency) deps += getModelHierarchy(join(path, dependency)) return deps
def copyModelHierarchy(model_filename): doc = SbmlDocument() doc.readSbmlFromFile(model_filename) path = dirname(model_filename) master_filename = new_model_filename() if doc.useCompPackage: deps = doc.getExternalDocumentDependencies() new_deps = {} for dependency in deps: new_deps.update({dependency: copyModelHierarchy(join(path, dependency))}) doc.renameExternalDocumentDependencies(new_deps) doc.writeSbmlToFile(join(path, master_filename)) return master_filename
def copyModelHierarchy(model_filename): doc = SbmlDocument() doc.readSbmlFromFile(model_filename) path = dirname(model_filename) master_filename = new_model_filename() if doc.useCompPackage: deps = doc.getExternalDocumentDependencies() new_deps = {} for dependency in deps: new_deps.update( {dependency: copyModelHierarchy(join(path, dependency))}) doc.renameExternalDocumentDependencies(new_deps) doc.writeSbmlToFile(join(path, master_filename)) return master_filename