Package net.sf.mzmine.project

Examples of net.sf.mzmine.project.MZmineProject


      newRow.addPeak(dataFile, finishedPeak);
      newPeakList.addRow(newRow);
    }

    // Add new peaklist to the project
    MZmineProject currentProject = MZmineCore.getCurrentProject();
    currentProject.addPeakList(newPeakList);

    setStatus(TaskStatus.FINISHED);

    logger.info("Finished chromatogram builder on " + dataFile);
View Full Code Here


  }

  private void copyParameterValuesToRawDataFiles() {

    MZmineProject currentProject = MZmineCore.getCurrentProject();

    // Remove all previous parameters from project
    UserParameter[] parameters = currentProject.getParameters();
    for (UserParameter parameter : parameters) {
      currentProject.removeParameter(parameter);
    }

    // Add new parameters
    parameters = parameterValues.keySet().toArray(new UserParameter[0]);
    for (UserParameter parameter : parameters) {
      currentProject.addParameter(parameter);
    }

    // Set values for new parameters
    for (int columnIndex = 0; columnIndex < parameterValues.keySet().size(); columnIndex++) {
      UserParameter parameter = tablemodelParameterValues
          .getParameter(columnIndex + 1);

      for (int dataFileIndex = 0; dataFileIndex < dataFiles.length; dataFileIndex++) {
        RawDataFile file = dataFiles[dataFileIndex];

        Object value = tablemodelParameterValues.getValueAt(
            dataFileIndex, columnIndex + 1);
        if (parameter instanceof DoubleParameter) {
          Double doubleValue = null;
          if (value instanceof Double)
            doubleValue = (Double) value;
          if (value instanceof String)
            doubleValue = Double.parseDouble((String) value);
          currentProject.setParameterValue(parameter, file,
              doubleValue);
        }
        if (parameter instanceof StringParameter) {
          if (value == null)
            value = "";
          currentProject.setParameterValue(parameter, file,
              (String) value);
        }
        if (parameter instanceof ComboParameter) {
          if (value == null)
            value = "";
          currentProject.setParameterValue(parameter, file,
              (String) value);
        }

      }
View Full Code Here

  }

  private void copyParameterValuesFromRawDataFiles() {

    MZmineProject currentProject = MZmineCore.getCurrentProject();

    for (int dataFileIndex = 0; dataFileIndex < dataFiles.length; dataFileIndex++) {

      RawDataFile file = dataFiles[dataFileIndex];
      UserParameter[] parameters = currentProject.getParameters();

      // Loop through all parameters defined for this file
      for (UserParameter p : parameters) {

        // Check if this parameter has been seen before?
        Object[] values;
        if (!(parameterValues.containsKey(p))) {
          // No, initialize a new array of values for this parameter
          values = new Object[dataFiles.length];
          for (int i = 0; i < values.length; i++)
            values[i] = p.getValue();
          parameterValues.put(p, values);
        } else {
          values = parameterValues.get(p);
        }

        // Set value of this parameter for the current raw data file
        values[dataFileIndex] = currentProject.getParameterValue(p,
            file);

      }

    }
View Full Code Here

      newPeakList.addRow(entry);
      processedScans++;
    }

    MZmineProject currentProject = MZmineCore.getCurrentProject();
    currentProject.addPeakList(newPeakList);
    logger.info("Finished MS/MS peak builder on " + dataFile + ", "
        + processedScans + " scans processed");

    setStatus(TaskStatus.FINISHED);
  }
View Full Code Here

    for (Gap gap : gaps) {
      gap.noMoreOffers();
    }

    // Append processed peak list to the project
    MZmineProject currentProject = MZmineCore.getCurrentProject();
    currentProject.addPeakList(processedPeakList);

    // Add task description to peakList
    processedPeakList
        .addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod(
            "Targeted peak detection ", parameters));
View Full Code Here

    }

    ProjectTree projectTree = (ProjectTree) info.getComponent();
    ProjectTreeModel treeModel = (ProjectTreeModel) projectTree.getModel();

    MZmineProject project = MZmineCore.getCurrentProject();

    JTree.DropLocation dl = (JTree.DropLocation) info.getDropLocation();
    TreePath dropPath = dl.getPath();
    DefaultMutableTreeNode droppedLocationNode = (DefaultMutableTreeNode) dropPath
        .getLastPathComponent();

    Object droppedLocationObject = droppedLocationNode.getUserObject();
    int childIndex = dl.getChildIndex();

    TreePath transferedPaths[] = projectTree.getSelectionPaths();

    // Check if the drop target is among the project data files
    if (droppedLocationObject == ProjectTreeModel.dataFilesNodeName) {

      for (TreePath path : transferedPaths) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
            .getLastPathComponent();
        int currentIndex = node.getParent().getIndex(node);
        Object transferObject = node.getUserObject();
        if (transferObject instanceof RawDataFile) {
          treeModel.removeNodeFromParent(node);

          if (childIndex > currentIndex)
            childIndex--;
          treeModel.insertNodeInto(node, droppedLocationNode,
              childIndex);

          childIndex++;

        }
      }

    }

    // Check if the drop target is AFTER the data files (last position)
    if ((droppedLocationObject == project) && (childIndex == 1)) {
      int numOfFiles = project.getDataFiles().length;
      DefaultMutableTreeNode filesNode = (DefaultMutableTreeNode) droppedLocationNode
          .getChildAt(0);

      for (TreePath path : transferedPaths) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
            .getLastPathComponent();
        Object transferObject = node.getUserObject();
        if (transferObject instanceof RawDataFile) {
          treeModel.removeNodeFromParent(node);
          treeModel.insertNodeInto(node, filesNode, numOfFiles - 1);
        }
      }

    }

    // Check if the drop target is among the project peak lists
    if (droppedLocationObject == ProjectTreeModel.peakListsNodeName) {
      for (TreePath path : transferedPaths) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
            .getLastPathComponent();
        int currentIndex = node.getParent().getIndex(node);
        Object transferObject = node.getUserObject();
        if (childIndex > currentIndex)
          childIndex--;
        if (transferObject instanceof PeakList) {
          treeModel.removeNodeFromParent(node);
          treeModel.insertNodeInto(node, droppedLocationNode,
              childIndex);
          childIndex++;
        }
      }
    }

    // Check if the drop target is AFTER the peak lists (last position)
    if ((droppedLocationObject == project) && (childIndex == 2)) {
      DefaultMutableTreeNode peakListsNode = (DefaultMutableTreeNode) droppedLocationNode
          .getChildAt(1);

      int numOfPeakLists = project.getPeakLists().length;
      for (TreePath path : transferedPaths) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
            .getLastPathComponent();
        Object transferObject = node.getUserObject();
        if (transferObject instanceof PeakList) {
View Full Code Here

        // Finalize writing
        correctedDataFile = rawDataFileWriter.finishWriting();

        // Add the newly created file to the project
        final MZmineProject project = MZmineCore.getCurrentProject();
        project.addFile(correctedDataFile);

        // Remove the original data file if requested
        if (removeOriginal) {
          project.removeFile(origDataFile);
        }

        // Set task status to FINISHED
        setStatus(TaskStatus.FINISHED);
View Full Code Here

    this.selectedRows = parameters.getParameter(
        IntensityPlotParameters.selectedRows).getValue();

    if (xAxisValueSource instanceof ParameterWrapper) {
      MZmineProject project = MZmineCore.getCurrentProject();
      UserParameter xAxisParameter = ((ParameterWrapper) xAxisValueSource)
          .getParameter();
      LinkedHashSet<Comparable> parameterValues = new LinkedHashSet<Comparable>();
      for (RawDataFile file : selectedFiles) {
        Object value = project.getParameterValue(xAxisParameter, file);
        parameterValues.add((Comparable<?>) value);
      }
      xValues = parameterValues.toArray(new Comparable[0]);

      // if we have a numerical axis, we don't want the values to be
View Full Code Here

    }
    if (xAxisValueSource instanceof ParameterWrapper) {
      HashSet<RawDataFile> files = new HashSet<RawDataFile>();
      UserParameter xAxisParameter = ((ParameterWrapper) xAxisValueSource)
          .getParameter();
      MZmineProject project = MZmineCore.getCurrentProject();
      for (RawDataFile file : selectedFiles) {
        Object fileValue = project.getParameterValue(xAxisParameter,
            file);
        if (fileValue == null)
          continue;
        if (fileValue.equals(xValue))
          files.add(file);
View Full Code Here

      // Finish up.
      if (!isCanceled()) {

        // Add new peak-list to the project.
        final MZmineProject currentProject = MZmineCore
            .getCurrentProject();
        currentProject.addPeakList(newPeakList);

        // Remove the original peak-list if requested.
        if (removeOriginal) {

          currentProject.removePeakList(origPeakList);
        }

        // Copy previously applied methods
        for (final PeakListAppliedMethod method : origPeakList
            .getAppliedMethods()) {
View Full Code Here

TOP

Related Classes of net.sf.mzmine.project.MZmineProject

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.