Search in sources :

Example 26 with BibliographicReference

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

the class LoadEvidenceForClassifier method findMeshTerms.

// return mesh term of a pubmed format : meshTerm1;meshTerm2;meshTerms3.... etc
private String findMeshTerms(String pubmed) {
    StringBuilder result = new StringBuilder();
    DatabaseEntry de = DatabaseEntry.Factory.newInstance();
    de.setAccession(pubmed);
    BibliographicReference bi = BibliographicReference.Factory.newInstance();
    bi.setPubAccession(de);
    System.out.println(pubmed);
    BibliographicReference b = this.bibliographicReferenceService.find(bi);
    for (MedicalSubjectHeading m : b.getMeshTerms()) {
        result.append(m.getTerm()).append(";");
    }
    return result.toString();
}
Also used : DatabaseEntry(ubic.gemma.model.common.description.DatabaseEntry) MedicalSubjectHeading(ubic.gemma.model.common.description.MedicalSubjectHeading) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference)

Example 27 with BibliographicReference

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

the class SearchServiceTest method testSearchByBibRefIdProblemsB.

@Test
public void testSearchByBibRefIdProblemsB() {
    try {
        this.setup();
    } catch (Exception e) {
        e.printStackTrace();
    }
    PubMedXMLFetcher fetcher = new PubMedXMLFetcher();
    BibliographicReference bibref = fetcher.retrieveByHTTP(22780917);
    bibref = (BibliographicReference) persisterHelper.persist(bibref);
    assertTrue(bibref.getAbstractText().contains("d to chromosome 22q12. Our results confirm chromosome 22q12 as the solitary locus for FFEVF"));
    IndexerTaskCommand c = new IndexerTaskCommand();
    c.setIndexBibRef(true);
    indexerTask.setTaskCommand(c);
    indexerTask.execute();
    SearchSettings settings = SearchSettings.Factory.newInstance();
    settings.noSearches();
    settings.setQuery("confirm chromosome 22q12");
    settings.setSearchBibrefs(true);
    Map<Class<?>, List<SearchResult>> found = this.searchService.search(settings);
    assertTrue(!found.isEmpty());
    for (SearchResult sr : found.get(BibliographicReference.class)) {
        if (sr.getResultObject().equals(bibref)) {
            this.tearDown();
            return;
        }
    }
    this.tearDown();
    fail("Didn't get expected result from search");
}
Also used : IndexerTaskCommand(ubic.gemma.core.tasks.maintenance.IndexerTaskCommand) SearchSettings(ubic.gemma.model.common.search.SearchSettings) PubMedXMLFetcher(ubic.gemma.core.loader.entrez.pubmed.PubMedXMLFetcher) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 28 with BibliographicReference

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

the class SearchServiceTest method testSearchByBibRefIdProblems.

@Test
public void testSearchByBibRefIdProblems() {
    try {
        this.setup();
    } catch (Exception e) {
        e.printStackTrace();
    }
    PubMedXMLFetcher fetcher = new PubMedXMLFetcher();
    BibliographicReference bibref = fetcher.retrieveByHTTP(9600966);
    bibref = (BibliographicReference) persisterHelper.persist(bibref);
    assertTrue(bibref.getAbstractText().contains("ase proved to be a de novo mutation. In the third kindred, affected brothers both have a"));
    IndexerTaskCommand c = new IndexerTaskCommand();
    c.setIndexBibRef(true);
    indexerTask.setTaskCommand(c);
    indexerTask.execute();
    SearchSettings settings = SearchSettings.Factory.newInstance();
    settings.noSearches();
    settings.setQuery("de novo mutation");
    settings.setSearchBibrefs(true);
    Map<Class<?>, List<SearchResult>> found = this.searchService.search(settings);
    assertTrue(!found.isEmpty());
    for (SearchResult sr : found.get(BibliographicReference.class)) {
        if (sr.getResultObject().equals(bibref)) {
            this.tearDown();
            return;
        }
    }
    this.tearDown();
    fail("Didn't get expected result from search");
}
Also used : IndexerTaskCommand(ubic.gemma.core.tasks.maintenance.IndexerTaskCommand) SearchSettings(ubic.gemma.model.common.search.SearchSettings) PubMedXMLFetcher(ubic.gemma.core.loader.entrez.pubmed.PubMedXMLFetcher) BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 29 with BibliographicReference

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

the class BibliographicReferenceServiceImplTest method testFindByExternalId.

@Test
public final void testFindByExternalId() {
    BibliographicReference mockBR = BibliographicReference.Factory.newInstance();
    mockBR.setPubAccession(de);
    mockBR.setTitle("My Title");
    brdao.findByExternalId("12345", "PUBMED");
    expectLastCall().andReturn(mockBR);
    replay(brdao);
    svc.findByExternalId("12345", "PUBMED");
    verify(brdao);
}
Also used : BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest) Test(org.junit.Test)

Example 30 with BibliographicReference

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

the class PubMedXMLFetcherTest method testRetrieveByHTTPNotFound.

@Test
public final void testRetrieveByHTTPNotFound() {
    try {
        BibliographicReference br = pmf.retrieveByHTTP(1517311444);
        assertNull(br);
    } catch (RuntimeException e) {
        this.checkCause(e);
    }
}
Also used : BibliographicReference(ubic.gemma.model.common.description.BibliographicReference) 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