|
Hi guys,
I don't think it is necessary to develop yet another parser. The BioJava
parser works perfectly.
> An example :
>
> What we have in the Term object :
>
> Term : SBO:0000368 is_a SBO:0000161
> Term name : SBO:0000368 is_a SBO:0000161
> Term Desc : is_a-relationship
> Term Synonyms : 0
> Term Synonyms : [Ljava.lang.Object;@eb1c260
> Tern Annotation keys : []
> Tern Annotation size : 0
I bet, to create this example you simply used the toString() method in
the Term object.
> What is on the SBO OBO file :
>
> [Term]
> id: SBO:0000368
> name: reverse non-integral order rate constant\, continuous case
> def: "Numerical parameter that quantifies the reverse velocity of a
> chemical reaction where products have non-integral orders. This
> parameter encompasses all the contributions to the velocity except the
> quantity of the products. It is to be used in a reaction modelled using
> a continuous framework. " [src_code:NR]
> is_a: SBO:0000161 ! reverse non-integral order rate constant
It is a little more sophisticated to obtain this information again from
the Term object, but it works. Please try the following code:
import org.biojava.bio.Annotation;
import org.biojava.ontology.Term;
import org.sbml.jsbml.SBO;
/**
* @author Andreas Dräger
*
*/
public class SBOTest {
/**
* @param args an SBO term identifier, e.g., "368".
*/
public static void main(String[] args) {
int id = Integer.parseInt(args[0]);
Term term = SBO.getTerm(id);
Annotation annotation;
Object definition;
String description, def;
if (term != null) {
annotation = term.getAnnotation();
definition = annotation != null ? annotation.getProperty("def")
: null;
def = definition != null ? definition.toString() : "";
def = def.replace("\\n", " ").replace("\\", "");
if (def.startsWith("\"")) {
def = def.substring(1, def.lastIndexOf('"'));
}
def = def.trim();
description = term.getDescription().replace("\\n", " ").replace(
"\\,", ",").trim();
System.out.printf("[Term]\nid:\t%s:%s\n", SBO.getOntology()
.getName(), SBO.sboNumberString(id));
System.out.printf("name:\t%s\n", description);
System.out.printf("def:\t%s\n", def);
}
}
}
And you will obtain:
[Term]
id: SBO:0000368
name: reverse non-integral order rate constant, continuous case
def: Numerical parameter that quantifies the reverse velocity of a
chemical reaction where products have non-integral orders. This
parameter encompasses all the contributions to the velocity except the
quantity of the products. It is to be used in a reaction modelled using
a continuous framework.
for the example above. Nice, isn't it?
Cheers
Andreas
--
Dipl.-Bioinform. Andreas Dräger
Eberhard Karls University Tübingen
Center for Bioinformatics (ZBIT)
Sand 1
72076 Tübingen
Germany
Phone: +49-7071-29-70436
Fax: +49-7071-29-5091
____________________________________________________________
To manage your jsbml-development list subscription, visit
https://utils.its.caltech.edu/mailman/listinfo/jsbml-development
For a web interface to the jsbml-development mailing list, visit
http://sbml.org/Forums/
For questions or feedback about the jsbml-development list,
contact sbml-team@caltech.edu
|