Re: [Gohelp] Fwd: OBO parser

3 views
Skip to first unread message

Chris Mungall

unread,
Sep 28, 2010, 6:14:31 PM9/28/10
to Susan Tweedie, GO Software Group, GO Help List, OBO-Edit Developers Group

Hi Tim

Sorry for the delayed response.

Unfortunately, the term "property" is ambiguous generally and used
inconsistently within the OBO model and documentation. When you say
you want all the properties in a stanza, this could mean different
things:

[1] all the individual tag-value tuples
[2] all the relationship tag-value tuples
[3] all the "property_value" tag-value triples
[4] a number of other interpretations

If you're intent is to do [1] this is actually quite difficult with
the existing object model. Can you provide more details? You can
remove everything in the cc other than the OE dev list.

Is this for a one-off project, or for building PRO infrastructure? I
wouldn't recommend the existing org.obo model for the latter at this
time. There is a new java parser housed on googlecode
http://code.google.com/p/oboformat/

This is still in the early stages and in general I would not recommend
it for production use at this time. However, as it happens, Tim
Danford is working on a project with the PRO and there is the
possibility he will be helping out with this codebase. So depending on
your timeline and requirements it may be worthwhile us coordinating
with you here.

On Sep 10, 2010, at 12:14 PM, Susan Tweedie wrote:

> Hi software group
>
> Can anyone offer Tim any help with the OBO parser?
>
> Thanks,
> Susan
>
> Begin forwarded message:
>
>> From: gohelp-...@genome.stanford.edu
>> Date: 10 September 2010 20:07:16 BST
>> To: sa...@gen.cam.ac.uk
>> Subject: Forward of moderated message
>>
>>
>> From: arms...@cis.udel.edu
>> Date: 10 September 2010 15:56:15 BST
>> To: goh...@genome.stanford.edu
>> Subject: GO Help query (from website)
>>
>>
>>
>> Email: arms...@cis.udel.edu
>> Name: Software (from Tim Arrmstrong)
>> Text: Hello,
>>
>> I’m a research assistant for the Protein Ontology project (http://pir.georgetown.edu/pro/pro.shtml
>> ). I’m trying to parse an OBO file, but I’m having difficulty
>> getting the OBO Parser to work. I’m trying to follow the
>> directions at http://wiki.geneontology.org/index.php/OBO-Edit:_OBO_Parser_-_Getting_Started
>> . I just want a list of all the properties in a stanza. I’m
>> wondering if you might be able to tell me what’s wrong with my
>> code? It prints a list of the ids, but not the properties. The
>> file is ftp://ftp.pir.georgetown.edu/databases/ontology/pro_obo/pro.obo
>> .
>>
>> Thanks, if you can help,
>> Tim Armstrong
>> Graduate Student
>> Computer and Information Sciences
>> University of Delaware
>>
>> package edu.udel.dbi.proparser;
>>
>> import java.io.IOException;
>> import java.util.Collection;
>> import java.util.LinkedList;
>>
>> import org.obo.dataadapter.DefaultOBOParser;
>> import org.obo.dataadapter.OBOParseEngine;
>> import org.obo.dataadapter.OBOParseException;
>> import org.obo.datamodel.IdentifiedObject;
>> import org.obo.datamodel.OBOSession;
>> import org.obo.datamodel.PropertyValue;
>>
>> public class PROParser
>> {
>> /**
>> * Code from http://wiki.geneontology.org/index.php/OBO-Edit:_OBO_Parser_-_Getting_Started
>> */
>> public static OBOSession getSession(String path) throws
>> IOException, OBOParseException
>> {
>> DefaultOBOParser parser = new DefaultOBOParser();
>> OBOParseEngine engine = new OBOParseEngine(parser);
>> //OBOParseEngine can parse several files at once
>> //and create one munged-together ontology,
>> //so we need to provide a Collection to the setPaths() method
>> Collection<String> paths = new LinkedList<String>();
>> paths.add(path);
>> engine.setPaths(paths);
>> engine.parse();
>> OBOSession session = parser.getSession();
>> return session;
>> }
>>
>> public static void main(String[] args)
>> {
>> OBOSession results = null;
>>
>> try
>> {
>> results = getSession("/media/Data/workspaces/PRO_ws/pro.obo");
>> }
>> catch (IOException e)
>> {
>> e.printStackTrace();
>> System.exit(1);
>> }
>> catch (OBOParseException e)
>> {
>> e.printStackTrace();
>> System.exit(1);
>> }
>>
>> for (IdentifiedObject io : results.getObjects())
>> {
>> System.out.println(io.getName());
>>
>> for (PropertyValue pv : io.getPropertyValues())
>> {
>> System.out.println("\t" + pv.getProperty() + " : " +
>> pv.getValue());
>> }
>> }
>> }
>> }
>>
>>
>
> _______________________________________________
> Gohelp mailing list
> Goh...@geneontology.org
> http://fafner.stanford.edu/mailman/listinfo/gohelp

Reply all
Reply to author
Forward
0 new messages