Search in sources :

Example 41 with RawDataFile

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;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) RawDataFilesParameter(net.sf.mzmine.parameters.parametertypes.selectors.RawDataFilesParameter) Nonnull(javax.annotation.Nonnull)

Example 42 with RawDataFile

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;
}
Also used : ScanSelection(net.sf.mzmine.parameters.parametertypes.selectors.ScanSelection) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Scan(net.sf.mzmine.datamodel.Scan) Nonnull(javax.annotation.Nonnull)

Example 43 with RawDataFile

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;
}
Also used : Task(net.sf.mzmine.taskcontrol.Task) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Nonnull(javax.annotation.Nonnull)

Example 44 with RawDataFile

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();
    }
}
Also used : SimpleScan(net.sf.mzmine.datamodel.impl.SimpleScan) DataPoint(net.sf.mzmine.datamodel.DataPoint) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) Scan(net.sf.mzmine.datamodel.Scan) SimpleScan(net.sf.mzmine.datamodel.impl.SimpleScan) RawDataFileWriter(net.sf.mzmine.datamodel.RawDataFileWriter)

Example 45 with RawDataFile

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;
    }
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile)

Aggregations

RawDataFile (net.sf.mzmine.datamodel.RawDataFile)185 Feature (net.sf.mzmine.datamodel.Feature)59 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)52 DataPoint (net.sf.mzmine.datamodel.DataPoint)51 Scan (net.sf.mzmine.datamodel.Scan)40 ArrayList (java.util.ArrayList)33 PeakList (net.sf.mzmine.datamodel.PeakList)33 Nonnull (javax.annotation.Nonnull)24 SimpleDataPoint (net.sf.mzmine.datamodel.impl.SimpleDataPoint)24 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)24 SimplePeakListRow (net.sf.mzmine.datamodel.impl.SimplePeakListRow)22 Task (net.sf.mzmine.taskcontrol.Task)20 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)19 SimpleFeature (net.sf.mzmine.datamodel.impl.SimpleFeature)17 IOException (java.io.IOException)14 ParameterSet (net.sf.mzmine.parameters.ParameterSet)14 File (java.io.File)13 MassList (net.sf.mzmine.datamodel.MassList)13 PeakListAppliedMethod (net.sf.mzmine.datamodel.PeakList.PeakListAppliedMethod)13 TreeMap (java.util.TreeMap)10