Package net.sf.mzmine.parameters

Examples of net.sf.mzmine.parameters.ParameterSet


  public MZmineProcessingStep getValue() {
    if (value == null)
      return null;
    // First check that the module has all parameters set
    ParameterSet embeddedParameters = value.getParameterSet();
    if (embeddedParameters == null)
      return value;
    for (Parameter p : embeddedParameters.getParameters()) {
      if (p instanceof UserParameter) {
        UserParameter up = (UserParameter) p;
        Object upValue = up.getValue();
        if (upValue == null)
          return null;
View Full Code Here


  public ModuleComboParameter cloneParameter() {
    MZmineProcessingStep<ModuleType> newModules[] = new MZmineProcessingStep[modulesWithParams.length];
    MZmineProcessingStep<ModuleType> newValue = null;
    for (int i = 0; i < modulesWithParams.length; i++) {
      ModuleType module = modulesWithParams[i].getModule();
      ParameterSet params = modulesWithParams[i].getParameterSet();
      params = params.cloneParameter();
      newModules[i] = new MZmineProcessingStepImpl<ModuleType>(module,
          params);
      if (value == modulesWithParams[i])
        newValue = newModules[i];
    }
View Full Code Here

      DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance()
          .newDocumentBuilder();
      Document parsedBatchXML = docBuilder.parse(batchFile);
      BatchQueue newQueue = BatchQueue.loadFromXml(parsedBatchXML
          .getDocumentElement());
      ParameterSet parameters = new BatchModeParameters();
      parameters.getParameter(BatchModeParameters.batchQueue).setValue(
          newQueue);
      Task batchTask = new BatchTask(parameters);
      batchTask.run();
      if (batchTask.getStatus() == TaskStatus.FINISHED)
        return ExitCode.OK;
View Full Code Here

    for (int i = 0; i < items.getLength(); i++) {
      Element moduleElement = (Element) items.item(i);
      String name = moduleElement.getAttribute("name");
      for (int j = 0; j < modulesWithParams.length; j++) {
        if (modulesWithParams[j].getModule().getName().equals(name)) {
          ParameterSet moduleParameters = modulesWithParams[j]
              .getParameterSet();
          if (moduleParameters == null)
            continue;
          moduleParameters.loadValuesFromXML((Element) items.item(i));
        }
      }
    }
    String selectedAttr = xmlElement.getAttribute("selected");
    for (int j = 0; j < modulesWithParams.length; j++) {
View Full Code Here

      xmlElement.setAttribute("selected", value.toString());
    Document parentDocument = xmlElement.getOwnerDocument();
    for (MZmineProcessingStep item : modulesWithParams) {
      Element newElement = parentDocument.createElement("module");
      newElement.setAttribute("name", item.getModule().getName());
      ParameterSet moduleParameters = item.getParameterSet();
      if (moduleParameters != null)
        moduleParameters.saveValuesToXML(newElement);
      xmlElement.appendChild(newElement);
    }
  }
View Full Code Here

  public boolean checkValue(Collection<String> errorMessages) {
    if (value == null) {
      errorMessages.add(name + " is not set properly");
      return false;
    }
    ParameterSet moduleParameters = value.getParameterSet();
    return moduleParameters == null
        || moduleParameters.checkUserParameterValues(errorMessages);
  }
View Full Code Here

      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(
View Full Code Here

  }

  @Override
  public ParameterSet getModuleParameters(
      Class<? extends MZmineModule> moduleClass) {
    ParameterSet parameters = moduleParameters.get(moduleClass);
    if (parameters == null) {
      throw new IllegalArgumentException("Module " + moduleClass
          + " does not have any parameter set instance");
    }
    return parameters;
View Full Code Here

        if (nodes.getLength() != 1)
          continue;

        Element moduleElement = (Element) nodes.item(0);

        ParameterSet moduleParameters = getModuleParameters(module
            .getClass());
        moduleParameters.loadValuesFromXML(moduleElement);
      }

      logger.info("Loaded configuration from file " + file);
    } catch (Exception e) {
      throw new IOException(e);
View Full Code Here

        Element paramElement = configuration
            .createElement("parameters");
        moduleElement.appendChild(paramElement);

        ParameterSet moduleParameters = getModuleParameters(module
            .getClass());
        moduleParameters.saveValuesToXML(paramElement);

      }

      TransformerFactory transfac = TransformerFactory.newInstance();
      Transformer transformer = transfac.newTransformer();
View Full Code Here

TOP

Related Classes of net.sf.mzmine.parameters.ParameterSet

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.