use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class GridMassModule method runModule.
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
RawDataFile[] dataFiles = parameters.getParameter(new RawDataFilesParameter()).getValue().getMatchingRawDataFiles();
for (int i = 0; i < dataFiles.length; i++) {
Task newTask = new GridMassTask(project, dataFiles[i], parameters.cloneParameterSet());
tasks.add(newTask);
}
return ExitCode.OK;
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class ExportScansFromRawFilesModule method runModule.
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
ScanSelection select = parameters.getParameter(ExportScansFromRawFilesParameters.scanSelect).getValue();
Scan[] scans = new Scan[0];
for (RawDataFile raw : parameters.getParameter(ExportScansFromRawFilesParameters.dataFiles).getValue().getMatchingRawDataFiles()) {
scans = ArrayUtils.addAll(scans, select.getMatchingScans(raw));
}
ExportScansTask task = new ExportScansTask(scans, parameters);
tasks.add(task);
return ExitCode.OK;
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class CropFilterModule method runModule.
@Override
@Nonnull
public ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) {
for (RawDataFile dataFile : parameters.getParameter(CropFilterParameters.dataFiles).getValue().getMatchingRawDataFiles()) {
Task newTask = new CropFilterTask(project, dataFile, parameters);
tasks.add(newTask);
}
return ExitCode.OK;
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class CropFilterTask method run.
/**
* @see Runnable#run()
*/
@Override
public void run() {
setStatus(TaskStatus.PROCESSING);
logger.info("Started crop filter on " + dataFile);
scans = scanSelection.getMatchingScans(dataFile);
totalScans = scans.length;
// Check if we have any scans
if (totalScans == 0) {
setStatus(TaskStatus.ERROR);
setErrorMessage("No scans match the selected criteria");
return;
}
try {
RawDataFileWriter rawDataFileWriter = MZmineCore.createNewFile(dataFile.getName() + " " + suffix);
for (Scan scan : scans) {
SimpleScan scanCopy = new SimpleScan(scan);
// Check if we have something to crop
if (!mzRange.encloses(scan.getDataPointMZRange())) {
DataPoint[] croppedDataPoints = scan.getDataPointsByMass(mzRange);
scanCopy.setDataPoints(croppedDataPoints);
}
rawDataFileWriter.addScan(scanCopy);
processedScans++;
}
RawDataFile filteredRawDataFile = rawDataFileWriter.finishWriting();
project.addFile(filteredRawDataFile);
// Remove the original file if requested
if (removeOriginal) {
project.removeFile(dataFile);
}
setStatus(TaskStatus.FINISHED);
} catch (Exception e) {
setStatus(TaskStatus.ERROR);
setErrorMessage(e.toString());
e.printStackTrace();
}
}
use of net.sf.mzmine.datamodel.RawDataFile in project mzmine2 by mzmine.
the class TICSumDataSet method calcTotalScans.
private void calcTotalScans() {
totalScans = 0;
for (RawDataFile raw : dataFiles) {
int[] scans = raw.getScanNumbers(1, rangeRT);
totalScans += scans.length;
}
}
Aggregations