예제 #1
0
    @Override
    public void onClick(final ClickEvent event) {
      updateUserMessage();
      updateOutputLocation();

      final String titleText = title.getText();

      if (titleText == null) {
        Window.alert("No title specified");
        title.setFocus(true);
        return;
      }

      if (!titleText.matches(TITLE_ALLOWED)) {
        Window.alert(
            "The search title "
                + titleText
                + " is invalid. Please use only letters, numbers, - + . _ ( ) [ ] { } = # and a space.");
        title.setFocus(true);
        return;
      }

      final String effectiveOutputPath = outputPathUserSpecified ? output.getText() : outputPath;
      final String user = users.getValue(users.getSelectedIndex());

      final List<ClientFileSearch> fileSearches = getFileSearches();
      if (fileSearches == null || fileSearches.isEmpty()) {
        Window.alert("No files added to the search");
        return;
      }

      if (effectiveOutputPath == null || "".equals(effectiveOutputPath)) {
        Window.alert("The output folder not specified");
        return;
      }

      if ("".equals(user) || user.equals(SELECT_USER_STRING)) {
        Window.alert("No user selected");
        users.setFocus(true);
        return;
      }

      // The user will likely create a broken output on Windows
      if (effectiveOutputPath.length()
              + "/scaffold/".length()
              + titleText.length()
              + ".sf3".length()
          > 220) {
        Window.alert("The output folder path is too long.");
        title.setFocus(true);
        return;
      }

      final ProgressDialogBox dialog = new ProgressDialogBox();
      dialog.setProgressMessage("Submitting search...");
      dialog.setRelativeSize(0.25, 0.25);
      dialog.setMinimumSize(200, 200);
      dialog.showModal();

      try {
        final List<ClientFileSearch> entries = files.getData();

        final ClientSpectrumQa clientSpectrumQa;
        if (spectrumQaSetupPanel != null) {
          clientSpectrumQa = spectrumQaSetupPanel.getParameters();
        } else {
          clientSpectrumQa = new ClientSpectrumQa();
        }
        final ClientSwiftSearchDefinition def =
            new ClientSwiftSearchDefinition(
                getTitleText(),
                userInfo.get(users.getValue(users.getSelectedIndex())),
                effectiveOutputPath,
                paramsEditor.getSelectedParamSet(),
                entries,
                clientSpectrumQa,
                reportSetupPanel == null
                    ? new ClientPeptideReport(false)
                    : reportSetupPanel.getParameters(),
                additionalSettingsPanel.isPublicMgfs(),
                additionalSettingsPanel.isPublicMzxmls(),
                additionalSettingsPanel.isPublicSearchFiles(),
                getSearchMetadata(),
                previousSearchRunId);
        def.setFromScratch(additionalSettingsPanel.isFromScratch());
        def.setLowPriority(additionalSettingsPanel.isLowPriority());
        if (additionalSettingsPanel.isMzIdentMl()) {
          def.getMetadata().put("mzIdentMl", "1");
        }
        if (!"".equals(additionalSettingsPanel.getComment())) {
          def.getMetadata().put("comment", additionalSettingsPanel.getComment());
        } else {
          def.getMetadata().remove("comment");
        }

        ServiceConnection.instance()
            .startSearch(
                def,
                new AsyncCallback<Void>() {
                  @Override
                  public void onFailure(final Throwable throwable) {
                    dialog.hide();
                    ErrorDialog.handleGlobalError(throwable);
                  }

                  @Override
                  public void onSuccess(final Void o) {
                    dialog.hide();
                    redirect("/report/");
                  }
                });
      } catch (Exception e) {
        dialog.hide();
        ErrorDialog.handleGlobalError(e);
      }
    }
예제 #2
0
  /** Check query string to see if the user wants to load previous search data into the forms. */
  private void loadPreviousSearch(final ClientLoadedSearch result) {
    if (result == null) {
      return;
    }
    final ClientSwiftSearchDefinition definition = result.getDefinition();
    displayMessage("Loaded previous search " + definition.getSearchTitle());

    if (result.getClientParamSetList() != null) {
      // We transfered a new parameter set list together with search definition
      // Update the parameter editor.
      paramsEditor.setParamSetList(result.getClientParamSetList());
    }

    paramsEditor.setSelectedParamSet(result.getDefinition().getParamSet());

    // Determine search type
    SearchType searchType = null;
    for (final ClientFileSearch clientFileSearch : definition.getInputFiles()) {
      final String fileNamefileNameWithoutExtension =
          FilePathWidget.getFileNameWithoutExtension(clientFileSearch.getPath());
      final SearchType newSearchType =
          SearchTypeList.getSearchTypeFromSetup(
              definition.getSearchTitle(),
              fileNamefileNameWithoutExtension,
              clientFileSearch.getExperiment(),
              clientFileSearch.getBiologicalSample());
      if (searchType == null) {
        searchType = newSearchType;
      } else {
        if (!searchType.equals(newSearchType)) {
          searchType = SearchType.Custom;
          break;
        }
      }
    }

    final String title = definition.getSearchTitle();
    setTitleText(title);
    if (spectrumQaSetupPanel != null) {
      spectrumQaSetupPanel.setParameters(definition.getSpectrumQa());
    }
    if (reportSetupPanel != null) {
      reportSetupPanel.setParameters(definition.getPeptideReport());
    }
    final List<ClientFileSearch> inputFiles = definition.getInputFiles();

    files.setFiles(inputFiles, searchType);

    selectUser(definition.getUser().getEmail());

    final String filePath = getOutputPathFromFileTable(inputFiles);
    // If the loaded path differs from what the file table would produce, it is user-specified
    // .. set the proper flags
    if (definition.getOutputFolder() == null || !definition.getOutputFolder().equals(filePath)) {
      outputPathUserSpecified = true;
    }
    outputPath = definition.getOutputFolder();
    output.setText(outputPath);
    updateOutputLocation();

    additionalSettingsPanel.setDefinition(definition);

    showPageContentsAfterLoad();
  }