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;
}
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;
}
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);
}
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;
}
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;
}
Aggregations