Search in sources :

Example 61 with PeakList

use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.

the class MultiThreadPeakFinderModule method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    PeakList[] peakLists = parameters.getParameter(MultiThreadPeakFinderParameters.peakLists).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        // start tasks
        Task newTask = new MultiThreadPeakFinderMainTask(project, peakList, parameters, tasks);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Example 62 with PeakList

use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.

the class PeakComparisonRowFilterModule method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    final PeakList[] peakLists = parameters.getParameter(PeakComparisonRowFilterParameters.PEAK_LISTS).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        Task newTask = new PeakComparisonRowFilterTask(project, peakList, parameters);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Example 63 with PeakList

use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.

the class PeakListBlankSubtractionMasterTask method run.

@Override
public void run() {
    if (!checkBlankSelection(alignedFeatureList, blankRaws)) {
        setErrorMessage("Peak list " + alignedFeatureList.getName() + " does no contain all selected blank raw data files.");
        setStatus(TaskStatus.ERROR);
        return;
    }
    setStatus(TaskStatus.PROCESSING);
    // PeakListRow[] rowsInBlanks =
    // getFeatureRowsContainedBlanks(alignedFeatureList, blankRaws, minBlankDetections);
    PeakListRow[] rows = PeakUtils.copyPeakRows(alignedFeatureList.getRows());
    rows = PeakUtils.sortRowsMzAsc(rows);
    for (RawDataFile raw : alignedFeatureList.getRawDataFiles()) {
        // only create a task for every file that is not a blank
        if (Arrays.asList(blankRaws).contains(raw))
            continue;
        // these tasks will access the passed array and remove the features that appear in their raw
        // data file and the blanks from these rows
        AbstractTask task = new PeakListBlankSubtractionSingleTask(parameters, raw, rows);
        MZmineCore.getTaskController().addTask(task);
        subTasks.add(task);
        if (getStatus() == TaskStatus.CANCELED)
            return;
    }
    // wait for tasks to finish
    boolean allTasksFinished = false;
    while (!allTasksFinished) {
        allTasksFinished = true;
        for (AbstractTask task : subTasks) {
            if (task.getStatus() != TaskStatus.FINISHED)
                allTasksFinished = false;
        }
        try {
            TimeUnit.MILLISECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
            setErrorMessage(e.getMessage());
            setStatus(TaskStatus.ERROR);
            return;
        }
        if (getStatus() == TaskStatus.CANCELED)
            return;
    }
    // remove rows that only contain blankRaws
    List<RawDataFile> blankRawsList = Arrays.asList(blankRaws);
    int onlyBlankRows = 0;
    for (int i = 0; i < rows.length; i++) {
        PeakListRow row = rows[i];
        if (blankRawsList.containsAll(Arrays.asList(row.getRawDataFiles()))) {
            onlyBlankRows++;
            rows[i] = null;
        }
        if (getStatus() == TaskStatus.CANCELED)
            return;
    }
    logger.finest("Removed " + onlyBlankRows + " rows that only existed in blankfiles.");
    PeakList result = new SimplePeakList(alignedFeatureList.getName() + " sbtrctd", alignedFeatureList.getRawDataFiles());
    for (PeakListRow row : rows) {
        if (row != null) {
            result.addRow(row);
        }
    }
    PeakListUtils.copyPeakListAppliedMethods(alignedFeatureList, result);
    result.addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod(PeakListBlankSubtractionModule.MODULE_NAME, parameters));
    project.addPeakList(result);
    setStatus(TaskStatus.FINISHED);
}
Also used : PeakListRow(net.sf.mzmine.datamodel.PeakListRow) AbstractTask(net.sf.mzmine.taskcontrol.AbstractTask) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) PeakList(net.sf.mzmine.datamodel.PeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)

Example 64 with PeakList

use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.

the class GroupMS2Module method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    final PeakList[] peakLists = parameters.getParameter(GroupMS2Parameters.PEAK_LISTS).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        Task newTask = new GroupMS2Task(project, peakList, parameters);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Example 65 with PeakList

use of net.sf.mzmine.datamodel.PeakList in project mzmine2 by mzmine.

the class NeutralLossFilterModule method runModule.

@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
    PeakList[] peakLists = parameters.getParameter(NeutralLossFilterParameters.PEAK_LISTS).getValue().getMatchingPeakLists();
    for (PeakList peakList : peakLists) {
        Task newTask = new NeutralLossFilterTask(project, peakList, parameters);
        tasks.add(newTask);
    }
    return ExitCode.OK;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) PeakList(net.sf.mzmine.datamodel.PeakList) Nonnull(javax.annotation.Nonnull)

Aggregations

PeakList (net.sf.mzmine.datamodel.PeakList)120 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)41 Nonnull (javax.annotation.Nonnull)40 Task (net.sf.mzmine.taskcontrol.Task)37 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)36 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)26 Feature (net.sf.mzmine.datamodel.Feature)19 ArrayList (java.util.ArrayList)15 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)11 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)11 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)10 File (java.io.File)9 FileWriter (java.io.FileWriter)8 ParameterSet (net.sf.mzmine.parameters.ParameterSet)8 IOException (java.io.IOException)7 DataPoint (net.sf.mzmine.datamodel.DataPoint)7 Vector (java.util.Vector)6 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)6 MZmineProject (net.sf.mzmine.datamodel.MZmineProject)6 PeakIdentity (net.sf.mzmine.datamodel.PeakIdentity)6