コード例 #1
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
 private void connectOutputLocationAndFileTable() {
   if (files != null) {
     files.addValueChangeHandler(
         new ValueChangeHandler<Void>() {
           @Override
           public void onValueChange(final ValueChangeEvent<Void> event) {
             updateOutputLocation();
           }
         });
   }
 }
コード例 #2
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
 private void connectTitleAndFileTable() {
   if (files != null) {
     files.addValueChangeHandler(
         new ValueChangeHandler<Void>() {
           @Override
           public void onValueChange(final ValueChangeEvent<Void> event) {
             updateTitleFromFileTable();
           }
         });
   }
 }
コード例 #3
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
  private void updateTitleFromFileTable() {
    // User edited the title field. We have no business here
    if (userEditedTitle) {
      return;
    }
    List<String> names = files.getFileNames();
    if (names.size() == 0) {
      setTitleText("");
    } else {
      Iterator<String> iterator = names.iterator();
      String longestPrefix = iterator.next();
      while (iterator.hasNext()) {
        String next = iterator.next();
        for (int i = 0; i < Math.min(longestPrefix.length(), next.length()); i++) {
          if (next.charAt(i) != longestPrefix.charAt(i)) {
            longestPrefix = longestPrefix.substring(0, i);
            break;
          }
        }
      }
      // The users like to name files with underscores separating different fields.
      // If we detect more than 1 underscore, we will try to remove everything beyond the last
      // underscore
      // That takes care of test_S1, test_S2, test_S3 or test_Inj1, test_Inj2 type of repeats,
      // resulting
      // with just "test".

      // If there is just one underscore, we remove it if it is the last one.
      int numUnderscores = longestPrefix.length() - longestPrefix.replaceAll("_", "").length();
      if (numUnderscores <= 1) {
        longestPrefix = longestPrefix.replaceAll("_$", "");
      } else {
        longestPrefix = longestPrefix.replaceAll("_[^_]*$", "");
      }
      setTitleText(longestPrefix + paramsEditor.getTitleSuffix());
    }
    updateOutputLocation();
  }
コード例 #4
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
 private List<ClientFileSearch> getFileSearches() {
   return files != null ? files.getData() : null;
 }
コード例 #5
0
ファイル: SwiftApp.java プロジェクト: romanzenka/swift
  /** 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();
  }