Search in sources :

Example 16 with Gene

use of gov.nih.nci.ctd2.dashboard.model.Gene in project nci-ctd2-dashboard by CBIIT.

the class DashboardAdminMain method main.

@Transactional
public static void main(String[] args) {
    final CommandLineParser parser = new GnuParser();
    Options gnuOptions = new Options();
    gnuOptions.addOption("h", "help", false, "shows this help document and quits.").addOption("am", "animal-model-data", false, "imports animal model data.").addOption("cl", "cell-line-data", false, "imports cell line data.").addOption("cp", "compound-data", false, "imports compound data.").addOption("e", "eco-term", false, "import ECO terms.").addOption("g", "gene-data", false, "imports gene data.").addOption("p", "protein-data", false, "imports protein data.").addOption("r", "rank-subjects", false, "prioritize and rank the subjects according to the observation data.").addOption("sh", "shrna-data", false, "imports shrna data.").addOption("si", "sirna-data", false, "imports sirna data.").addOption("ts", "tissue-sample-data", false, "imports tissue sample data.").addOption("cv", "controlled-vocabulary", false, "imports the dashboard controlled vocabulary.").addOption("o", "observation-data", false, "imports dashboard observation data.").addOption("s", "sample-data", false, "imports sample data.").addOption("t", "taxonomy-data", false, "imports organism data.").addOption("i", "index", false, "creates lucene index.").addOption("x", "prepare-export", false, "prepare master export file.");
    // Here goes the parsing attempt
    try {
        CommandLine commandLine = parser.parse(gnuOptions, args);
        if (commandLine.getOptions().length == 0) {
            // Here goes help message about running admin
            throw new ParseException("Nothing to do!");
        }
        if (commandLine.hasOption("h")) {
            printHelpAndExit(gnuOptions, 0);
        }
        if (commandLine.hasOption("am")) {
            launchJob("animalModelImporterJob");
        }
        if (commandLine.hasOption("cl")) {
            launchJob("cellLineDataImporterJob");
        }
        if (commandLine.hasOption("cp")) {
            launchJob("compoundDataImporterJob");
        }
        if (commandLine.hasOption("g")) {
            launchJob("geneDataImporterJob");
        }
        if (commandLine.hasOption("p")) {
            launchJob("proteinDataImporterJob");
        }
        if (commandLine.hasOption("sh")) {
            launchJob("TRCshRNADataImporterJob");
        }
        if (commandLine.hasOption("si")) {
            launchJob("siRNADataImporterJob");
        }
        if (commandLine.hasOption("ts")) {
            launchJob("tissueSampleDataImporterJob");
        }
        if (commandLine.hasOption("cv")) {
            launchJob("controlledVocabularyImporterJob");
        }
        if (commandLine.hasOption("o")) {
            launchJob("observationDataImporterJob");
            String dataURL = (String) appContext.getBean("dataURL");
            APIDataBuilder b = (APIDataBuilder) appContext.getBean("apiDataBuilder");
            b.prepareData(dataURL);
        }
        if (commandLine.hasOption("x")) {
            String downloadFileLocation = (String) appContext.getBean("downloadFileLocation");
            Boolean zipExport = (Boolean) appContext.getBean("zipExport");
            ExportBuilder e = (ExportBuilder) appContext.getBean("exportBuilder");
            e.prepareData(downloadFileLocation, zipExport);
        }
        if (commandLine.hasOption("s")) {
            log.info("Running sample importer...");
            // This is just for demonstration purposes
            SampleImporter sampleImporter = (SampleImporter) appContext.getBean("sampleImporter");
            sampleImporter.run();
        }
        if (commandLine.hasOption("t")) {
            launchJob("taxonomyDataImporterJob");
        }
        if (commandLine.hasOption("e")) {
            launchJob("ecotermDataImporterJob");
        }
        if (commandLine.hasOption("r")) {
            SubjectScorer subjectScorer = (SubjectScorer) appContext.getBean("subjectScorer");
            subjectScorer.scoreAllRoles();
            OverallSummary overallSummary = (OverallSummary) appContext.getBean("overallSummary");
            overallSummary.summarize();
        }
        if (commandLine.hasOption("i")) {
            DashboardDao dashboardDao = (DashboardDao) appContext.getBean("dashboardDao");
            dashboardDao.cleanIndex((Integer) appContext.getBean("indexBatchSize"));
        }
        log.info("All done.");
        System.exit(0);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        printHelpAndExit(gnuOptions, -1);
    }
}
Also used : Options(org.apache.commons.cli.Options) GnuParser(org.apache.commons.cli.GnuParser) OverallSummary(gov.nih.nci.ctd2.dashboard.util.OverallSummary) CommandLine(org.apache.commons.cli.CommandLine) SampleImporter(gov.nih.nci.ctd2.dashboard.importer.internal.SampleImporter) APIDataBuilder(gov.nih.nci.ctd2.dashboard.util.APIDataBuilder) DashboardDao(gov.nih.nci.ctd2.dashboard.dao.DashboardDao) CommandLineParser(org.apache.commons.cli.CommandLineParser) ParseException(org.apache.commons.cli.ParseException) ExportBuilder(gov.nih.nci.ctd2.dashboard.util.ExportBuilder) SubjectScorer(gov.nih.nci.ctd2.dashboard.util.SubjectScorer) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Gene (gov.nih.nci.ctd2.dashboard.model.Gene)9 Transactional (org.springframework.transaction.annotation.Transactional)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 JSONSerializer (flexjson.JSONSerializer)5 HttpHeaders (org.springframework.http.HttpHeaders)5 ResponseEntity (org.springframework.http.ResponseEntity)5 ArrayList (java.util.ArrayList)4 Protein (gov.nih.nci.ctd2.dashboard.model.Protein)3 Transcript (gov.nih.nci.ctd2.dashboard.model.Transcript)3 Xref (gov.nih.nci.ctd2.dashboard.model.Xref)3 CNKB (gov.nih.nci.ctd2.dashboard.util.cnkb.CNKB)3 InteractionDetail (gov.nih.nci.ctd2.dashboard.util.cnkb.InteractionDetail)3 UnAuthenticatedException (gov.nih.nci.ctd2.dashboard.util.cnkb.UnAuthenticatedException)3 IOException (java.io.IOException)3 ConnectException (java.net.ConnectException)3 SocketTimeoutException (java.net.SocketTimeoutException)3 JSONDeserializer (flexjson.JSONDeserializer)2 DashboardDao (gov.nih.nci.ctd2.dashboard.dao.DashboardDao)2 Organism (gov.nih.nci.ctd2.dashboard.model.Organism)2 Subject (gov.nih.nci.ctd2.dashboard.model.Subject)2