Search in sources :

Example 11 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class EntryPageServiceImpl method filterXrefInPageView.

@Override
public Entry filterXrefInPageView(String entryName, String pageViewName) {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig(entryName).withEverything());
    PageView pageView = PageViewFactory.valueOf(pageViewName.toUpperCase()).getPageView();
    List<DbXref> xrefs = pageView.getFurtherExternalLinksXrefs(entry);
    entry.setXrefs(xrefs);
    entry.setAnnotations(Collections.emptyList());
    entry.setPublications(Collections.emptyList());
    entry.setExperimentalContexts(Collections.emptyList());
    entry.setIdentifiers(Collections.emptyList());
    entry.setInteractions(Collections.emptyList());
    entry.setEnzymes(Collections.emptyList());
    return entry;
}
Also used : PageView(org.nextprot.api.core.domain.ui.page.PageView) DbXref(org.nextprot.api.core.domain.DbXref) Entry(org.nextprot.api.core.domain.Entry) ValidEntry(org.nextprot.api.core.service.annotation.ValidEntry)

Example 12 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class SolrIndexingServiceImpl method indexEntriesChromosome.

@Override
public String indexEntriesChromosome(boolean isGold, String chrName) {
    long seconds = System.currentTimeMillis() / 1000;
    StringBuilder info = new StringBuilder();
    String indexName = isGold ? GoldEntryIndex.NAME : EntryIndex.NAME;
    logAndCollect(info, "adding entries to index " + indexName + " from chromosome " + chrName + "...STARTING at " + new Date());
    String serverUrl = getServerUrl(indexName);
    logAndCollect(info, "Solr server: " + serverUrl);
    EntryBaseSolrIndexer indexer = isGold ? new EntryGoldSolrIndexer(serverUrl) : new EntrySolrIndexer(serverUrl);
    indexer.setTerminologyservice(terminologyService);
    indexer.setEntryBuilderService(entryBuilderService);
    indexer.setPublicationService(publicationService);
    indexer.setEntryReportStatsService(entryReportStatsService);
    logAndCollect(info, "getting entry list of chromosome " + chrName);
    List<String> allentryids = masterIdentifierService.findUniqueNamesOfChromosome(chrName);
    logAndCollect(info, "start indexing of " + allentryids.size() + " entries");
    int ecnt = 0;
    for (String id : allentryids) {
        ecnt++;
        Entry currentry = entryBuilderService.buildWithEverything(id);
        indexer.add(currentry);
        if ((ecnt % 300) == 0)
            logAndCollect(info, ecnt + "/" + allentryids.size() + " entries added to index " + indexName + " for chromosome " + chrName);
    }
    indexer.addRemaing();
    logAndCollect(info, "committing index " + indexName);
    indexer.commit();
    seconds = (System.currentTimeMillis() / 1000 - seconds);
    logAndCollect(info, "added entries to index " + indexName + "from chromosome " + chrName + " in " + seconds + " seconds ...END at " + new Date());
    return info.toString();
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Date(java.util.Date)

Example 13 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class ChromosomeFieldBuilderDiffTest method testEntryGivesSameIndexAsSolrIndex.

private void testEntryGivesSameIndexAsSolrIndex(String uniqueName) {
    Entry entry = getEntry(uniqueName);
    System.out.println(entry.getUniqueName());
    testChrLoc(entry);
    testChrLocS(entry);
    testGeneBand(entry);
}
Also used : Entry(org.nextprot.api.core.domain.Entry)

Example 14 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class GenerateSolrAnnotationIndex method start.

@Override
public void start(String[] args) {
    MasterIdentifierService MasterEntryService = getBean(MasterIdentifierService.class);
    EntryBuilderService entryBuilderService = getBean(EntryBuilderService.class);
    int ecnt = 0;
    String solrServer = System.getProperty("solr.server");
    NPreconditions.checkNotNull(solrServer, "Please set solr.server variable. For example: java -Dsolr.server=\"http://localhost:8983/solr/npentries1\"");
    logger.info("Solr server: " + solrServer);
    EntrySolrIndexer indexer = new EntrySolrIndexer(solrServer);
    // Get an access to some needed services
    indexer.setTerminologyservice(getBean(TerminologyService.class));
    indexer.setEntryBuilderService(getBean(EntryBuilderService.class));
    indexer.setPublicationService(getBean(PublicationService.class));
    indexer.setEntryReportStatsService(getBean(EntryReportStatsService.class));
    // Remove previous indexes
    logger.info("removing all solr entries records");
    indexer.clearDatabase("");
    Set<String> allentryids;
    // System.err.println("getting all entries from API");
    logger.info("getting all entries from API");
    long start = System.currentTimeMillis();
    allentryids = MasterEntryService.findUniqueNames();
    logger.info("indexing " + allentryids.size() + " entries...");
    for (String id : allentryids) {
        ecnt++;
        // String id = "NX_Q8WZ42"; // debug (titin)
        // String id = "NX_Q14524"; // debug (scn5a)
        logger.info(System.currentTimeMillis() + ": start building " + id);
        Entry currentry = entryBuilderService.buildWithEverything(id);
        indexer.add(currentry);
        logger.info(id + " done...");
        if ((ecnt % 1000) == 0)
            logger.info(ecnt + " entries indexed...");
    }
    indexer.addRemaing();
    logger.info("comitting");
    indexer.commit();
    logger.info(ecnt + " entries indexed in " + (System.currentTimeMillis() - start) / 1000 + " seconds...END");
}
Also used : Entry(org.nextprot.api.core.domain.Entry) EntrySolrIndexer(org.nextprot.api.tasks.solr.indexer.EntrySolrIndexer)

Example 15 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class SequenceVariantTest method mockEntryWithGenes.

private Entry mockEntryWithGenes(String... geneNames) {
    Entry entry = Mockito.mock(Entry.class);
    Overview overview = Mockito.mock(Overview.class);
    when(entry.getOverview()).thenReturn(overview);
    List<EntityName> names = new ArrayList<>();
    for (String geneName : geneNames) {
        EntityName entityName = new EntityName();
        entityName.setName(geneName);
        names.add(entityName);
    }
    when(overview.getGeneNames()).thenReturn(names);
    return entry;
}
Also used : Entry(org.nextprot.api.core.domain.Entry) EntityName(org.nextprot.api.core.domain.EntityName) ArrayList(java.util.ArrayList) Overview(org.nextprot.api.core.domain.Overview)

Aggregations

Entry (org.nextprot.api.core.domain.Entry)60 Test (org.junit.Test)38 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)16 Annotation (org.nextprot.api.core.domain.annotation.Annotation)9 Isoform (org.nextprot.api.core.domain.Isoform)8 EntryConfig (org.nextprot.api.core.service.fluent.EntryConfig)8 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)8 EntryBuilderService (org.nextprot.api.core.service.EntryBuilderService)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 Assert (org.junit.Assert)4 Ignore (org.junit.Ignore)4 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)4 DbXref (org.nextprot.api.core.domain.DbXref)4 ArrayList (java.util.ArrayList)3 PropertyApiModel (org.nextprot.api.commons.constants.PropertyApiModel)3 SolrDiffTest (org.nextprot.api.tasks.solr.indexer.entry.SolrDiffTest)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 PrintWriter (java.io.PrintWriter)2 java.util (java.util)2