Skip to content

Add saveModuleToPKML() to serialize a MoBiModule #1979

Description

@PavelBal

Summary

There is currently no way to serialize a MoBiModule back to a PKML file. loadModuleFromPKML() exists, but the reverse does not, so a module built or modified in R (e.g. via createMoBiModule() + extendInitialConditionsBB() / addProteinExpressionToParameterValuesBB()) cannot be persisted as a re-importable module.

What's missing

  • R API: the PKML savers are saveInitialConditionsToPKML(), saveParameterValuesToPKML(), saveIndividualToPKML(), saveExpressionProfileToPKML(), saveDataSetToPKML(), and saveSimulation(). There is no saveModuleToPKML(), and the MoBiModule R6 object exposes no save method.

  • .NET ModuleTask: exposes LoadModulesFromFile, CreateModule, AddBuildingBlocksToModule, RemoveBuildingBlockFromModule, the BB getters — but no ExportToPKML. A direct call throws:

    System.MissingMethodException: Could not find a suitable instance method ExportToPKML
    on type MoBi.R.Services.ModuleTask for method parameters Module, String
    
  • Core persisters: only SimulationPersister (whole-simulation save) is available; there is no module/PKML persister for a single module.

Proposed

Add saveModuleToPKML(module, filePath) mirroring loadModuleFromPKML(path), backed by an ExportToPKML (or equivalent) method on the .NET ModuleTask, so that:

m <- loadModuleFromPKML(\"in.pkml\")
# ... modify m ...
saveModuleToPKML(m, \"out.pkml\")
identical_module <- loadModuleFromPKML(\"out.pkml\")

Use case

Workflows that programmatically build extension modules (e.g. adding a brain spatial-structure extension to PBPK models) want to persist the generated modules as standalone, re-importable PKML artifacts. Today the only workaround is saving each building block separately (saveInitialConditionsToPKML / saveParameterValuesToPKML), which loses the module wrapper.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dev-onlyAssign to issues that do not need to be included in any release notes

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions