libsbml icon indicating copy to clipboard operation
libsbml copied to clipboard

VS Code Extension - SBML linting

Open baconcheese113 opened this issue 7 months ago • 7 comments

Thanks for all your work on this lib, I've published a VS Code extension that will validate sbml files as you write them.

https://marketplace.visualstudio.com/items/?itemName=joseph-yannessa.sbml-linter

baconcheese113 avatar May 01 '25 08:05 baconcheese113

@baconcheese113 thanks for letting us know, this seems quite interesting. It would be great if the extension would work on other systems as well. maybe a WASM version of sbml_validator would help, so it could run on all systems?

fbergmann avatar May 01 '25 11:05 fbergmann

@fbergmann I've been struggling to build a wasm-compatible .a archive from libsbml over the past couple days. If you get a chance, could you help ensure libSBML’s CMakeLists.txt supports static-only builds using Emscripten (via emcmake cmake) to produce an .a archive for linking into my wam project? Currently, even with -DBUILD_SHARED_LIBS=OFF, it seems the build still defaults to shared libraries. Or if you've already built this, could you provide the .a? https://github.com/baconcheese113/sbml-linter/blob/wasm-support/sbml_validator.cpp#L6

baconcheese113 avatar May 03 '25 08:05 baconcheese113

@baconcheese113 no problem, do you need it for a specific emscripten version?

fbergmann avatar May 03 '25 13:05 fbergmann

@fbergmann Thanks! I'm currently using emcc 4.0.8, however I'd be happy to downgrade if you run into any trouble building with emcc v4

baconcheese113 avatar May 03 '25 15:05 baconcheese113

@baconcheese113 : We put this together a few years back, but if it helps: https://github.com/sys-bio/libsbmljs

We'll be updating it to the latest version of libsbml soon; we need it for our other projects.

luciansmith avatar May 03 '25 15:05 luciansmith

@luciansmith I actually gave libsbmljs a try, but ran into a number of issues getting the Gradle build working. It seems to rely on several legacy tools and build assumptions from ~7 years ago, and I hit too many hurdles to get it building cleanly in a modern setup.

Instead, I opted to build native binaries directly for sbml-linter. Version 1.1.0 now includes support for Windows 11 and macOS 14/15. I started work on a Linux build too, but held off shipping it due to unresolved linking issues.

Looking forward to the upcoming libsbmljs update, I'd love to revisit this once it's refreshed!

baconcheese113 avatar May 04 '25 01:05 baconcheese113

I think it is actually for this project better not to use the full libsbml.js, and instead just go with the validation logic needed. I've compiled a version of the sbml_validator, though I needed to make some changes since we won't have direct access to the filesystem. So instead it exposes a method, that would validate a given sbml string and return the json string:

var validator = require('./sbml_validator.js');
var fs = require("fs");

validator().then((Module) => {

    // instantiate validator
    var instance = Module;

    // load a local file using the filesystem 
    var data = fs.readFileSync(process.argv[2], 'utf8');

    // print validation errors
    console.log(instance.validateSBMLString(data));

});

I've bundled all my changes as well as a build of an example for download here https://heibox.uni-heidelberg.de/d/a21b4a7c176041998a7a/

fbergmann avatar May 05 '25 12:05 fbergmann