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());
  }