Ejemplo 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;
  }
 private String getShortcutScript(HashMap<String, String> usedButtonShortCuts) {
   StringBuffer shortcuts = new StringBuffer();
   shortcuts.append(" function buttonListShorcuts() {\n");
   Iterator<String> ik = usedButtonShortCuts.keySet().iterator();
   Iterator<String> iv = usedButtonShortCuts.values().iterator();
   while (ik.hasNext() && iv.hasNext()) {
     shortcuts
         .append("  keyArray[keyArray.length] = new keyArrayItem(\"")
         .append(ik.next())
         .append("\", \"")
         .append(iv.next())
         .append("\", null, \"altKey\", false, \"onkeydown\");\n");
   }
   shortcuts.append(" return true;\n}");
   return shortcuts.toString();
 }
  public LDAPolicy(String[] serverAddresses) {
    super(serverAddresses);
    numberOfServers = serverAddresses.length;
    serverRequests = new int[numberOfServers];

    // System.out.println("Loading input data from "+localPath);

    servletNameToClusterIds =
        (HashMap<String, Integer>)
            DataReader.loadSerializedObject(localPath + "servletNameToClusterId.serialized");
    methodHashCodesToClusterIds =
        (HashMap<Integer, Integer>)
            DataReader.loadSerializedObject(localPath + "hashCodesToClusterIds.serialized");

    if (servletNameToClusterIds != null && methodHashCodesToClusterIds != null) {
      for (String s : servletNameToClusterIds.keySet()) {
        // System.out.println("Servlet["+s+"] in
        // cluster["+methodHashCodesToClusterIds.get(s.hashCode())+"]");
      }
    } else {
      throw new Error(
          "Could not load properly the load balancing input data. Terminating application");
    }
  }