Search in sources :

Example 1 with StatementExporter

use of org.nextprot.api.core.export.StatementExporter 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");
        }
    }
}
Also used : StatementDao(org.nextprot.api.core.dao.StatementDao) StatementExporter(org.nextprot.api.core.export.StatementExporter) MasterIdentifierService(org.nextprot.api.core.service.MasterIdentifierService)

Aggregations

StatementDao (org.nextprot.api.core.dao.StatementDao)1 StatementExporter (org.nextprot.api.core.export.StatementExporter)1 MasterIdentifierService (org.nextprot.api.core.service.MasterIdentifierService)1