jamesscottbrown / sbml-diff

sbml-diff is a tool for visually representing a single SBM model, or for visually comparing 2 or more SBML models.
http://sysos.eng.ox.ac.uk/tebio/sbml-diff
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Feature Request - Only show changes (within a neighborhood) #14

Open kastman opened 7 years ago

kastman commented 7 years ago

Hi James,

I'm trying to compare draft reconstructions of genome scale models for closely related strains of a species. Does sbml-diff have a functionality to only print the changes (maybe with a relative neighborhood) for the models? This would really be just a first pass, "what's in my model" kind of thing. The outputs are currently very large, which is unwieldy both in time and display.

I poked around in the help and code and didn't see anything obvious, but I thought I'd ask. If not, would you be interested in PRs? Thanks,

Erik

jamesscottbrown commented 7 years ago

This is not currently implemented, but is a good idea. I'd welcome to receive a PR that implements this, if you have time to write one.

The original application for sbml-diff comparing models of genetic circuits in synthetic biology, which are typically quite small. It would be good to increase the size of models to which the tool can be usefully applied.

Implementation

The main sbml-diff.py script creates an object that will produces the output DOT code.

This has a generate_dot function that gets called with an argument that is an object containing the union of all features (nodes or arrows) in the all input models, annotated with a list of which models contain them.

You would need to modify this function, so that it first identifies which features are in the neighborhood of a a change, and prints DOT code only for these.

A feature is changed if it is only present in some of the models (self.num_models != len(model_set)), the stoichiometry for an arrow differs between models (stoich = '?' ), or the rate law of a reaction node differs between models (rate_law == "different").

kastman commented 7 years ago

Seems reasonable - I'll take a crack at this and let you know if I have any questions.

jamesscottbrown commented 6 years ago

Did you have time to try this? If so, did you get it working or encounter problems?

kastman commented 6 years ago

I don't remember why, but I added py3 compatibility (ENH_Py3 branch) and some whitespace nitpick changes that Atom did automatically, but lost progress on the project I was trying to use this for about around September and didn't have any substantial changes.

I'm definitely still interested in doing this, but I don't have the time at the moment. Are you doing a push on it now?

kastman commented 6 years ago

Also happy to rebase that since master is almost a year old. The changes were pretty small IIRC

jamesscottbrown commented 6 years ago

I also added py3 compatability, and made a set of changes that look pretty similar (except that I enocuntered some problem with six.StringIO, so instead use either io.StringIO and io.BytesIO depending on whether 2 or 3 is being used ).

I think this would be a useful feature, but like you I'm fairly busy with other things at the moment.

kastman commented 6 years ago

Yeah, I saw that you'd already pulled a lot of these in. Sorry that I didn't push earlier; it would've saved some work. Out of curiosity, what problems did you find with six?

Again, I agree but it looks like it'll have to wait. When I come back to metabolic modelling again I'll check in with the issue, and push earlier.