Exemplo n.º 1
0
  private void doYourAnnotationsTest(
      FeatureData rankedList, FeatureList<AnnotationItem> annotations, Method method)
      throws IOException, SQLException, IllegalAccessException, ClassNotFoundException,
          InstantiationException, InvalidParameterException, InvalidIndexException {

    // db attributes
    FunctionalDbDescriptor filterInfo =
        new FunctionalDbDescriptor(
            "your_annotation", "Your annotations", "your_annotations", "Your annotations");

    // get term sizes
    Map<String, Integer> termSizes = getYourAnnotationsTermSizes();

    logger.info(filterInfo.getTitle() + "...\n");

    GeneSetAnalysis gsea;

    if (method == Method.Logistic) {
      gsea = new LogisticScan(rankedList, annotations, order);
    } else {
      gsea =
          new FatiScan(
              rankedList,
              annotations,
              numberOfPartitions,
              testMode,
              outputFormat,
              order,
              duplicatesMode);
    }

    // run
    try {

      gsea.setLogger(logger);

      // set term sizes
      gsea.setTermSizes(termSizes);

      gsea.run();

      // save results
      saveGeneSetAnalysisResults(gsea, filterInfo);

    } catch (EmptyAnnotationException ene) {
      result.addOutputItem(
          new Item(
              "annot_" + filterInfo.getName(),
              "No annotation was found for " + filterInfo.getTitle() + " ids",
              "Annotations for " + filterInfo.getTitle(),
              Item.TYPE.MESSAGE,
              Arrays.asList("WARNING"),
              new HashMap<String, String>(),
              "Annotation files"));
    } catch (Exception ene) {
      result.addOutputItem(
          new Item(
              "annot_" + filterInfo.getName(),
              "Unexpected error was found while running analysis for "
                  + filterInfo.getTitle()
                  + " ids",
              filterInfo.getTitle(),
              Item.TYPE.MESSAGE,
              Arrays.asList("ERROR"),
              new HashMap<String, String>(),
              "All results"));
      ene.printStackTrace();
    }

    logger.info("...end of " + filterInfo.getTitle());
  }
Exemplo n.º 2
0
  private void doTest(FeatureData rankedList, FunctionalFilter filter, Method method)
      throws SQLException, IllegalAccessException, ClassNotFoundException, InstantiationException {

    // db attributes
    FunctionalDbDescriptor filterInfo = new FunctionalDbDescriptor(filter);

    // get term sizes
    //		AnnotationDBManager adbm = new AnnotationDBManager(dbConnector);
    //		Map<String, Integer> termSizes = adbm.getAnnotationTermsSize(filterInfo.getPrefix());

    logger.info(filterInfo.getTitle() + "...\n");

    GeneSetAnalysis gsea;

    if (method == Method.Logistic) {
      gsea = new LogisticScan(rankedList, filter, species, order);
      ((LogisticScan) gsea).setWorkingDirectory(outdir);
    } else {
      gsea =
          new FatiScan(
              rankedList,
              filter,
              null,
              numberOfPartitions,
              testMode,
              outputFormat,
              order,
              duplicatesMode);
    }

    // run
    try {

      gsea.setLogger(logger);

      // set term sizes
      //			gsea.setTermSizes(termSizes);

      gsea.run();

      logger.print("saving results...");
      // save results
      saveGeneSetAnalysisResults(gsea, filterInfo);
      logger.println("OK");

    } catch (EmptyAnnotationException ene) {
      result.addOutputItem(
          new Item(
              "annot_" + filterInfo.getName(),
              "No annotation was found for " + filterInfo.getTitle() + " ids",
              "Annotations for " + filterInfo.getTitle(),
              Item.TYPE.MESSAGE,
              Arrays.asList("WARNING"),
              new HashMap<String, String>(),
              "Annotation files"));
    } catch (Exception ene) {
      ene.printStackTrace();
      result.addOutputItem(
          new Item(
              "annot_" + filterInfo.getName(),
              "Unexpected error was found while running analysis for "
                  + filterInfo.getTitle()
                  + " ids",
              filterInfo.getTitle(),
              Item.TYPE.MESSAGE,
              Arrays.asList("ERROR"),
              new HashMap<String, String>(),
              "All results"));
    }

    logger.info("...end of " + filterInfo.getTitle());
  }