Search in sources :

Example 1 with Keyword

use of ubic.gemma.model.common.description.Keyword in project Gemma by PavlidisLab.

the class PubMedXMLParserTest method testParseMulti.

/*
     * This uses a medline-format file, instead of the pubmed xml files we get from the eutils.
     */
@Test
public void testParseMulti() throws Exception {
    try {
        testStream = new GZIPInputStream(PubMedXMLParserTest.class.getResourceAsStream("/data/loader/medline.multi.xml.gz"));
        Collection<BibliographicReference> brl = testParser.parse(testStream);
        assertEquals(147, brl.size());
        int expectedNumberofKeywords = 258;
        int expectedNumberofCompounds = 46;
        int actualNumberofKeywords = 0;
        int actualNumberofCompounds = 0;
        for (BibliographicReference reference : brl) {
            assertNotNull(reference.getPublicationDate());
            Collection<Keyword> keywords = reference.getKeywords();
            for (Keyword keyword : keywords) {
                assertNotNull(keyword.getTerm());
                // log.info( keyword.getTerm() );
                actualNumberofKeywords++;
            }
            for (Compound c : reference.getChemicals()) {
                assertNotNull(c.getName());
                // log.info( c.getName() );
                actualNumberofCompounds++;
            }
            assertTrue(reference.getPublicationTypes().size() > 0);
        }
        assertEquals(expectedNumberofKeywords, actualNumberofKeywords);
        assertEquals(expectedNumberofCompounds, actualNumberofCompounds);
    } catch (RuntimeException e) {
        this.logOrThrowException(e);
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) Keyword(ubic.gemma.model.common.description.Keyword) Compound(ubic.gemma.model.expression.biomaterial.Compound) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) Test(org.junit.Test)

Aggregations

GZIPInputStream (java.util.zip.GZIPInputStream)1 Test (org.junit.Test)1 BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)1 Keyword (ubic.gemma.model.common.description.Keyword)1 Compound (ubic.gemma.model.expression.biomaterial.Compound)1