Exemplo n.º 1
0
  /** Gets all Genomic Data. */
  private ProfileDataSummary getGenomicData(
      String cancerStudyId,
      HashMap<String, GeneticProfile> defaultGeneticProfileSet,
      SampleList defaultSampleSet,
      String geneListStr,
      ArrayList<SampleList> sampleList,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException, DaoException {

    // parse geneList, written in the OncoPrintSpec language (except for changes by XSS clean)
    double zScore =
        ZScoreUtil.getZScore(
            new HashSet<String>(defaultGeneticProfileSet.keySet()),
            new ArrayList<GeneticProfile>(defaultGeneticProfileSet.values()),
            request);
    double rppaScore = ZScoreUtil.getRPPAScore(request);

    ParserOutput theOncoPrintSpecParserOutput =
        OncoPrintSpecificationDriver.callOncoPrintSpecParserDriver(
            geneListStr,
            new HashSet<String>(defaultGeneticProfileSet.keySet()),
            new ArrayList<GeneticProfile>(defaultGeneticProfileSet.values()),
            zScore,
            rppaScore);

    ArrayList<String> geneList = new ArrayList<String>();
    geneList.addAll(theOncoPrintSpecParserOutput.getTheOncoPrintSpecification().listOfGenes());

    ArrayList<ProfileData> profileDataList = new ArrayList<ProfileData>();
    Set<String> warningUnion = new HashSet<String>();

    for (GeneticProfile profile : defaultGeneticProfileSet.values()) {
      try {
        GetProfileData remoteCall =
            new GetProfileData(
                profile, geneList, StringUtils.join(defaultSampleSet.getSampleList(), " "));
        ProfileData pData = remoteCall.getProfileData();
        warningUnion.addAll(remoteCall.getWarnings());
        profileDataList.add(pData);
      } catch (IllegalArgumentException e) {
        e.getStackTrace();
      }
    }

    ProfileMerger merger = new ProfileMerger(profileDataList);
    ProfileData mergedProfile = merger.getMergedProfile();

    ProfileDataSummary dataSummary =
        new ProfileDataSummary(
            mergedProfile,
            theOncoPrintSpecParserOutput.getTheOncoPrintSpecification(),
            zScore,
            rppaScore);
    return dataSummary;
  }
Exemplo n.º 2
0
  void readValue(VRMLparser parser) throws IOException {
    // no [] around data (SFImage is a "single" field)
    StrTokenizer st = parser.istok;
    ParserOutput pout = parser.pout;

    values.clearData(); // clear default image
    changed = true;

    read1Value(parser); // width
    if (readerror) {
      pout.error(
          "[SFImage] [Error] width (int) expected on parsing SFImage " + Node.atCurrLine(st));
      return;
    }

    read1Value(parser); // height
    if (readerror) {
      pout.error(
          "[SFImage] [Error] height (int) expected on parsing SFImage " + Node.atCurrLine(st));
      return;
    }

    read1Value(parser); // no. of components
    if (readerror) {
      pout.error(
          "[SFImage] [Error] no. of components (int) expected on parsing SFImage "
              + Node.atCurrLine(st));
      return;
    }

    int[] vals = values.getData();
    // System.out.println ("SFImage. width: " + vals[0] + ", height: " + vals[1]);
    int numpixel = vals[0] * vals[1]; // read (width*height) pixels
    for (int i = 0; i < numpixel; i++) {
      read1Value(parser);
      if (readerror) {
        pout.error(
            "[SFImage] [Error] could not read pixel no. "
                + i
                + " of SFImage (total "
                + numpixel
                + ")"
                + Node.atCurrLine(st));
        return;
      }
    } // for
  } // readValue