PeakListTableColumnModel(
      GroupableTableHeader header,
      PeakListTableModel tableModel,
      ParameterSet parameters,
      PeakList peakList) {

    this.parameters = parameters;
    this.peakList = peakList;

    this.header = header;

    header.addMouseListener(this);

    // prepare formatters
    NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat();
    NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat();
    NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat();

    // prepare cell renderers
    mzRenderer = new FormattedCellRenderer(mzFormat);
    rtRenderer = new FormattedCellRenderer(rtFormat);
    intensityRenderer = new FormattedCellRenderer(intensityFormat);
    peakShapeRenderer = new PeakShapeCellRenderer(peakList, parameters);
    identityRenderer = new CompoundIdentityCellRenderer();
    peakStatusRenderer = new PeakStatusCellRenderer();
    defaultRenderer = new DefaultTableCellRenderer();
    defaultRenderer.setHorizontalAlignment(SwingConstants.CENTER);
    defaultRendererLeft = new DefaultTableCellRenderer();
    defaultRendererLeft.setHorizontalAlignment(SwingConstants.LEFT);
  }
Exemplo n.º 2
0
  public FragmentIdentity(final PeakListRow mainPeakListRow) {

    super(
        "Fragment of "
            + MZmineCore.getConfiguration().getMZFormat().format(mainPeakListRow.getAverageMZ())
            + " m/z");
    setPropertyValue(PROPERTY_METHOD, "Fragment search");
  }
  /**
   * Search for a peak-list row's mass spectrum.
   *
   * @param peakList the peak-list.
   * @param row the peak-list row.
   */
  public static void singleRowSearch(final PeakList peakList, final PeakListRow row) {

    final ParameterSet parameters =
        MZmineCore.getConfiguration().getModuleParameters(NistMsSearchModule.class);
    if (parameters.showSetupDialog() == ExitCode.OK) {

      MZmineCore.getTaskController().addTask(new NistMsSearchTask(row, peakList, parameters));
    }
  }
Exemplo n.º 4
0
  public MsMsVisualizerWindow(
      RawDataFile dataFile,
      Range<Double> rtRange,
      Range<Double> mzRange,
      IntensityType intensityType,
      NormalizationType normalizationType,
      Double minPeakInt,
      ParameterSet parameters) {

    super("MS/MS visualizer: [" + dataFile.getName() + "]");

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setBackground(Color.white);

    this.dataFile = dataFile;
    this.tooltipMode = true;

    dataset =
        new MsMsDataSet(
            dataFile, rtRange, mzRange, intensityType, normalizationType, minPeakInt, this);

    toolBar = new MsMsToolBar(this);
    add(toolBar, BorderLayout.EAST);

    IDAPlot = new MsMsPlot(this, dataFile, this, dataset, rtRange, mzRange);
    add(IDAPlot, BorderLayout.CENTER);

    bottomPanel = new MsMsBottomPanel(this, dataFile, parameters);
    add(bottomPanel, BorderLayout.SOUTH);

    updateTitle();

    // After we have constructed everything, load the peak lists into the
    // bottom panel
    bottomPanel.rebuildPeakListSelector();

    MZmineCore.getDesktop().addPeakListTreeListener(bottomPanel);

    // Add the Windows menu
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(new WindowsMenu());
    setJMenuBar(menuBar);

    pack();

    // get the window settings parameter
    ParameterSet paramSet =
        MZmineCore.getConfiguration().getModuleParameters(MsMsVisualizerModule.class);
    WindowSettingsParameter settings = paramSet.getParameter(MsMsParameters.windowSettings);

    // update the window and listen for changes
    settings.applySettingsToWindow(this);
    this.addComponentListener(settings);
  }
  public static void setupNewTICVisualizer(
      final RawDataFile[] allFiles,
      final RawDataFile[] selectedFiles,
      final ChromatographicPeak[] allPeaks,
      final ChromatographicPeak[] selectedPeaks,
      final Map<ChromatographicPeak, String> peakLabels,
      final Range rtRange,
      final Range mzRange) {

    assert allFiles != null;

    final TICVisualizerModule myInstance = MZmineCore.getModuleInstance(TICVisualizerModule.class);
    final TICVisualizerParameters myParameters =
        (TICVisualizerParameters)
            MZmineCore.getConfiguration().getModuleParameters(TICVisualizerModule.class);
    myParameters.getParameter(TICVisualizerParameters.MS_LEVEL).setValue(1);
    myParameters.getParameter(TICVisualizerParameters.PLOT_TYPE).setValue(PlotType.BASEPEAK);

    if (rtRange != null) {

      myParameters.getParameter(TICVisualizerParameters.RT_RANGE).setValue(rtRange);
    }

    if (mzRange != null) {

      myParameters.getParameter(TICVisualizerParameters.MZ_RANGE).setValue(mzRange);
    }

    if (myParameters.showSetupDialog(allFiles, selectedFiles, allPeaks, selectedPeaks)
        == ExitCode.OK) {

      final TICVisualizerParameters p = (TICVisualizerParameters) myParameters.cloneParameter();

      if (peakLabels != null) {
        p.setPeakLabelMap(peakLabels);
      }

      myInstance.runModule(p, new ArrayList<Task>());
    }
  }
/**
 * Parameters used by CentWaveDetector.
 *
 * @author $Author: cpudney $
 * @version $Revision: 3153 $
 */
public class CentWaveDetectorParameters extends SimpleParameterSet {

  /** Peak integration methods. */
  public enum PeakIntegrationMethod {
    UseSmoothedData("Use smoothed data", 1),
    UseRawData("Use raw data", 2);

    private final String name;
    private final int index;

    /**
     * Create the method.
     *
     * @param aName name
     * @param anIndex index (as used by findPeaks.centWave)
     */
    PeakIntegrationMethod(final String aName, final int anIndex) {

      name = aName;
      index = anIndex;
    }

    @Override
    public String toString() {

      return name;
    }

    public int getIndex() {

      return index;
    }
  }

  public static final RangeParameter PEAK_DURATION =
      new RangeParameter(
          "Peak duration range",
          "Range of acceptable peak lengths",
          MZmineCore.getConfiguration().getRTFormat(),
          new Range(0.0, 10.0));

  public static final RangeParameter PEAK_SCALES =
      new RangeParameter(
          "Wavelet scales",
          "Range wavelet widths (smallest, largest) in minutes",
          MZmineCore.getConfiguration().getRTFormat(),
          new Range(0.25, 5.0));

  public static final DoubleParameter SN_THRESHOLD =
      new DoubleParameter(
          "S/N threshold",
          "Signal to noise ratio threshold",
          NumberFormat.getNumberInstance(),
          10.0,
          0.0,
          null);

  public static final ComboParameter<PeakIntegrationMethod> INTEGRATION_METHOD =
      new ComboParameter<PeakIntegrationMethod>(
          "Peak integration method",
          "Method used to determine RT extents of detected peaks",
          PeakIntegrationMethod.values(),
          PeakIntegrationMethod.UseSmoothedData);

  public CentWaveDetectorParameters() {

    super(new Parameter[] {SN_THRESHOLD, PEAK_SCALES, PEAK_DURATION, INTEGRATION_METHOD});
  }

  @Override
  public ExitCode showSetupDialog() {

    final PeakResolverSetupDialog dialog =
        new PeakResolverSetupDialog(this, CentWaveDetector.class);
    dialog.setVisible(true);
    return dialog.getExitCode();
  }
}
public class PeakSummaryTableModel extends AbstractTableModel {

  private static NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat();
  private static NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat();
  private static NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat();

  private Vector<ChromatographicPeak> peaks = new Vector<ChromatographicPeak>();
  private Vector<Color> peakColors = new Vector<Color>();

  private static String[] columnNames = {"File Name", "Mass", "RT", "Height", "Area"};

  public String getColumnName(int col) {
    return columnNames[col].toString();
  }

  public int getRowCount() {
    return peaks.size();
  }

  public int getColumnCount() {
    return columnNames.length;
  }

  public Object getValueAt(int row, int col) {
    Object value = null;
    ChromatographicPeak peak = peaks.get(row);
    switch (col) {
      case (0):
        value = peak.getDataFile().getName();
        break;
      case (1):
        value = mzFormat.format(peak.getMZ());
        break;
      case (2):
        value = rtFormat.format(peak.getRT());
        break;
      case (3):
        value = intensityFormat.format(peak.getHeight());
        break;
      case (4):
        value = intensityFormat.format(peak.getArea());
        break;
    }

    return value;
  }

  public ChromatographicPeak getElementAt(int row) {
    return peaks.get(row);
  }

  public boolean isCellEditable(int row, int col) {
    return false;
  }

  public Color getPeakColor(int row) {
    return peakColors.get(row);
  }

  public void addElement(ChromatographicPeak peak, Color peakColor) {
    peaks.add(peak);
    peakColors.add(peakColor);
    fireTableRowsInserted(0, peaks.size() - 1);
  }

  public void setValueAt(Object value, int row, int col) {}

  public int getIndexRow(String fileName) {

    String localFileName;
    int index = -1;
    for (int i = 0; i < peaks.size(); i++) {
      localFileName = peaks.get(i).getDataFile().getName();
      if (localFileName.equals(fileName)) {
        index = i;
      }
    }

    return index;
  }
}