예제 #1
0
  private void handleFindMutationsByTerm(Tuple request) {
    //		if (StringUtils.isNotEmpty(request.getString("term")) && request.getString("term").length()
    // < 3)
    //		throw new SearchException("Search term is too general. Please use a more specific one.");

    if (StringUtils.isNotEmpty(request.getString("result")))
      this.getModel().setResult(request.getString("result"));
    else this.getModel().setResult("mutations"); // Default: Show mutations

    this.getModel().setMutationSummaryVOHash(new HashMap<String, String>());
    this.getModel().setPatientSummaryVOHash(new HashMap<String, String>());

    SearchService searchService = ServiceLocator.instance().getSearchService();

    if (this.getModel().getResult().equals("patients")) {
      HashMap<String, List<PatientSummaryDTO>> result =
          searchService.findPatientsByTerm(request.getString("term"));

      int numPatients = 0;

      for (String key : result.keySet()) {
        if (CollectionUtils.isNotEmpty(result.get(key))) {
          ((HttpServletRequestTuple) request)
              .getRequest()
              .setAttribute("patientSummaryVOs", result.get(key));
          this.getModel()
              .getPatientSummaryVOHash()
              .put(" " + key + " ", this.include(request, this.getModel().getPatientPager()));
          numPatients += result.get(key).size();
        }
      }

      this.getModel().setHeader(numPatients + " patients found.");
    } else if (this.getModel().getResult().equals("mutations")) {
      HashMap<String, List<MutationSummaryDTO>> result =
          searchService.findMutationsByTerm(request.getString("term"));

      int numMutations = 0;

      for (String key : result.keySet()) {
        if (CollectionUtils.isNotEmpty(result.get(key))) {
          ((HttpServletRequestTuple) request)
              .getRequest()
              .setAttribute("mutationSummaryDTOList", result.get(key));
          this.getModel()
              .getMutationSummaryVOHash()
              .put(" " + key + " ", this.include(request, this.getModel().getMutationPager()));
          numMutations += result.get(key).size();
        }
      }

      this.getModel().setHeader(numMutations + " mutations found.");
    }

    this.setView(new FreemarkerView("freetext.ftl", this.getModel()));
  }
예제 #2
0
  private void handleShowProteinDomain(Tuple request) throws Exception {
    if (StringUtils.isNotEmpty(request.getString("domain_id")))
      this.getModel().getMutationSearchCriteriaVO().setProteinDomainId(request.getInt("domain_id"));
    if (StringUtils.isNotEmpty(request.getString("snpbool")))
      if (request.getString("snpbool").equals("hide"))
        this.getModel().getMutationSearchCriteriaVO().setReportedAsSNP(false);

    SearchService searchService = ServiceLocator.instance().getSearchService();

    this.getModel()
        .setProteinDomainDTO(searchService.findProteinDomain(request.getInt("domain_id"), false));
    this.getModel()
        .setMutationSummaryDTOList(
            searchService.findMutationsByDomainId(request.getInt("domain_id")));
    ((HttpServletRequestTuple) request)
        .getRequest()
        .setAttribute("mutationSummaryVOList", this.getModel().getMutationSummaryDTOList());
    this.getModel().setRawOutput(this.include(request, this.getModel().getMutationPager()));

    this.getModel().setHeader((this.getModel().getProteinDomainDTO() == null) ? "Unknown id." : "");

    this.getModel().getMbrowse().setProteinDomainDTO(this.getModel().getProteinDomainDTO());

    if (this.getModel().getMbrowse().getExonDTOList() == null)
      this.getModel().getMbrowse().setExonDTOList(searchService.findAllExons());

    this.setView(new FreemarkerView("proteindomain.ftl", getModel()));
  }
예제 #3
0
  public void show(Database db, Tuple request) {
    try {
      PublicationService publicationService = ServiceLocator.instance().getPublicationService();
      this.getModel().setPublicationDTOList(publicationService.getAll());
      ((HttpServletRequestTuple) request)
          .getRequest()
          .setAttribute("publicationDTOList", this.getModel().getPublicationDTOList());
      this.getModel().setRawOutput(this.include(request, this.getModel().getPublicationPager()));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #4
0
  private void handleFindMutations(Tuple request) {
    this.getModel().setMutationSearchCriteriaVO(new MutationSearchCriteriaDTO());
    if (StringUtils.isNotEmpty(request.getString("variation")))
      this.getModel().getMutationSearchCriteriaVO().setVariation(request.getString("variation"));
    if (StringUtils.isNotEmpty(request.getString("consequence")))
      this.getModel()
          .getMutationSearchCriteriaVO()
          .setConsequence(request.getString("consequence"));
    if (StringUtils.isNotEmpty(request.getString("mutation_id")))
      this.getModel().getMutationSearchCriteriaVO().setMutationId(request.getInt("mutation_id"));
    if (StringUtils.isNotEmpty(request.getString("mid")))
      this.getModel().getMutationSearchCriteriaVO().setMid(request.getString("mid"));
    if (StringUtils.isNotEmpty(request.getString("nuclno")))
      this.getModel().getMutationSearchCriteriaVO().setCdnaPosition(request.getInt("nuclno"));
    if (StringUtils.isNotEmpty(request.getString("aano")))
      this.getModel().getMutationSearchCriteriaVO().setCodonChangeNumber(request.getInt("aano"));
    if (StringUtils.isNotEmpty(request.getString("exon_id")))
      this.getModel().getMutationSearchCriteriaVO().setExonId(request.getInt("exon_id"));
    if (StringUtils.isNotEmpty(request.getString("exon")))
      this.getModel().getMutationSearchCriteriaVO().setExonName(request.getString("exon"));
    if (StringUtils.isNotEmpty(request.getString("type")))
      this.getModel().getMutationSearchCriteriaVO().setType(request.getString("type"));
    if (StringUtils.isNotEmpty(request.getString("domain_id")))
      this.getModel().getMutationSearchCriteriaVO().setProteinDomainId(request.getInt("domain_id"));
    if (StringUtils.isNotEmpty(request.getString("phenotype")))
      this.getModel()
          .getMutationSearchCriteriaVO()
          .setPhenotypeName(request.getString("phenotype"));
    if (StringUtils.isNotEmpty(request.getString("inheritance")))
      this.getModel()
          .getMutationSearchCriteriaVO()
          .setInheritance(request.getString("inheritance"));
    if (StringUtils.isNotEmpty(request.getString("snpbool")))
      if (request.getString("snpbool").equals("hide"))
        this.getModel().getMutationSearchCriteriaVO().setReportedAsSNP(false);

    SearchService searchService = ServiceLocator.instance().getSearchService();

    this.getModel()
        .setMutationSummaryDTOList(
            searchService.findMutations(this.getModel().getMutationSearchCriteriaVO()));
    ((HttpServletRequestTuple) request)
        .getRequest()
        .setAttribute("mutationSummaryDTOList", this.getModel().getMutationSummaryDTOList());
    this.getModel().setRawOutput(this.include(request, this.getModel().getMutationPager()));

    this.getModel().setHeader(this.getModel().getMutationSummaryDTOList().size() + " results.");

    this.setView(new FreemarkerView("included.ftl", this.getModel()));
  }
예제 #5
0
  private void listAllMutations(Tuple request) {
    SearchService searchService = ServiceLocator.instance().getSearchService();

    this.getModel().setMutationSummaryDTOList(searchService.findAllMutationSummaries());
    ((HttpServletRequestTuple) request)
        .getRequest()
        .setAttribute("mutationSummaryDTOList", this.getModel().getMutationSummaryDTOList());
    this.getModel().setRawOutput(this.include(request, this.getModel().getMutationPager()));

    this.getModel()
        .setHeader(
            this.getModel().getMutationSummaryDTOList().size()
                + " results for \"Display all mutations\".");
    this.setView(new FreemarkerView("included.ftl", getModel()));
  }
예제 #6
0
  private void handleFindPatients(Tuple request) {
    if (StringUtils.isNotEmpty(request.getString("mid"))) {
      String mutationIdentifier = request.getString("mid");

      SearchService searchService = ServiceLocator.instance().getSearchService();

      List<PatientSummaryDTO> patientSummaryVOList =
          searchService.findPatientsByMutationIdentifier(mutationIdentifier);

      ((HttpServletRequestTuple) request)
          .getRequest()
          .setAttribute("patientSummaryVOs", patientSummaryVOList);
      this.getModel().setRawOutput(this.include(request, this.getModel().getPatientPager()));
      this.getModel().setHeader(patientSummaryVOList.size() + " results for " + mutationIdentifier);

      this.setView(new FreemarkerView("included.ftl", this.getModel()));
    }
  }
예제 #7
0
  private void listAllPatients(Tuple request) {
    //		MolgenisUser user = new MolgenisUser();
    //		user.setId(this.getLogin().getUserId());
    //		this.getModel().setPatientSummaryVOs(this.patientService.find(user));
    SearchService searchService = ServiceLocator.instance().getSearchService();

    List<PatientSummaryDTO> patientSummaryVOs = searchService.findAllPatientSummaries();
    this.getModel().setPatientSummaryVOs(patientSummaryVOs);
    ((HttpServletRequestTuple) request)
        .getRequest()
        .setAttribute("patientSummaryVOs", this.getModel().getPatientSummaryVOs());
    this.getModel().setRawOutput(this.include(request, this.getModel().getPatientPager()));
    this.getModel()
        .setHeader(
            this.getModel().getPatientSummaryVOs().size()
                + " results for \"Display all patients\".");

    this.setView(new FreemarkerView("included.ftl", this.getModel()));
  }
예제 #8
0
  private void handleShowExon(Tuple request) {
    SearchService searchService = ServiceLocator.instance().getSearchService();

    Integer exonId = request.getInt("exon_id");

    this.getModel().setExonDTO(searchService.findExonById(exonId));

    if (this.getModel().getQueryParametersVO().getShowMutations()) {
      this.getModel().setMutationSummaryDTOList(searchService.findMutationsByExonId(exonId));
      ((HttpServletRequestTuple) request)
          .getRequest()
          .setAttribute("mutationSummaryDTOList", this.getModel().getMutationSummaryDTOList());
      this.getModel().setRawOutput(this.include(request, this.getModel().getMutationPager()));
    }
    this.getModel().setHeader("");

    this.getModel().getMbrowse().setExonDTO(this.getModel().getExonDTO());
    this.getModel()
        .getMbrowse()
        .setMutationSummaryDTOList(this.getModel().getMutationSummaryDTOList());

    this.setView(new FreemarkerView("exon.ftl", getModel()));
  }