Search in sources :

Example 6 with BibliographicReference

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

the class ExpressionExperimentBibRefFinderTest method testLocatePrimaryReference.

@Test
public void testLocatePrimaryReference() throws Exception {
    ExpressionExperimentBibRefFinder finder = new ExpressionExperimentBibRefFinder();
    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    DatabaseEntry de = DatabaseEntry.Factory.newInstance();
    ExternalDatabase ed = ExternalDatabase.Factory.newInstance();
    ed.setName("GEO");
    de.setAccession("GSE3023");
    de.setExternalDatabase(ed);
    ee.setAccession(de);
    try {
        BibliographicReference bibref = null;
        for (int i = 0; i < 3; i++) {
            bibref = finder.locatePrimaryReference(ee);
            if (bibref != null)
                break;
            Thread.sleep(1000);
        }
        assertNotNull(bibref);
        assertEquals("Differential gene expression in anatomical compartments of the human eye.", bibref.getTitle());
    } catch (Exception e) {
        checkCause(e);
    }
}
Also used : ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) IOException(java.io.IOException) Test(org.junit.Test)

Example 7 with BibliographicReference

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

the class ExpressionExperimentBibRefFinderTest method testLocatePrimaryReferenceInvalidGSE.

@Test
public void testLocatePrimaryReferenceInvalidGSE() throws Exception {
    ExpressionExperimentBibRefFinder finder = new ExpressionExperimentBibRefFinder();
    ExpressionExperiment ee = ExpressionExperiment.Factory.newInstance();
    DatabaseEntry de = DatabaseEntry.Factory.newInstance();
    ExternalDatabase ed = ExternalDatabase.Factory.newInstance();
    ed.setName("GEO");
    de.setAccession("GSE30231111111111111");
    de.setExternalDatabase(ed);
    ee.setAccession(de);
    try {
        BibliographicReference bibref = finder.locatePrimaryReference(ee);
        assert (bibref == null);
    } catch (Exception e) {
        checkCause(e);
    }
}
Also used : ExternalDatabase(ubic.gemma.model.common.description.ExternalDatabase) DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) IOException(java.io.IOException) Test(org.junit.Test)

Example 8 with BibliographicReference

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

the class PubMedXMLParserTest method testParse.

@Test
public void testParse() {
    try {
        testStream = PubMedXMLParserTest.class.getResourceAsStream("/data/pubmed-test.xml");
        Collection<BibliographicReference> brl = testParser.parse(testStream);
        BibliographicReference br = brl.iterator().next();
        assertEquals("Lee, Homin K; Hsu, Amy K; Sajdak, Jon; Qin, Jie; Pavlidis, Paul", br.getAuthorList());
        assertNotNull(br.getAbstractText());
        assertEquals("Genome Res", br.getPublication());
        assertEquals("15173114", br.getPubAccession().getAccession());
        assertEquals("Coexpression analysis of human genes across many microarray data sets.", br.getTitle());
        assertNotNull(br.getVolume());
        assertNotNull(br.getPages());
        SimpleDateFormat f = new SimpleDateFormat("mm/HH/MM/dd/yyyy");
        assertEquals("00/00/06/01/2004", f.format(br.getPublicationDate()));
    } catch (RuntimeException e) {
        this.logOrThrowException(e);
    }
}
Also used : BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.Test)

Example 9 with BibliographicReference

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

the class PubMedXMLParserTest method testParseMesh.

@Test
public void testParseMesh() {
    try {
        testStream = PubMedXMLParserTest.class.getResourceAsStream("/data/pubmed-mesh-test.xml");
        Collection<BibliographicReference> brl = testParser.parse(testStream);
        BibliographicReference br = brl.iterator().next();
        Collection<MedicalSubjectHeading> meshTerms = br.getMeshTerms();
        assertEquals(16, meshTerms.size());
    // for ( MedicalSubjectHeading heading : meshTerms ) {
    // log.info( heading.getTerm() + " " + heading.getIsMajorTopic() );
    // for ( MedicalSubjectHeading q : heading.getQualifiers() ) {
    // log.info( " qualifier: " + q.getTerm() + " " + q.getIsMajorTopic() );
    // }
    // }
    } catch (RuntimeException e) {
        this.logOrThrowException(e);
    }
}
Also used : MedicalSubjectHeading(ubic.gemma.model.common.description.MedicalSubjectHeading) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) Test(org.junit.Test)

Example 10 with BibliographicReference

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

the class PubMedXMLParserTest method testParseBookArticle.

/*
     * Test uses 2030131
     */
@Test
public void testParseBookArticle() {
    try {
        testStream = PubMedXMLParserTest.class.getResourceAsStream("/data/pubmed-bookarticle.xml");
        Collection<BibliographicReference> brl = testParser.parse(testStream);
        BibliographicReference br = brl.iterator().next();
        assertNotNull(br);
        assertEquals("Pagon, Roberta A; Bird, Thomas D; Dolan, Cynthia R; Stephens, Karen", br.getEditor());
        assertEquals("Kuhlenbaumer, Gregor; Timmerman, Vincent", br.getAuthorList());
        assertEquals("GeneReviews", br.getPublication());
        assertEquals("Giant Axonal Neuropathy", br.getTitle());
        SimpleDateFormat f = new SimpleDateFormat("yyyy");
        Date publicationDate = br.getPublicationDate();
        assertNotNull(publicationDate);
        assertEquals("2003", f.format(publicationDate));
        assertTrue(br.getAbstractText().startsWith("Giant axonal neuropathy (GAN) is characterized by a severe early-onset"));
        assertTrue(br.getAbstractText().endsWith("offering custom prenatal testing if the disease-causing mutations in a family are known."));
    } catch (RuntimeException e) {
        this.logOrThrowException(e);
    }
}
Also used : BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.Test)

Aggregations

BibliographicReference (ubic.gemma.model.common.description.BibliographicReference)45 Test (org.junit.Test)18 BibliographicReferenceValueObject (ubic.gemma.model.common.description.BibliographicReferenceValueObject)9 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)8 PubMedXMLFetcher (ubic.gemma.core.loader.entrez.pubmed.PubMedXMLFetcher)6 IOException (java.io.IOException)5 SimpleDateFormat (java.text.SimpleDateFormat)5 Transactional (org.springframework.transaction.annotation.Transactional)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)5 SearchSettings (ubic.gemma.model.common.search.SearchSettings)4 ArrayList (java.util.ArrayList)3 IndexerTaskCommand (ubic.gemma.core.tasks.maintenance.IndexerTaskCommand)3 DatabaseEntry (ubic.gemma.model.common.description.DatabaseEntry)3 MedicalSubjectHeading (ubic.gemma.model.common.description.MedicalSubjectHeading)3 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)3 URL (java.net.URL)2 Date (java.util.Date)2 StopWatch (org.apache.commons.lang3.time.StopWatch)2 ExternalDatabase (ubic.gemma.model.common.description.ExternalDatabase)2