Search in sources :

Example 6 with SimplePeakListAppliedMethod

use of net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod in project mzmine2 by mzmine.

the class PathAlignerTask method run.

/**
 * @see Runnable#run()
 */
public void run() {
    setStatus(TaskStatus.PROCESSING);
    logger.info("Running Path aligner");
    aligner = (Aligner) new ScoreAligner(this.peakLists, parameters);
    alignedPeakList = aligner.align();
    // Add new aligned feature list to the project
    project.addPeakList(alignedPeakList);
    // Add task description to peakList
    alignedPeakList.addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod("Path aligner", parameters));
    logger.info("Finished Path aligner");
    setStatus(TaskStatus.FINISHED);
}
Also used : ScoreAligner(net.sf.mzmine.modules.peaklistmethods.alignment.path.functions.ScoreAligner) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)

Example 7 with SimplePeakListAppliedMethod

use of net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod in project mzmine2 by mzmine.

the class PeakListOpenHandler_2_5 method initializePeakList.

/**
 * Initializes the feature list
 */
private void initializePeakList() {
    RawDataFile[] dataFiles = currentPeakListDataFiles.toArray(new RawDataFile[0]);
    buildingPeakList = new SimplePeakList(peakListName, dataFiles);
    for (int i = 0; i < appliedMethods.size(); i++) {
        String methodName = appliedMethods.elementAt(i);
        String methodParams = appliedMethodParameters.elementAt(i);
        PeakListAppliedMethod pam = new SimplePeakListAppliedMethod(methodName, methodParams);
        buildingPeakList.addDescriptionOfAppliedTask(pam);
    }
    buildingPeakList.setDateCreated(dateCreated);
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) PeakListAppliedMethod(net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Example 8 with SimplePeakListAppliedMethod

use of net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod in project mzmine2 by mzmine.

the class PeakListOpenHandler_2_0 method initializePeakList.

/**
 * Initializes the feature list
 */
private void initializePeakList() {
    RawDataFile[] dataFiles = currentPeakListDataFiles.toArray(new RawDataFile[0]);
    buildingPeakList = new SimplePeakList(peakListName, dataFiles);
    for (int i = 0; i < appliedMethods.size(); i++) {
        String methodName = appliedMethods.elementAt(i);
        String methodParams = appliedMethodParameters.elementAt(i);
        PeakListAppliedMethod pam = new SimplePeakListAppliedMethod(methodName, methodParams);
        buildingPeakList.addDescriptionOfAppliedTask(pam);
    }
    buildingPeakList.setDateCreated(dateCreated);
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) PeakListAppliedMethod(net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Example 9 with SimplePeakListAppliedMethod

use of net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod in project mzmine2 by mzmine.

the class PeakListOpenHandler_2_3 method initializePeakList.

/**
 * Initializes the feature list
 */
private void initializePeakList() {
    RawDataFile[] dataFiles = currentPeakListDataFiles.toArray(new RawDataFile[0]);
    buildingPeakList = new SimplePeakList(peakListName, dataFiles);
    for (int i = 0; i < appliedMethods.size(); i++) {
        String methodName = appliedMethods.elementAt(i);
        String methodParams = appliedMethodParameters.elementAt(i);
        PeakListAppliedMethod pam = new SimplePeakListAppliedMethod(methodName, methodParams);
        buildingPeakList.addDescriptionOfAppliedTask(pam);
    }
    buildingPeakList.setDateCreated(dateCreated);
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) PeakListAppliedMethod(net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimpleDataPoint(net.sf.mzmine.datamodel.impl.SimpleDataPoint)

Example 10 with SimplePeakListAppliedMethod

use of net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod in project mzmine2 by mzmine.

the class ShapeModelerTask method run.

public void run() {
    setStatus(TaskStatus.PROCESSING);
    Class<?> shapeModelClass = shapeModelerType.getModelClass();
    Constructor<?> shapeModelConstruct;
    shapeModelConstruct = shapeModelClass.getConstructors()[0];
    // Get data file information
    RawDataFile dataFile = originalPeakList.getRawDataFile(0);
    // Create new feature list
    newPeakList = new SimplePeakList(originalPeakList + " " + suffix, dataFile);
    totalRows = originalPeakList.getNumberOfRows();
    int[] scanNumbers;
    double[] retentionTimes, intensities;
    SimplePeakListRow newRow;
    for (PeakListRow row : originalPeakList.getRows()) {
        if (isCanceled())
            return;
        newRow = new SimplePeakListRow(newPeakID);
        try {
            for (Feature peak : row.getPeaks()) {
                // Load the intensities into array
                dataFile = peak.getDataFile();
                scanNumbers = peak.getScanNumbers();
                retentionTimes = new double[scanNumbers.length];
                for (int i = 0; i < scanNumbers.length; i++) retentionTimes[i] = dataFile.getScan(scanNumbers[i]).getRetentionTime();
                intensities = new double[scanNumbers.length];
                for (int i = 0; i < scanNumbers.length; i++) {
                    DataPoint dp = peak.getDataPoint(scanNumbers[i]);
                    if (dp != null)
                        intensities[i] = dp.getIntensity();
                    else
                        intensities[i] = 0;
                }
                Feature shapePeak = (Feature) shapeModelConstruct.newInstance(peak, scanNumbers, intensities, retentionTimes, resolution);
                newRow.addPeak(shapePeak.getDataFile(), shapePeak);
            }
        } catch (Exception e) {
            String message = "Error trying to make an instance of shape model class " + shapeModelClass;
            MZmineCore.getDesktop().displayErrorMessage(MZmineCore.getDesktop().getMainWindow(), message);
            logger.severe(message);
            return;
        }
        newPeakList.addRow(newRow);
        newPeakID++;
        processedRows++;
    }
    // Add new peaklist to the project
    project.addPeakList(newPeakList);
    // Add quality parameters to peaks
    QualityParameters.calculateQualityParameters(newPeakList);
    // Remove the original peaklist if requested
    if (removeOriginal)
        project.removePeakList(originalPeakList);
    // Load previous applied methods
    for (PeakListAppliedMethod proc : originalPeakList.getAppliedMethods()) {
        newPeakList.addDescriptionOfAppliedTask(proc);
    }
    // Add task description to peakList
    newPeakList.addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod("Peaks shaped by " + shapeModelerType + " function", parameters));
    logger.finest("Finished peak shape modeler " + processedRows + " rows processed");
    setStatus(TaskStatus.FINISHED);
}
Also used : SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) PeakListAppliedMethod(net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) SimplePeakListRow(net.sf.mzmine.datamodel.impl.SimplePeakListRow) Feature(net.sf.mzmine.datamodel.Feature) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimplePeakListRow(net.sf.mzmine.datamodel.impl.SimplePeakListRow) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) DataPoint(net.sf.mzmine.datamodel.DataPoint) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList)

Aggregations

SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)42 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)29 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)26 PeakListAppliedMethod (net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod)20 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)19 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)18 Feature (net.sf.mzmine.datamodel.Feature)16 DataPoint (net.sf.mzmine.datamodel.DataPoint)15 PeakList (net.sf.mzmine.datamodel.PeakList)11 Desktop (net.sf.mzmine.desktop.Desktop)10 HeadLessDesktop (net.sf.mzmine.desktop.impl.HeadLessDesktop)10 SimpleFeature (net.sf.mzmine.datamodel.impl.SimpleFeature)9 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)8 ArrayList (java.util.ArrayList)7 PeakIdentity (net.sf.mzmine.datamodel.PeakIdentity)6 Vector (java.util.Vector)4 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)4 Scan (net.sf.mzmine.datamodel.Scan)4 SimpleIsotopePattern (net.sf.mzmine.datamodel.impl.SimpleIsotopePattern)4 IOException (java.io.IOException)3