Search in sources :

Example 16 with HeadLessDesktop

use of net.sf.mzmine.desktop.impl.HeadLessDesktop in project mzmine2 by mzmine.

the class LipidSearchTask method run.

/**
 * @see java.lang.Runnable#run()
 */
@Override
public void run() {
    setStatus(TaskStatus.PROCESSING);
    logger.info("Starting lipid search in " + peakList);
    PeakListRow[] rows = peakList.getRows();
    // Check if lipids should be modified
    if (searchForModifications == true) {
        lipidModificationMasses = getLipidModificationMasses(lipidModification);
    }
    // Calculate how many possible lipids we will try
    totalSteps = ((maxChainLength - minChainLength + 1) * (maxDoubleBonds - minDoubleBonds + 1)) * selectedLipids.length;
    // Try all combinations of fatty acid lengths and double bonds
    for (int i = 0; i < selectedLipids.length; i++) {
        int numberOfAcylChains = selectedLipids[i].getNumberOfAcylChains();
        int numberOfAlkylChains = selectedLipids[i].getNumberofAlkyChains();
        for (int chainLength = minChainLength; chainLength <= maxChainLength; chainLength++) {
            for (int chainDoubleBonds = minDoubleBonds; chainDoubleBonds <= maxDoubleBonds; chainDoubleBonds++) {
                // Task canceled?
                if (isCanceled())
                    return;
                // than minimal length, skip this lipid
                if (((chainLength > 0) && (chainLength < minChainLength))) {
                    finishedSteps++;
                    continue;
                }
                // doesn't make sense, so let's skip such lipids
                if (((chainDoubleBonds > 0) && (chainDoubleBonds > chainLength - 1))) {
                    finishedSteps++;
                    continue;
                }
                // Prepare a lipid instance
                LipidIdentity lipidChain = new LipidIdentity(selectedLipids[i], chainLength, chainDoubleBonds, numberOfAcylChains, numberOfAlkylChains);
                // Find all rows that match this lipid
                findPossibleLipid(lipidChain, rows);
                finishedSteps++;
            }
        }
    }
    // Add task description to peakList
    ((SimplePeakList) peakList).addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod("Lipid search", parameters));
    // Repaint the window to reflect the change in the peak list
    Desktop desktop = MZmineCore.getDesktop();
    if (!(desktop instanceof HeadLessDesktop))
        desktop.getMainWindow().repaint();
    setStatus(TaskStatus.FINISHED);
    logger.info("Finished lipid search task in " + peakList);
}
Also used : LipidIdentity(net.sf.mzmine.modules.peaklistmethods.identification.lipididentification.lipidutils.LipidIdentity) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) HeadLessDesktop(net.sf.mzmine.desktop.impl.HeadLessDesktop) Desktop(net.sf.mzmine.desktop.Desktop) SimplePeakList(net.sf.mzmine.datamodel.impl.SimplePeakList) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) DataPoint(net.sf.mzmine.datamodel.DataPoint) HeadLessDesktop(net.sf.mzmine.desktop.impl.HeadLessDesktop)

Example 17 with HeadLessDesktop

use of net.sf.mzmine.desktop.impl.HeadLessDesktop in project mzmine2 by mzmine.

the class SortSpectralDBIdentitiesTask method run.

/**
 * @see java.lang.Runnable#run()
 */
@Override
public void run() {
    setStatus(TaskStatus.PROCESSING);
    totalRows = peakList.getNumberOfRows();
    finishedRows = 0;
    for (PeakListRow row : peakList.getRows()) {
        if (isCanceled()) {
            return;
        }
        // sort identities of row
        sortIdentities(row, filterByMinScore, minScore);
        finishedRows++;
    }
    // Add task description to peakList
    peakList.addDescriptionOfAppliedTask(new SimplePeakListAppliedMethod("Sorted spectral database identities of DB search ", parameters));
    // Repaint the window to reflect the change in the feature list
    Desktop desktop = MZmineCore.getDesktop();
    if (!(desktop instanceof HeadLessDesktop))
        desktop.getMainWindow().repaint();
    setStatus(TaskStatus.FINISHED);
}
Also used : PeakListRow(net.sf.mzmine.datamodel.PeakListRow) HeadLessDesktop(net.sf.mzmine.desktop.impl.HeadLessDesktop) Desktop(net.sf.mzmine.desktop.Desktop) SimplePeakListAppliedMethod(net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod) HeadLessDesktop(net.sf.mzmine.desktop.impl.HeadLessDesktop)

Aggregations

Desktop (net.sf.mzmine.desktop.Desktop)17 HeadLessDesktop (net.sf.mzmine.desktop.impl.HeadLessDesktop)17 SimplePeakListAppliedMethod (net.sf.mzmine.datamodel.impl.SimplePeakListAppliedMethod)10 SimplePeakList (net.sf.mzmine.datamodel.impl.SimplePeakList)6 IOException (java.io.IOException)5 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)5 AbstractTask (net.sf.mzmine.taskcontrol.AbstractTask)4 UnsupportedFormatException (net.sf.mzmine.util.spectraldb.parser.UnsupportedFormatException)4 DataPoint (net.sf.mzmine.datamodel.DataPoint)3 Feature (net.sf.mzmine.datamodel.Feature)2 SpectraIdentificationResultsWindow (net.sf.mzmine.modules.visualization.spectra.spectralmatchresults.SpectraIdentificationResultsWindow)2 PeakListRowSorter (net.sf.mzmine.util.PeakListRowSorter)2 File (java.io.File)1 FileReader (java.io.FileReader)1 Locale (java.util.Locale)1 IsotopePattern (net.sf.mzmine.datamodel.IsotopePattern)1 PeakList (net.sf.mzmine.datamodel.PeakList)1 Scan (net.sf.mzmine.datamodel.Scan)1 MainWindow (net.sf.mzmine.desktop.impl.MainWindow)1 MZmineConfigurationImpl (net.sf.mzmine.main.impl.MZmineConfigurationImpl)1