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