use of org.nextprot.api.core.service.MasterIdentifierService in project nextprot-api by calipho-sib.
the class StatementExportTask method execute.
@Override
protected void execute() throws FileNotFoundException {
StatementDao statementDao = getBean(StatementDao.class);
MasterIdentifierService masterIdentifierService = getBean(MasterIdentifierService.class);
ArgumentParser parser = getCommandLineParser();
StatementExporter exporter = new StatementExporter(statementDao, masterIdentifierService, parser.getExporterConfig());
LOGGER.info("exporting gene statements...");
// get all genes if no genes were specified
if (parser.getSpecificGeneListToExport().isEmpty()) {
Map<String, String> map = exporter.exportAllGeneStatementsAsTsvString();
for (String geneName : map.keySet()) {
exporter.exportAsTsvFile(parser.getOutputDirname(), geneName, map.get(geneName));
LOGGER.info("gene statements of " + geneName + " exported");
}
} else {
for (String geneName : parser.getSpecificGeneListToExport()) {
exporter.exportAsTsvFile(parser.getOutputDirname(), geneName, exporter.exportGeneStatementsAsTsvString(geneName));
LOGGER.info("gene statements of " + geneName + " exported");
}
}
}
use of org.nextprot.api.core.service.MasterIdentifierService in project nextprot-api by calipho-sib.
the class GenerateSolrAnnotationIndexGold 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/npentries1gold\"");
logger.info("Solr server: " + solrServer);
EntryGoldSolrIndexer indexer = new EntryGoldSolrIndexer(solrServer);
// Get an access to some needed services
indexer.setTerminologyservice(getBean(TerminologyService.class));
indexer.setEntryBuilderService(getBean(EntryBuilderService.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();
System.err.println("indexing " + allentryids.size() + " entries...");
logger.info("indexing " + allentryids.size() + " entries...");
for (String id : allentryids) {
ecnt++;
Entry currentry = entryBuilderService.buildWithEverything(id);
indexer.add(currentry);
if ((ecnt % 1000) == 0)
logger.info(ecnt + " entries GOLD-indexed...");
}
indexer.addRemaing();
logger.info("comitting");
indexer.commit();
logger.info(ecnt + " entries GOLD-indexed in " + (System.currentTimeMillis() - start) / 1000 + " seconds...END");
}
Aggregations