-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract the txt-to-XML converter from the BICI GUI #33
Comments
Chris says:
|
Doesn't look like I can assign myself to this but i'm happy to take a look. |
Do you know where I might find the Scotland_model.txt? The examples in the BICI download don't seem to work (they have transition type='exponential' which throws an error). |
Nevermind, I found all the models in the BICI github. |
I'm getting the following error when trying to load the 'Scotland_model.txt' using the BICI GUI (and also when using the CLI version i'm creating):
|
I've never tried to do it from the GUI. I'll escalate this to Chris; maybe he knows the reason. It's possible that the BICI GUI is out of date. Maybe he has a newer one. |
Are you using the version available from http://www.mkodb.roslin.ed.ac.uk/EAT/BICI.html? Mac or Windows? |
I get the same when I try it using the macOS version, which was downloaded as http://www.mkodb.roslin.ed.ac.uk/EAT/BICI_v1.0_Mac.zip. |
I am using the Windows one, but I see you're getting the same error on the Mac version. |
Chris says:
|
Thanks. With the updated javascript I now have a working command line tool that can read a model text file and generate the XML file. |
Excellent! Does the generated XML diff identically with the one in the repo? Can you stick it in the repo on a branch, along with some brief info about dependencies and how to run it? I'm going to do more thinking about the workflow for generating the input files in general, so I might play around with it a bit before it's finalised. Just having it runnable from the command line, and in git, is a massive improvement already; thanks very much! |
The only difference in the XML is: |
I have checked in the code on a new branch (text2xml) and added some notes in the README to cover the usage of the tool. There are no dependencies apart from node.js so it shouldn't require and installation, the script should be able to be run as is. |
Great! I'll take a look. Regarding the indmax difference above: there should be three versions of the XML file:
Which are the two which differ by indmax? I'm guessing the difference is between 1 and 3, and that 2 is the same as 3, meaning that the version in the repository wasn't generated by exactly the same version of the code that Chris sent. Alternatively, if 2 and 3 are different, this might be caused by some global variable state that hasn't been properly captured when extracting the required code, and presumably needs to be debugged. |
Really good that we've got this running. Now we can do a bit of tidy-up. A few questions on the branch:
|
Hi. I've fixed the difference in the XML - it was a missing call to initvar() to initialise some global state. |
I've just tried it out. Node was easy to install on my Mac ("sudo port install nodejs14" with MacPorts, and it came in with no extra dependencies). However, while I get the success message, it doesn't seem to actually generate a file!
Can you check that it works for you, and you're not just looking at an old version of the file? |
|
For some reason when the machine is set to "mac" the file that is created is "/tmp/init.xml". (Also set in inference.js line 885). |
Since this is probably only a stopgap measure anyway, and we've only brought in the source files needed for the conversion, this copy isn't going to be used for the GUI in future, so I don't see a problem with modifying it. I guess it would need the variable to be passed through. If it's too painful, then don't bother, but if it's easier, it would be neater and potentially less error-prone (e.g. imagine for some reason we wanted to have more than one conversion running in the same directory at the same time; using a hard-coded output path makes that impossible).
Ah, I searched the diff on the github page, and that was suppressing large diffs. Do you know what the OS is used for? Line endings? I'd remove the "machine" feature and make it work the same across OSes, assuming that's not too complicated.
Maybe to work around sandboxing issues. Anyway, for us, I'd keep things consistent across OSes. I confirm that I have a /tmp/init.xml file generated. |
I've just pushed a commit that should fix both 2 and 3. The new command line usage is:
|
Hmm. Now I get:
Maybe you forgot to commit the changes to one of the files? |
Yes, I forgot to commit the updated inference.js. I've done this now. |
This is an essential piece of the pipeline for constructing the final input file for bici, but it's not in git. It currently exists only in the GUI version of bici (http://www.mkodb.roslin.ed.ac.uk/EAT/BICI.html), which is a 300 MB download. Chris says it is probably all within a single javascript file. This is probably BICI.app/Contents/Resources/app.nw/js/simulate.js, probably
Extract this, make it work standalone, e.g. with something like node.js. It's awkward to pull in such a dependency, so eventually maybe we want to rewrite it in something else (e.g. python or C++) but for now, the fastest thing is to keep it in javascript.
The text was updated successfully, but these errors were encountered: