Package org.obolibrary.oboformat.model

Examples of org.obolibrary.oboformat.model.OBODoc


@SuppressWarnings({ "javadoc", "null" })
public class XrefExpanderTest extends OboFormatTestBasics {

    @Test
    public void testExpand() {
        OBODoc obodoc = parseOBOFile("treat_xrefs_test.obo");
        XrefExpander x = new XrefExpander(obodoc);
        x.expandXrefs();
        OBODoc tdoc = obodoc.getImportedOBODocs().iterator().next();
        assertTrue(!tdoc.getTermFrames().isEmpty());
        Frame termFrame = tdoc.getTermFrame("ZFA:0001689");
        assert termFrame != null;
        assertEquals(2, termFrame.getClauses(OboFormatTag.TAG_INTERSECTION_OF)
                .size());
        termFrame = tdoc.getTermFrame("EHDAA:571");
        assert termFrame != null;
        assertEquals("UBERON:0002539",
                termFrame.getClause(OboFormatTag.TAG_IS_A).getValue());
        termFrame = tdoc.getTermFrame("UBERON:0006800");
        assert termFrame != null;
        assertEquals("CARO:0000008", termFrame.getClause(OboFormatTag.TAG_IS_A)
                .getValue());
    }
View Full Code Here


                .getValue());
    }

    @Test
    public void testExpandIntoSeparateBridges() {
        OBODoc obodoc = parseOBOFile("treat_xrefs_test.obo");
        XrefExpander x = new XrefExpander(obodoc, "bridge");
        x.expandXrefs();
        int n = 0;
        for (OBODoc tdoc : obodoc.getImportedOBODocs()) {
            Frame hf = tdoc.getHeaderFrame();
            if (hf == null) {
                continue;
            }
            Clause impClause = hf.getClause(OboFormatTag.TAG_ONTOLOGY);
View Full Code Here

@SuppressWarnings("javadoc")
public class IgnoreImportAnnotationsTest extends OboFormatTestBasics {

    @Test
    public void testIgnoreAnnotations() {
        OBODoc oboDoc = parseOBOFile("annotated_import.obo");
        Frame headerFrame = oboDoc.getHeaderFrame();
        Collection<Clause> imports = headerFrame
                .getClauses(OboFormatTag.TAG_IMPORT);
        assertEquals(1, imports.size());
        Clause clause = imports.iterator().next();
        Collection<QualifierValue> qualifierValues = clause
View Full Code Here

@SuppressWarnings({ "javadoc", "null" })
public class OboEscapeCharsTest extends OboFormatTestBasics {

    @Test
    public void testEscapeChars() {
        OBODoc obodoc = parseOBOFile("escape_chars_test.obo");
        assertEquals(3, obodoc.getTermFrames().size());
        Frame f1 = obodoc.getTermFrame("GO:0033942");
        assertEquals("GO:0033942", f1.getId());
        Clause nameClause = f1.getClause(OboFormatTag.TAG_NAME);
        assertEquals(
                "4-alpha-D-{(1->4)-alpha-D-glucano}trehalose trehalohydrolase activity",
                nameClause.getValue());
        Frame f2 = obodoc.getTermFrame("CL:0000096");
        assertEquals("CL:0000096", f2.getId());
        Clause defClause = f2.getClause(OboFormatTag.TAG_DEF);
        assertEquals("bla bla .\"", defClause.getValue());
        Clause commentClause = f2.getClause(OboFormatTag.TAG_COMMENT);
        assertEquals("bla bla bla.\nbla bla (bla).", commentClause.getValue());
View Full Code Here

        assertEquals("bla bla bla.\nbla bla (bla).", commentClause.getValue());
    }

    @Test
    public void testRoundTripEscapeChars() throws Exception {
        OBODoc oboDoc = parseOBOFile("escape_chars_test.obo");
        String oboToString = renderOboToString(oboDoc);
        OBODoc oboDoc2 = parseOboToString(oboToString);
        assertNotNull("There was an error during parsing of the obodoc",
                oboDoc2);
        List<Diff> diffs = OBODocDiffer.getDiffs(oboDoc, oboDoc2);
        assertEquals("Expected no diffs.", 0, diffs.size());
        String original = readResource("escape_chars_test.obo");
View Full Code Here

@SuppressWarnings("javadoc")
public class OBODocDifferTest extends OboFormatTestBasics {

    @Test
    public void testIdentical() {
        OBODoc obodoc1 = parseOBOFile("caro.obo");
        OBODoc obodoc2 = parseOBOFile("caro.obo");
        List<Diff> diffs = OBODocDiffer.getDiffs(obodoc1, obodoc2);
        assertEquals(0, diffs.size());
    }
View Full Code Here

        assertEquals(0, diffs.size());
    }

    @Test
    public void testDiff() {
        OBODoc obodoc1 = parseOBOFile("caro.obo");
        OBODoc obodoc2 = parseOBOFile("caro_modified.obo");
        List<Diff> diffs = OBODocDiffer.getDiffs(obodoc1, obodoc2);
        assertEquals(19, diffs.size());
    }
View Full Code Here

@SuppressWarnings("javadoc")
public class SingleIntersectionOfTagTest extends OboFormatTestBasics {

    @Test(expected = FrameStructureException.class)
    public void testParseOBOFile() throws Exception {
        OBODoc obodoc = parseOBOFile("single_intersection_of_tag_test.obo");
        assertEquals(2, obodoc.getTermFrames().size());
        Frame frame = obodoc.getTermFrames().iterator().next();
        assertNotNull(frame);
        renderOboToString(obodoc); // throws FrameStructureException
    }
View Full Code Here

public class OboFormatTestBasics {

    @Nonnull
    protected OBODoc parseOBOURL(String fn) throws IOException {
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc = p.parseURL(fn);
        assertTrue(!obodoc.getTermFrames().isEmpty());
        return obodoc;
    }
View Full Code Here

    @SuppressWarnings("resource")
    @Nonnull
    protected OBODoc parseOBOFile(String fn, boolean allowEmptyFrames) {
        InputStream inputStream = getInputStream(fn);
        OBOFormatParser p = new OBOFormatParser();
        OBODoc obodoc;
        try {
            obodoc = p.parse(new BufferedReader(new InputStreamReader(
                    inputStream)));
            assertNotNull("The obodoc should not be null", obodoc);
            if (obodoc.getTermFrames().isEmpty() && !allowEmptyFrames) {
                fail("Term frames should not be empty.");
            }
            return obodoc;
        } catch (IOException e) {
            throw new OWLRuntimeException(e);
View Full Code Here

TOP

Related Classes of org.obolibrary.oboformat.model.OBODoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.