use of net.sf.mzmine.util.spectraldb.parser.UnsupportedFormatException in project mzmine2 by mzmine.
the class SelectedRowsLocalSpectralDBSearchTask method parseFile.
/**
* Load all library entries from data base file
*
* @param dataBaseFile
* @return
*/
private List<RowsSpectralMatchTask> parseFile(File dataBaseFile) throws UnsupportedFormatException, IOException {
//
List<RowsSpectralMatchTask> tasks = new ArrayList<>();
AutoLibraryParser parser = new AutoLibraryParser(100, new LibraryEntryProcessor() {
@Override
public void processNextEntries(List<SpectralDBEntry> list, int alreadyProcessed) {
// start last task
RowsSpectralMatchTask task = new RowsSpectralMatchTask(peakListRows.length + " rows", peakListRows, parameters, alreadyProcessed + 1, list, (match) -> {
// one selected row -> show in dialog
if (resultWindow != null) {
resultWindow.addMatches(match);
resultWindow.revalidate();
resultWindow.repaint();
}
});
MZmineCore.getTaskController().addTask(task);
tasks.add(task);
}
});
// return tasks
parser.parse(this, dataBaseFile);
return tasks;
}
use of net.sf.mzmine.util.spectraldb.parser.UnsupportedFormatException in project mzmine2 by mzmine.
the class SpectraIdentificationSpectralDatabaseTask method parseFile.
/**
* Load all library entries from data base file
*
* @param dataBaseFile
* @return
*/
private List<SpectralMatchTask> parseFile(File dataBaseFile) {
// one task for every 1000 entries
List<SpectralMatchTask> tasks = new ArrayList<>();
AutoLibraryParser parser = new AutoLibraryParser(1000, new LibraryEntryProcessor() {
@Override
public void processNextEntries(List<SpectralDBEntry> list, int alreadyProcessed) {
// start last task
SpectralMatchTask task = new SpectralMatchTask(parameters, alreadyProcessed + 1, list, spectraPlot, currentScan, resultWindow);
MZmineCore.getTaskController().addTask(task);
tasks.add(task);
}
});
// return tasks
try {
// parse and create spectral matching tasks for batches of entries
parser.parse(this, dataBaseFile);
return tasks;
} catch (UnsupportedFormatException | IOException e) {
logger.log(Level.WARNING, "Library parsing error for file " + dataBaseFile.getAbsolutePath(), e);
return new ArrayList<>();
}
}
Aggregations