http://sf.net/projects/sbml/files/libsbml/5.2.0/
New this time around is that we also provide binaries for all the SBML Level 3 Extension packages. So if you are interested in providing software support for:
- FBC
- COMP
- LAYOUT
- GROUPS
- REQ
- SPATIAL
New Features
There are two new features I want to bring to your attention, that is the facility for custom validators and converters. By inheriting form SBMLConverter or SBMLValidator it is now possible for your application to quickly check for specific aspects of documents that is important to you.
Here just one example on how you could check that your SBML model does not contain Algebraic Rules or Fast reactions if your application does not support them.
1: /**
2: * Declares a custom validator to be called. This allows you to validate
3: * any aspect of an SBML Model that you want to be notified about. You could
4: * use this to notify your application that a model contains an unsupported
5: * feature of SBML (either as warning).
6: *
7: * In this example the validator will go through the model and test for the
8: * presence of 'fast' reactions and algebraic rules. If either is used a
9: * warning will be added to the error log.
10: */
11: class MyCustomValidator : public SBMLValidator
12: {
13: public:
14: MyCustomValidator() : SBMLValidator() {}
15: MyCustomValidator(const MyCustomValidator& orig) : SBMLValidator(orig) {
16:
17: }
18: virtual ~MyCustomValidator() {}
19:
20: virtual SBMLValidator* clone() const { return new MyCustomValidator(*this); }
21:
22: virtual unsigned int validate() {
23: // if we don't have a model we don't apply this validator.
24: if (getDocument() == NULL || getModel() == NULL)
25: return 0;
26:
27: // if we have no rules and reactions we don't apply this validator either
28: if (getModel()->getNumReactions() == 0 && getModel()->getNumRules() == 0)
29: return 0;
30:
31: unsigned int numErrors = 0;
32: // test for algebraic rules
33: for (unsigned int i = 0; i < getModel()->getNumRules(); i++)
34: {
35: if (getModel()->getRule(i)->getTypeCode() == SBML_ALGEBRAIC_RULE) {
36:
37: getErrorLog()->add(SBMLError(99999, 3, 1,
38: "This model uses algebraic rules, however this application does not support them.",
39: 0, 0,
40: LIBSBML_SEV_WARNING, // or LIBSBML_SEV_ERROR if you want to stop
41: LIBSBML_CAT_SBML // or whatever category you prefer
42: ));
43:
44: numErrors++;
45: }
46: }
47:
48: // test for fast reactions
49: for (unsigned int i = 0; i < getModel()->getNumReactions(); i++)
50: {
51: // test whether value is set, and true
52: if (getModel()->getReaction(i)->isSetFast() &&
53: getModel()->getReaction(i)->getFast()) {
54:
55: getErrorLog()->add(SBMLError(99999, 3, 1,
56: "This model uses fast reactions, however this application does not support them.",
57: 0, 0,
58: LIBSBML_SEV_WARNING, // or LIBSBML_SEV_ERROR if you want to stop
59: LIBSBML_CAT_SBML // or whatever category you prefer
60: ));
61:
62: numErrors++;
63:
64: }
65: }
66:
67: return numErrors;
68: }
69:
70:
71: };
72:
73:
74: int
75: main (int argc, char *argv[])
76: {
77: if (argc != 2)
78: {
79: cout << endl << "Usage: addCustomValidator filename" << endl << endl;
80: return 1;
81: }
82:
83: const char* filename = argv[1];
84:
85: // read the file name
86: SBMLDocument* document = readSBML(filename);
87:
88: // add a custom validator
89: document->addValidator(new MyCustomValidator());
90:
91: // check consistency like before
92: int numErrors = document->checkConsistency();
93:
94: // print errors and warnings
95: document->printErrors();
96:
97: // return number of errors
98: return numErrors;
99:
100: }
Linux Packages
For this release we provide again DEB and RPM files with binaries compiled on CentOS 4.6 and Ubuntu 8. This means they use a libc version that is reasonably old and will not cause problems on newer distributions.
Listening to feedback from our users the default install prefix has been changed to /usr. And we also include language bindings in them.
The plan was to use the OpenBuildService (OBS), but unfortunately I was not yet able to create binaries with language bindings for all different distributions. I hope we can sort this out for the next release.
No comments:
Post a Comment