示例#1
0
  @SuppressWarnings("unchecked")
  @Override
  protected void populateExpertSearchForm() {
    PhenoService phenoService = ServiceLocator.instance().getPhenoService();
    SearchService searchService = ServiceLocator.instance().getSearchService();

    Container expertSearchForm = this.getModel().getExpertSearchFormWrapper().getForm();

    ((HiddenInput) expertSearchForm.get("__target")).setValue(this.getName());
    ((HiddenInput) expertSearchForm.get("select")).setValue(this.getName());

    if (this.getModel().getMutationSearchCriteriaVO().getVariation() != null)
      ((TextLineInput<String>) expertSearchForm.get("variation"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getVariation());

    if (this.getModel().getMutationSearchCriteriaVO().getCdnaPosition() != null)
      ((IntInput) expertSearchForm.get("nuclno"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getCdnaPosition());

    if (this.getModel().getMutationSearchCriteriaVO().getCodonNumber() != null)
      ((IntInput) expertSearchForm.get("aano"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getCodonNumber());

    List<ValueLabel> exonIdOptions = new ArrayList<ValueLabel>();
    exonIdOptions.add(new ValueLabel("", "Select"));
    for (ExonDTO exonSummaryVO : searchService.findAllExons())
      exonIdOptions.add(new ValueLabel(exonSummaryVO.getId(), exonSummaryVO.getName()));
    ((SelectInput) expertSearchForm.get("exon_id")).setOptions(exonIdOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getExonId() != null)
      ((SelectInput) expertSearchForm.get("exon_id"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getExonId());
    else ((SelectInput) expertSearchForm.get("exon_id")).setValue("Select");

    List<ValueLabel> typeOptions = new ArrayList<ValueLabel>();
    typeOptions.add(0, new ValueLabel("", "Select"));
    for (String mutationType : phenoService.findObservedValues("Type of mutation"))
      typeOptions.add(new ValueLabel(mutationType, mutationType));
    ((SelectInput) expertSearchForm.get("type")).setOptions(typeOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getType() != null)
      ((SelectInput) expertSearchForm.get("type"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getType());
    else ((SelectInput) expertSearchForm.get("type")).setValue("Select");

    List<ValueLabel> phenotypeOptions = new ArrayList<ValueLabel>();
    phenotypeOptions.add(new ValueLabel("", "Select"));
    for (String phenotypeName : phenoService.findObservedValues("Onset"))
      phenotypeOptions.add(new ValueLabel(phenotypeName, phenotypeName));
    ((SelectInput) expertSearchForm.get("phenotype")).setOptions(phenotypeOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getPhenotypeId() != null)
      ((SelectInput) expertSearchForm.get("phenotype"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getPhenotypeId());
    else ((SelectInput) expertSearchForm.get("phenotype")).setValue("Select");
  }
  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()));
  }
 private void handleShowPrevExon(Tuple request) {
   SearchService searchService = ServiceLocator.instance().getSearchService();
   ExonDTO exonDTO = searchService.findPrevExon(request.getInt("exon_id"));
   request.set("__action", "showExon");
   request.set("exon_id", exonDTO.getId());
   this.handleShowExon(request);
 }
 private void handleShowNextMutation(Tuple request) {
   SearchService searchService = ServiceLocator.instance().getSearchService();
   MutationSummaryDTO mutationSummaryDTO =
       searchService.findNextMutation(request.getString("mid"));
   request.set("mid", mutationSummaryDTO.getIdentifier());
   this.handleShowMutation(request);
 }
  private void handleShowPhenotypeDetails(Tuple request) throws Exception {
    if (StringUtils.isNotEmpty(request.getString("pid"))) {
      String patientIdentifier = request.getString("pid");

      PhenoService phenoService = ServiceLocator.instance().getPhenoService();
      SearchService searchService = ServiceLocator.instance().getSearchService();

      PatientSummaryDTO patientSummaryVO =
          searchService.findPatientByPatientIdentifier(patientIdentifier);

      this.getModel()
          .setIndividualDTO(phenoService.findPhenotypeDetails(patientSummaryVO.getPatientId()));

      this.getModel().setHeader("Phenotypic details for Patient " + patientIdentifier);

      this.setView(new FreemarkerView("phenotypedetails.ftl", getModel()));
    }
  }
  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()));
  }
  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();
    }
  }
  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()));
  }
  private void populateShowMutationForm() {
    SearchService searchService = ServiceLocator.instance().getSearchService();

    this.getModel().getShowMutationForm().get("__target").setValue(this.getName());
    this.getModel().getListAllMutationsForm().get("select").setValue(this.getName());
    List<ValueLabel> mutationIdOptions = new ArrayList<ValueLabel>();
    mutationIdOptions.add(new ValueLabel("", "Select mutation"));
    for (VariantDTO variantDTO : searchService.getAllVariants())
      mutationIdOptions.add(
          new ValueLabel(
              variantDTO.getIdentifier(),
              variantDTO.getCdnaNotation() + " (" + variantDTO.getAaNotation() + ")"));
    ((SelectInput) this.getModel().getShowMutationForm().get("mid")).setOptions(mutationIdOptions);
    ((SelectInput) this.getModel().getShowMutationForm().get("mid")).setValue("Select mutation");
  }
示例#10
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()));
  }
示例#11
0
  private void handleShowPatient(Tuple request) {
    if (StringUtils.isNotEmpty(request.getString("pid"))) {
      String patientIdentifier = request.getString("pid");

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

      PatientSummaryDTO patientSummaryVO =
          searchService.findPatientByPatientIdentifier(patientIdentifier);

      this.getModel().setPatientSummaryVO(patientSummaryVO);

      this.getModel().setHeader("Details for patient " + patientIdentifier);

      this.setView(new FreemarkerView(this.getModel().getPatientViewer(), getModel()));
    }
  }
示例#12
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()));
    }
  }
示例#13
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()));
  }
示例#14
0
  private void handleShowMutation(Tuple request) {
    if (StringUtils.isNotEmpty(request.getString("mid"))) {
      String mutationIdentifier = request.getString("mid");

      //			if (StringUtils.isNotEmpty(request.getString("snpbool")))
      //				if (request.getString("snpbool").equals("hide"))
      //					this.getModel().getMutationSearchCriteriaVO().setReportedAsSNP(false);

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

      MutationSummaryDTO mutationSummaryDTO =
          searchService.findMutationByIdentifier(mutationIdentifier);

      this.getModel().setMutationSummaryVO(mutationSummaryDTO);

      this.getModel().setPositionMutations(searchService.findPositionMutations(mutationSummaryDTO));
      this.getModel().setCodonMutations(searchService.findCodonMutations(mutationSummaryDTO));

      this.getModel().setHeader("Details for mutation " + mutationIdentifier);

      this.setView(new FreemarkerView("mutation.ftl", getModel()));
    }
  }
示例#15
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()));
  }
示例#16
0
  @Override
  public Show handleRequest(Database db, Tuple request, OutputStream out) {
    ServiceLocator.instance()
        .getContext()
        .getAutowireCapableBeanFactory()
        .initializeBean(db, "org.molgenis.framework.db.Database");

    try {
      if (StringUtils.isEmpty(request.getAction())) this.getModel().setAction("init");
      else this.getModel().setAction(request.getAction());

      if ("1".equals(request.getString("expertSearch")))
        this.getModel().getQueryParametersVO().setExpertSearch(true);
      else this.getModel().getQueryParametersVO().setExpertSearch(false);

      if (this.getModel().getAction().equals("findMutationsByTerm")) {
        this.handleFindMutationsByTerm(request);
      } else if (this.getModel().getAction().equals("findMutations")) {
        this.handleFindMutations(request);
      } else if (this.getModel().getAction().equals("findPatients")) {
        this.handleFindPatients(request);
      } else if (this.getModel().getAction().equals("listAllMutations")) {
        this.listAllMutations(request);
      } else if (this.getModel().getAction().equals("listAllPatients")) {
        this.listAllPatients(request);
      } else if (this.getModel().getAction().equals("showProteinDomain")) {
        this.handleShowProteinDomain(request);
      } else if (this.getModel().getAction().equals("showExon")) {
        this.handleShowExon(request);
      } else if (this.getModel().getAction().equals("showFirstExon")) {
        this.handleShowFirstExon(request);
      } else if (this.getModel().getAction().equals("showPrevExon")) {
        this.handleShowPrevExon(request);
      } else if (this.getModel().getAction().equals("showNextExon")) {
        this.handleShowNextExon(request);
      } else if (this.getModel().getAction().equals("showLastExon")) {
        this.handleShowLastExon(request);
      } else if (this.getModel().getAction().equals("showMutation")) {
        this.handleShowMutation(request);
      } else if (this.getModel().getAction().equals("showFirstMutation")) {
        this.handleShowFirstMutation(request);
      } else if (this.getModel().getAction().equals("showPrevMutation")) {
        this.handleShowPrevMutation(request);
      } else if (this.getModel().getAction().equals("showNextMutation")) {
        this.handleShowNextMutation(request);
      } else if (this.getModel().getAction().equals("showLastMutation")) {
        this.handleShowLastMutation(request);
      } else if (this.getModel().getAction().equals("showPatient")) {
        this.handleShowPatient(request);
      } else if (this.getModel().getAction().equals("showPhenotypeDetails")) {
        this.handleShowPhenotypeDetails(request);
      } else if (this.getModel().getAction().startsWith("mutationsFirstPage")) {
        this.getModel().getPager().first();
      } else if (this.getModel().getAction().startsWith("mutationsPrevPage")) {
        this.getModel().getPager().prev();
      } else if (this.getModel().getAction().startsWith("mutationsNextPage")) {
        this.getModel().getPager().next();
      } else if (this.getModel().getAction().startsWith("mutationsLastPage")) {
        this.getModel().getPager().last();
      } else {
        this.setView(new FreemarkerView("init.ftl", this.getModel()));
      }

      this.populateDisplayOptionsForm();

      //			for (ScreenController<?> child : this.getChildren())
      //			{
      //				child.handleRequest(db, request, out);
      //			}
    } catch (Exception e) {
      String message =
          "Oops, an error occurred. We apologize and will work on fixing it as soon as possible. <a href=\"molgenis.do?__target=SearchPlugin&__action=init&expertSearch=0\">Return to home page</a>";
      this.getModel().getMessages().add(new ScreenMessage(message, false));
      for (StackTraceElement el : e.getStackTrace()) logger.error(el.toString());
      //				this.getMessages().add(new ScreenMessage(el.toString(), false));
    }

    return Show.SHOW_MAIN;
  }
示例#17
0
  protected void populateExpertSearchForm() {
    PhenoService phenoService = ServiceLocator.instance().getPhenoService();
    SearchService searchService = ServiceLocator.instance().getSearchService();

    Container expertSearchForm = this.getModel().getExpertSearchFormWrapper().getForm();

    expertSearchForm.get("__target").setValue(this.getName());
    expertSearchForm.get("select").setValue(this.getName());

    if (this.getModel().getMutationSearchCriteriaVO().getVariation() != null)
      ((TextLineInput) expertSearchForm.get("variation"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getVariation());

    if (this.getModel().getMutationSearchCriteriaVO().getCdnaPosition() != null)
      ((IntInput) expertSearchForm.get("nuclno"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getCdnaPosition());

    if (this.getModel().getMutationSearchCriteriaVO().getCodonNumber() != null)
      ((IntInput) expertSearchForm.get("aano"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getCodonNumber());

    List<ValueLabel> exonIdOptions = new ArrayList<ValueLabel>();
    exonIdOptions.add(new ValueLabel("", "Select"));
    for (ExonDTO exonSummaryVO : searchService.findAllExons())
      exonIdOptions.add(new ValueLabel(exonSummaryVO.getId(), exonSummaryVO.getName()));
    ((SelectInput) expertSearchForm.get("exon_id")).setOptions(exonIdOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getExonId() != null)
      ((SelectInput) expertSearchForm.get("exon_id"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getExonId());
    else ((SelectInput) expertSearchForm.get("exon_id")).setValue("Select");

    List<ValueLabel> typeOptions = new ArrayList<ValueLabel>();
    typeOptions.add(0, new ValueLabel("", "Select"));
    for (String mutationType : phenoService.findObservedValues("Type of mutation"))
      typeOptions.add(new ValueLabel(mutationType, mutationType));
    ((SelectInput) expertSearchForm.get("type")).setOptions(typeOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getType() != null)
      ((SelectInput) expertSearchForm.get("type"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getType());
    else ((SelectInput) expertSearchForm.get("type")).setValue("Select");

    List<ValueLabel> consequenceOptions = new ArrayList<ValueLabel>();
    consequenceOptions.add(0, new ValueLabel("", "Select"));
    for (String consequence : phenoService.findObservedValues("consequence"))
      consequenceOptions.add(new ValueLabel(consequence, consequence));
    ((SelectInput) expertSearchForm.get("consequence")).setOptions(consequenceOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getConsequence() != null)
      ((SelectInput) expertSearchForm.get("consequence"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getConsequence());
    else ((SelectInput) expertSearchForm.get("consequence")).setValue("Select");

    List<ValueLabel> domainOptions = new ArrayList<ValueLabel>();
    domainOptions.add(new ValueLabel("", "Select"));
    for (ProteinDomainDTO domainVO : searchService.findAllProteinDomains())
      domainOptions.add(new ValueLabel(domainVO.getDomainId(), domainVO.getDomainName()));
    ((SelectInput) expertSearchForm.get("domain_id")).setOptions(domainOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getProteinDomainId() != null)
      ((SelectInput) expertSearchForm.get("domain_id"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getProteinDomainId());
    else ((SelectInput) expertSearchForm.get("domain_id")).setValue("Select");

    List<ValueLabel> phenotypeOptions = new ArrayList<ValueLabel>();
    phenotypeOptions.add(new ValueLabel("", "Select"));
    for (String phenotypeName : phenoService.findObservedValues("Phenotype"))
      phenotypeOptions.add(new ValueLabel(phenotypeName, phenotypeName));
    ((SelectInput) expertSearchForm.get("phenotype")).setOptions(phenotypeOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getPhenotypeId() != null)
      ((SelectInput) expertSearchForm.get("phenotype"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getPhenotypeId());
    else ((SelectInput) expertSearchForm.get("phenotype")).setValue("Select");

    List<ValueLabel> inheritanceOptions = new ArrayList<ValueLabel>();
    inheritanceOptions.add(0, new ValueLabel("", "Select"));
    for (String inheritance : phenoService.findObservedValues("Inheritance"))
      inheritanceOptions.add(new ValueLabel(inheritance, inheritance));
    ((SelectInput) expertSearchForm.get("inheritance")).setOptions(inheritanceOptions);
    if (this.getModel().getMutationSearchCriteriaVO().getInheritance() != null)
      ((SelectInput) expertSearchForm.get("inheritance"))
          .setValue(this.getModel().getMutationSearchCriteriaVO().getInheritance());
    else ((SelectInput) expertSearchForm.get("inheritance")).setValue("Select");
  }
示例#18
0
  @Override
  public void reload(Database db) {
    ServiceLocator.instance()
        .getContext()
        .getAutowireCapableBeanFactory()
        .initializeBean(db, "org.molgenis.framework.db.Database");
    try {
      SearchService searchService = ServiceLocator.instance().getSearchService();
      this.getModel().setGeneDTO(searchService.findGene());

      if (this.getModel().getMbrowse().getIsVisible()) {
        if (this.getModel().getMbrowse().getGeneDTO() == null)
          this.getModel().getMbrowse().setGeneDTO(this.getModel().getGeneDTO());

        if (this.getModel().getMbrowse().getProteinDomainDTOList() == null)
          this.getModel()
              .getMbrowse()
              .setProteinDomainDTOList(searchService.findAllProteinDomains());
      }

      CmsService cmsService = ServiceLocator.instance().getCmsService();

      this.getModel().setTextRemarks(cmsService.findContentByName("remarks"));
      this.getModel().setTextCollaborations(cmsService.findContentByName("collaborators"));

      if (this.getModel().getQueryParametersVO().getExpertSearch()) {
        this.populateExpertSearchForm();
        this.populateShowMutationForm();
        this.populateToSimpleSearchForm();
      } else {
        this.getModel().setTextWelcome(cmsService.findContentByName("welcome"));
        this.getModel().setTextSearch(cmsService.findContentByName("search"));

        StatisticsService statisticsService = ServiceLocator.instance().getStatisticsService();

        this.getModel().setNumMutations(statisticsService.getNumMutations());
        this.getModel().setNumPatients(statisticsService.getNumPatients());
        this.getModel().setNumUnpublished(statisticsService.getNumUnpublishedPatients());
        this.getModel()
            .setNumMutationsByPathogenicity(statisticsService.getNumMutationsByPathogenicity());
        this.getModel()
            .setNumPatientsByPathogenicity(statisticsService.getNumPatientsByPathogenicity());

        this.populateSimpleSearchForm();
        this.populateListAllMutationsForm();
        this.populateListAllPatientsForm();
        this.populateToExpertSearchForm();
      }
    } catch (Exception e) {
      String message =
          "Oops, an error occurred. We apologize and will work on fixing it as soon as possible. <a href=\"molgenis.do?__target=SearchPlugin&select=SearchPlugin&__action=init&expertSearch=0\">Return to home page</a>";
      this.getModel().getMessages().add(new ScreenMessage(message, false));
      for (StackTraceElement el : e.getStackTrace()) logger.error(el.toString());
    }

    for (ScreenController<?> child : this.getChildren())
      try {
        child.reload(db);
      } catch (Exception e) {
        e.printStackTrace();
      }
  }
示例#19
0
 private void handleShowFirstExon(Tuple request) {
   SearchService searchService = ServiceLocator.instance().getSearchService();
   ExonDTO exonDTO = searchService.findFirstExon();
   request.set("exon_id", exonDTO.getId());
   this.handleShowExon(request);
 }