Package net.sf.mzmine.modules

Examples of net.sf.mzmine.modules.MZmineProcessingModule


        // Processing module? Exclude the batch mode module.
        if (!module.getClass().equals(BatchModeModule.class)
            && module instanceof MZmineProcessingModule) {

          final MZmineProcessingModule step = (MZmineProcessingModule) module;

          // Correct category?
          if (step.getModuleCategory() == category) {

            // Add category item?
            if (!categoryItemAdded) {
              methodsCombo.addItem("--- " + category + " ---");
              categoryItemAdded = true;
View Full Code Here


      final Object selectedItem = methodsCombo.getSelectedItem();
      if (selectedItem instanceof MZmineModuleWrapper) {

        // Show method's set-up dialog.
        final MZmineModuleWrapper wrappedModule = (MZmineModuleWrapper) selectedItem;
        final MZmineProcessingModule selectedMethod = (MZmineProcessingModule) wrappedModule
            .getModule();
        final ParameterSet methodParams = MZmineCore.getConfiguration()
            .getModuleParameters(selectedMethod.getClass());

        if (methodParams.getParameters().length > 0) {
          ExitCode exitCode = methodParams.showSetupDialog();
          if (exitCode != ExitCode.OK)
            return;
View Full Code Here

    // Run next step of the batch
    MZmineProcessingStep currentStep = queue.get(stepNumber);

    logger.fine("running step: " + currentStep);
    MZmineProcessingModule method = (MZmineProcessingModule) currentStep
        .getModule();
    ParameterSet batchStepParameters = currentStep.getParameterSet();

    // Update dataFiles and peakLists in the batchStepParameters
    for (Parameter p : batchStepParameters.getParameters()) {
      if (p instanceof RawDataFilesParameter)
        ((RawDataFilesParameter) p).setValue(dataFiles);
      if (p instanceof PeakListsParameter)
        ((PeakListsParameter) p).setValue(peakLists);
      if (p instanceof RawDataFilesMultiChoiceParameter)
        ((RawDataFilesMultiChoiceParameter) p).setChoices(dataFiles);
    }

    // Check if the parameter settings are valid
    ArrayList<String> messages = new ArrayList<String>();
    boolean paramsCheck = batchStepParameters
        .checkAllParameterValues(messages);
    if (!paramsCheck) {
      setStatus(TaskStatus.ERROR);
      errorMessage = "Invalid parameter settings for module " + method
          + ": " + Arrays.toString(messages.toArray());
    }

    ArrayList<Task> currentStepTasks = new ArrayList<Task>();
    ExitCode exitCode = method.runModule(batchStepParameters,
        currentStepTasks);

    if (exitCode != ExitCode.OK) {
      setStatus(TaskStatus.ERROR);
      errorMessage = "Could not start batch step " + method.getName();
      return;
    }

    // If current step didn't produce any tasks, continue with next step
    if (currentStepTasks.isEmpty()) {
View Full Code Here

   */
  public void actionPerformed(ActionEvent e) {

    Object src = e.getSource();

    MZmineProcessingModule module = moduleMenuItems.get(src);
    if (module != null) {
      RawDataFile selectedFiles[] = MZmineCore.getDesktop()
          .getSelectedDataFiles();
      PeakList selectedPeakLists[] = MZmineCore.getDesktop()
          .getSelectedPeakLists();

      ParameterSet moduleParameters = MZmineCore.getConfiguration()
          .getModuleParameters(module.getClass());

      boolean allParametersOK = true;
      LinkedList<String> errorMessages = new LinkedList<String>();
      for (Parameter p : moduleParameters.getParameters()) {
        if (p instanceof RawDataFilesParameter) {
          RawDataFilesParameter rdp = (RawDataFilesParameter) p;
          rdp.setValue(selectedFiles);
          boolean checkOK = rdp.checkValue(errorMessages);
          if (!checkOK) {
            allParametersOK = false;
          }
        }
        if (p instanceof PeakListsParameter) {
          PeakListsParameter plp = (PeakListsParameter) p;
          plp.setValue(selectedPeakLists);
          boolean checkOK = plp.checkValue(errorMessages);
          if (!checkOK) {
            allParametersOK = false;
          }
        }
      }

      if (!allParametersOK) {
        StringBuilder message = new StringBuilder();
        for (String m : errorMessages) {
          message.append(m);
          message.append("\n");
        }
        MZmineCore.getDesktop().displayMessage(message.toString());
        return;
      }

      logger.finest("Setting parameters for module " + module.getName());
      ExitCode exitCode = moduleParameters.showSetupDialog();
      if (exitCode == ExitCode.OK) {
        ParameterSet parametersCopy = moduleParameters.cloneParameter();
        logger.finest("Starting module " + module.getName()
            + " with parameters " + parametersCopy);
        ArrayList<Task> tasks = new ArrayList<Task>();
        module.runModule(parametersCopy, tasks);
        MZmineCore.getTaskController().addTasks(
            tasks.toArray(new Task[0]));
      }
      return;
    }
View Full Code Here

TOP

Related Classes of net.sf.mzmine.modules.MZmineProcessingModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.