Search in sources :

Example 1 with SimpleSorter

use of net.sf.mzmine.util.SimpleSorter in project mzmine2 by mzmine.

the class TICVisualizerWindow method updateTitle.

void updateTitle() {
    NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat();
    NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat();
    NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat();
    StringBuffer mainTitle = new StringBuffer();
    StringBuffer subTitle = new StringBuffer();
    // If all data files have m/z range less than or equal to range of
    // the plot (mzMin, mzMax), then call this TIC, otherwise XIC
    Set<RawDataFile> fileSet = ticDataSets.keySet();
    String ticOrXIC = "TIC";
    // Enlarge range a bit to avoid rounding errors
    Range<Double> mzRange2 = Range.range(mzRange.lowerEndpoint() - 1, BoundType.CLOSED, mzRange.upperEndpoint() + 1, BoundType.CLOSED);
    for (RawDataFile df : fileSet) {
        if (!mzRange2.encloses(df.getDataMZRange())) {
            ticOrXIC = "XIC";
            break;
        }
    }
    if (plotType == TICPlotType.BASEPEAK) {
        if (ticOrXIC.equals("TIC")) {
            mainTitle.append("Base peak chromatogram");
        } else {
            mainTitle.append("XIC (base peak)");
        }
    } else {
        if (ticOrXIC.equals("TIC")) {
            mainTitle.append("TIC");
        } else {
            mainTitle.append("XIC");
        }
    }
    mainTitle.append(", m/z: " + mzFormat.format(mzRange.lowerEndpoint()) + " - " + mzFormat.format(mzRange.upperEndpoint()));
    CursorPosition pos = getCursorPosition();
    if (pos != null) {
        subTitle.append("Selected scan #");
        subTitle.append(pos.getScanNumber());
        if (ticDataSets.size() > 1) {
            subTitle.append(" (" + pos.getDataFile() + ")");
        }
        subTitle.append(", RT: " + rtFormat.format(pos.getRetentionTime()));
        if (plotType == TICPlotType.BASEPEAK) {
            subTitle.append(", base peak: " + mzFormat.format(pos.getMzValue()) + " m/z");
        }
        subTitle.append(", IC: " + intensityFormat.format(pos.getIntensityValue()));
    }
    // update window title
    RawDataFile[] files = ticDataSets.keySet().toArray(new RawDataFile[0]);
    Arrays.sort(files, new SimpleSorter());
    String dataFileNames = Joiner.on(",").join(files);
    setTitle("Chromatogram: [" + dataFileNames + "; " + mzFormat.format(mzRange.lowerEndpoint()) + " - " + mzFormat.format(mzRange.upperEndpoint()) + " m/z" + "]");
    // update plot title
    ticPlot.setTitle(mainTitle.toString(), subTitle.toString());
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimpleSorter(net.sf.mzmine.util.SimpleSorter) NumberFormat(java.text.NumberFormat)

Aggregations

NumberFormat (java.text.NumberFormat)1 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)1 SimpleSorter (net.sf.mzmine.util.SimpleSorter)1