Beispiel #1
0
  protected void populateSearch(String[] input, ExampleSearch exampleSearch) {
    ArrayDesignSearch search = (ArrayDesignSearch) exampleSearch;
    ArrayDesign example = new ArrayDesign();
    if (headerIndexMap.get(API) < input.length && !input[headerIndexMap.get(API)].equals("")) {
      search.setApi(input[headerIndexMap.get(API)].trim());
    }

    if (headerIndexMap.get(NAME) < input.length && !input[headerIndexMap.get(NAME)].equals(""))
      example.setName(input[headerIndexMap.get(NAME)].trim());
    if (headerIndexMap.get(LSID) < input.length && !input[headerIndexMap.get(LSID)].equals(""))
      example.setLsid(input[headerIndexMap.get(LSID)].trim());

    if (headerIndexMap.get(PROVIDER) < input.length
        && !input[headerIndexMap.get(PROVIDER)].equals("")) {
      /*ArrayProvider provider = new ArrayProvider();
      provider.setName(input[headerIndexMap.get(PROVIDER)]);
      example.setArrayProvider(provider);*/
      ArrayProvider provider = null;
      try {
        provider = apiFacade.getArrayProvider(search.getApi(), input[headerIndexMap.get(PROVIDER)]);
      } catch (Exception e) {
        log.error("Error retrieving ArrayProvider for ArrayDesign search", e);
        provider = new ArrayProvider();
        provider.setName(input[headerIndexMap.get(PROVIDER)]);
      }

      if (provider != null) {
        example.setArrayProvider(provider);
      }
    }
    if (headerIndexMap.get(ASSAY_TYPE) < input.length
        && !input[headerIndexMap.get(ASSAY_TYPE)].equals("")) {
      example.getAssayTypes().add(new AssayType(input[headerIndexMap.get(ASSAY_TYPE)]));
    }
    if (headerIndexMap.get(NULL) < input.length && !input[headerIndexMap.get(NULL)].equals("")) {
      example = null;
    }
    search.setArrayDesign(example);
    if (headerIndexMap.get(TEST_CASE) < input.length
        && !input[headerIndexMap.get(TEST_CASE)].equals(""))
      search.setTestCase(Float.parseFloat(input[headerIndexMap.get(TEST_CASE)].trim()));
    if (headerIndexMap.get(EXPECTED_RESULTS) < input.length
        && !input[headerIndexMap.get(EXPECTED_RESULTS)].equals(""))
      search.setExpectedResults(
          Integer.parseInt(input[headerIndexMap.get(EXPECTED_RESULTS)].trim()));
    if (headerIndexMap.get(MIN_RESULTS) < input.length
        && !input[headerIndexMap.get(MIN_RESULTS)].equals(""))
      search.setMinResults(Integer.parseInt(input[headerIndexMap.get(MIN_RESULTS)].trim()));
    if (headerIndexMap.get(EXPECTED_PROVIDER) < input.length
        && !input[headerIndexMap.get(EXPECTED_PROVIDER)].equals(""))
      search.setExpectedProvider(input[headerIndexMap.get(EXPECTED_PROVIDER)].trim());
    if (headerIndexMap.get(EXPECTED_ORGANISM) < input.length
        && !input[headerIndexMap.get(EXPECTED_ORGANISM)].equals(""))
      search.setExpectedOrganism(input[headerIndexMap.get(EXPECTED_ORGANISM)]);
  }
 protected Platform getPlatform(Hybridization hybridization) throws DataRetrievalException {
   ArrayDesign arrayDesign = hybridization.getArrayDesign();
   if (arrayDesign == null) {
     throw new DataRetrievalException(
         "There is no array design associated with the array for the hybridization "
             + hybridization.getName()
             + ", unable to load array data");
   }
   Platform platform = getDao().getPlatform(arrayDesign.getName());
   if (platform == null) {
     throw new DataRetrievalException(
         "The platform named " + arrayDesign.getName() + " hasn't been loaded into the system");
   }
   return platform;
 }
Beispiel #3
0
 @Override
 protected void evaluateResults(
     List<? extends AbstractCaArrayEntity> resultsList,
     ExampleSearch search,
     TestResult testResult) {
   ArrayDesignSearch adSearch = (ArrayDesignSearch) search;
   List<ArrayDesign> adResults = (List<ArrayDesign>) resultsList;
   if (adSearch.getExpectedResults() != null || adSearch.getMinResults() != null) {
     int namedResults = 0;
     for (ArrayDesign arrayDesign : adResults) {
       if (arrayDesign.getName() != null) namedResults++;
     }
     if (adSearch.getExpectedResults() != null && namedResults != adSearch.getExpectedResults()) {
       testResult.setPassed(false);
       String detail =
           "Failed with unexpected number of results, ArrayDesign:"
               + adSearch.getArrayDesign().getName()
               + "- expected number of results: "
               + adSearch.getExpectedResults()
               + ", actual number of results: "
               + namedResults;
       testResult.addDetail(detail);
     } else {
       String detail = "Found expected number of results: " + namedResults;
       testResult.addDetail(detail);
     }
     if (adSearch.getMinResults() != null && namedResults < adSearch.getMinResults()) {
       testResult.setPassed(false);
       String detail =
           "Failed with unexpected minimum number of results, ArrayDesign:"
               + adSearch.getArrayDesign().getName()
               + "- expected number of results: "
               + adSearch.getMinResults()
               + ", actual number of results: "
               + namedResults;
       testResult.addDetail(detail);
     }
   }
   if (adSearch.getExample() == null) {
     if (adSearch.getExceptionClass() != null) {
       if (!adSearch.getExceptionClass().equals(InvalidInputException.class.toString())
           && !adSearch.getExceptionClass().equals(InvalidInputFault.class.toString())) {
         testResult.setPassed(false);
         String detail = "Failed with unexpected exception class: " + adSearch.getExceptionClass();
         testResult.addDetail(detail);
       } else {
         testResult.addDetail("Found expected exception " + adSearch.getExceptionClass());
       }
     }
   }
   for (ArrayDesign arrayDesign : adResults) {
     if (adSearch.getExpectedProvider() != null) {
       if (arrayDesign.getArrayProvider() == null
           || !arrayDesign.getArrayProvider().getName().equals(adSearch.getExpectedProvider())) {
         testResult.setPassed(false);
         String detail =
             "Failed with unexpected array provider: "
                 + (arrayDesign.getArrayProvider() == null
                     ? "null"
                     : arrayDesign.getArrayProvider().getName())
                 + ", expected provider: "
                 + adSearch.getExpectedProvider();
         testResult.addDetail(detail);
       } else {
         String detail = "Found expected provider: " + adSearch.getExpectedProvider();
         testResult.addDetail(detail);
       }
     }
     if (adSearch.getExpectedOrganism() != null) {
       if (arrayDesign.getOrganism() == null
           || !arrayDesign
               .getOrganism()
               .getCommonName()
               .equalsIgnoreCase(adSearch.getExpectedOrganism())) {
         testResult.setPassed(false);
         String detail =
             "Failed with unexpected organism common name: "
                 + (arrayDesign.getOrganism() == null
                     ? "null"
                     : arrayDesign.getOrganism().getCommonName())
                 + ", expected name: "
                 + adSearch.getExpectedOrganism();
         testResult.addDetail(detail);
       } else {
         String detail = "Found expected organism: " + adSearch.getExpectedOrganism();
         testResult.addDetail(detail);
       }
     }
   }
 }