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);
 }
示例#2
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");
  }
  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");
  }
 private void handleShowFirstExon(Tuple request) {
   SearchService searchService = ServiceLocator.instance().getSearchService();
   ExonDTO exonDTO = searchService.findFirstExon();
   request.set("exon_id", exonDTO.getId());
   this.handleShowExon(request);
 }
  /**
   * Get the gDNA position.
   *
   * @param position
   * @param exon
   * @return gDNA position
   * @throws RESyntaxException
   */
  public static int getGDNAPosition(String position, ExonDTO exonDTO) {
    Pattern reExon = Pattern.compile("^(\\d+)$");
    Pattern reIntron = Pattern.compile("^(\\d+)([+-])(\\d+)$");
    Matcher mExon = reExon.matcher(position);
    Matcher mIntron = reIntron.matcher(position);

    if (mExon.matches()) {
      if ("R".equals(exonDTO.getOrientation())) {
        // exon.gDNA - (mutation.cDNA - exon.cDNA)
        return Math.abs(
            exonDTO.getGdnaStart() - (Integer.valueOf(mExon.group(1)) - exonDTO.getCdnaStart()));
      } else {
        // exon.gDNA + (mutation.cDNA - exon.cDNA)
        return Math.abs(
            exonDTO.getGdnaStart() + (Integer.valueOf(mExon.group(1)) - exonDTO.getCdnaStart()));
      }
    } else if (mIntron.matches()) {
      if (mIntron.group(2).equals("+")) {
        if ("R".equals(exonDTO.getOrientation())) {
          // intron.gdnaPos + 1 (back to exon) - difference ('+' means
          // downstream)
          return Math.abs(exonDTO.getGdnaStart() + 1 - Integer.valueOf(mIntron.group(3)));
        } else {
          // intron.gdnaPos - 1 (start at last position of exon) +
          // difference ('+' means upstream)
          return Math.abs(exonDTO.getGdnaStart() - 1 + Integer.valueOf(mIntron.group(3)));
        }
      } else {
        if ("R".equals(exonDTO.getOrientation())) {
          // intron.gdnaPos - intron.length + difference ('-' means
          // upstream)
          return Math.abs(
              exonDTO.getGdnaStart() - exonDTO.getLength() + Integer.valueOf(mIntron.group(3)));
        } else {
          // intron.gdnaPos - difference ('-' means downstream)
          return Math.abs(exonDTO.getGdnaStart() - Integer.valueOf(mIntron.group(3)));
        }
      }
    } else return 0;
  }