Your idea to use Inkscape (already installed in Ubuntu 16.04) proved to be useful.
In particular Inkscape's command line options allow operations
in a server environment.
Running the command ..
shows this option ..
-l--export-plain-svg=FILENAME
So after exporting baobab1.svg from scram-gui I ran ..
inkscape -f baobab2.svg -l baobab2_inkscape.svg
which injects id attributes into "plain svg".
I then used jquery to apply interactivity to a first test gate and this works.
I will write up the workflow after further testing.
The idea is to use readily available opensource libraries for building interactive trees.
I have mentioned D3.js in an earlier post but there are other useful scripts which work with D3.js.
A localhost server (on port 8000) for testing interactivity can be launched by this command ..
python3 -m http.server 8000