Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mzML HPLC-DAD read/write support #1863

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@

<plugin
id="org.eclipse.chemclipse.msd.converter.supplier.mzml"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
version="0.0.0"/>

<plugin
id="org.eclipse.chemclipse.msd.converter.supplier.mzml.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
version="0.0.0"/>

<plugin
id="org.eclipse.chemclipse.wsd.converter.supplier.mzml"
version="0.0.0"/>

<plugin
id="org.eclipse.chemclipse.xxd.converter.supplier.mzml"
version="0.0.0"/>

<plugin
id="org.eclipse.chemclipse.wsd.converter.supplier.mzml.ui"
version="0.0.0"/>

</feature>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2018 Lablicate GmbH.
* Copyright (c) 2016, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -9,7 +9,7 @@
* Contributors:
* Dr. Alexander Kerner - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.xxd.converter.supplier.io.exception;
package org.eclipse.chemclipse.converter.exceptions;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ConverterMessages extends NLS {
public static String readPeaks;
public static String readDatabase;
public static String writeMassSpectra;
public static String noMassSpectraStored;
//
static {
NLS.initializeMessages(BUNDLE_NAME, ConverterMessages.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ writeChromatogram=Write Chromatogram
writeScans=Write Scans
readPeaks=Read Peaks
readDatabase=Read Database
writeMassSpectra=Write Mass Spectra
writeMassSpectra=Write Mass Spectra
noMassSpectraStored=No mass spectra are stored.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ writeChromatogram=Schreibe Chromatogramm
writeScans=Schreibe Scans
readPeaks=Lese Peaks
readDatabase=Lese Datenbank
writeMassSpectra=Schreibe Massenspektren
writeMassSpectra=Schreibe Massenspektren
noMassSpectraStored=Keine Massenspektren enthalten.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2022 Lablicate GmbH.
* Copyright (c) 2020, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -12,14 +12,20 @@
package org.eclipse.chemclipse.msd.converter.supplier.amdis.converter.fin;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.eclipse.chemclipse.converter.exceptions.FileIsEmptyException;
import org.eclipse.chemclipse.converter.exceptions.FileIsNotReadableException;
import org.eclipse.chemclipse.converter.l10n.ConverterMessages;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.database.AbstractDatabaseImportConverter;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
import org.eclipse.chemclipse.msd.converter.supplier.amdis.io.FINReader;
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;

public class DatabaseImportConverter extends AbstractDatabaseImportConverter {

Expand All @@ -37,11 +43,20 @@ public IProcessingInfo<IMassSpectra> convert(File file, IProgressMonitor monitor
if(massSpectra != null && !massSpectra.isEmpty()) {
processingInfo.setProcessingResult(massSpectra);
} else {
processingInfo.addErrorMessage(DESCRIPTION, "No mass spectra were extracted." + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.noMassSpectraStored, file.getAbsolutePath()));
}
} catch(Exception e) {
} catch(FileNotFoundException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Exception parsing the file: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotFound, file.getAbsolutePath()));
} catch(FileIsNotReadableException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotReadable, file.getAbsolutePath()));
} catch(FileIsEmptyException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.emptyFile, file.getAbsolutePath()));
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.failedToReadFile, file.getAbsolutePath()));
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2022 Lablicate GmbH.
* Copyright (c) 2008, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -18,6 +18,7 @@

import org.eclipse.chemclipse.converter.exceptions.FileIsEmptyException;
import org.eclipse.chemclipse.converter.exceptions.FileIsNotReadableException;
import org.eclipse.chemclipse.converter.l10n.ConverterMessages;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.database.AbstractDatabaseImportConverter;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
Expand All @@ -26,6 +27,7 @@
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;

public class MSLDatabaseImportConverter extends AbstractDatabaseImportConverter {

Expand All @@ -44,20 +46,20 @@ public IProcessingInfo<IMassSpectra> convert(File file, IProgressMonitor monitor
if(massSpectra != null && !massSpectra.isEmpty()) {
processingInfo.setProcessingResult(massSpectra);
} else {
processingInfo.addErrorMessage(DESCRIPTION, "No mass spectra are stored." + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.noMassSpectraStored, file.getAbsolutePath()));
}
} catch(FileNotFoundException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "The file couldn't be found: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotFound, file.getAbsolutePath()));
} catch(FileIsNotReadableException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "The file is not readable: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotReadable, file.getAbsolutePath()));
} catch(FileIsEmptyException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "The file is empty: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.emptyFile, file.getAbsolutePath()));
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has gone completely wrong: " + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.failedToReadFile, file.getAbsolutePath()));
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2022 Lablicate GmbH.
* Copyright (c) 2016, 2024 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -18,6 +18,7 @@

import org.eclipse.chemclipse.converter.exceptions.FileIsEmptyException;
import org.eclipse.chemclipse.converter.exceptions.FileIsNotReadableException;
import org.eclipse.chemclipse.converter.l10n.ConverterMessages;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.database.AbstractDatabaseImportConverter;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
Expand All @@ -26,6 +27,7 @@
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;

public class MSPDatabaseImportConverter extends AbstractDatabaseImportConverter {

Expand All @@ -44,20 +46,20 @@ public IProcessingInfo<IMassSpectra> convert(File file, IProgressMonitor monitor
if(massSpectra != null && !massSpectra.isEmpty()) {
processingInfo.setProcessingResult(massSpectra);
} else {
processingInfo.addErrorMessage(DESCRIPTION, "No mass spectra are stored." + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.noMassSpectraStored, file.getAbsolutePath()));
}
} catch(FileNotFoundException e) {
logger.warn(e.getLocalizedMessage());
processingInfo.addErrorMessage(DESCRIPTION, "The file couldn't be found: " + file.getAbsolutePath());
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotFound, file.getAbsolutePath()));
} catch(FileIsNotReadableException e) {
logger.warn(e.getLocalizedMessage());
processingInfo.addErrorMessage(DESCRIPTION, "The file is not readable: " + file.getAbsolutePath());
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotReadable, file.getAbsolutePath()));
} catch(FileIsEmptyException e) {
logger.warn(e.getLocalizedMessage());
processingInfo.addErrorMessage(DESCRIPTION, "The file is empty: " + file.getAbsolutePath());
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.emptyFile, file.getAbsolutePath()));
} catch(IOException e) {
logger.warn(e.getLocalizedMessage(), e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has gone completely wrong: " + file.getAbsolutePath());
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.failedToReadFile, file.getAbsolutePath()));
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.io.IOException;

import org.eclipse.chemclipse.converter.exceptions.FileIsNotWriteableException;
import org.eclipse.chemclipse.converter.l10n.ConverterMessages;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.database.AbstractDatabaseExportConverter;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraWriter;
Expand Down Expand Up @@ -43,13 +44,13 @@ public IProcessingInfo<File> convert(File file, IScanMSD massSpectrum, boolean a
processingInfo.setProcessingResult(file);
} catch(FileNotFoundException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.fileNotFound, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.fileNotFound, file.getAbsolutePath()));
} catch(FileIsNotWriteableException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.fileNotWriteable, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.fileNotWritable, file.getAbsolutePath()));
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.ioError, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.failedToWriteFile, file.getAbsolutePath()));
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.eclipse.chemclipse.converter.exceptions.FileIsEmptyException;
import org.eclipse.chemclipse.converter.exceptions.FileIsNotReadableException;
import org.eclipse.chemclipse.converter.l10n.ConverterMessages;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.database.AbstractDatabaseImportConverter;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
Expand Down Expand Up @@ -49,20 +50,20 @@ public IProcessingInfo<IMassSpectra> convert(File file, IProgressMonitor monitor
if(massSpectra != null && !massSpectra.isEmpty()) {
processingInfo.setProcessingResult(massSpectra);
} else {
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.noMassSpectraStored, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.noMassSpectraStored, file.getAbsolutePath()));
}
} catch(FileNotFoundException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.fileNotFound, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.fileNotFound, file.getAbsolutePath()));
} catch(FileIsNotReadableException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.fileNotReadable, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.fileNotReadable, file.getAbsolutePath()));
} catch(FileIsEmptyException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.fileIsEmpty, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.emptyFile, file.getAbsolutePath()));
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(Messages.description, NLS.bind(Messages.ioError, file.getAbsolutePath()));
processingInfo.addErrorMessage(Messages.description, NLS.bind(ConverterMessages.failedToReadFile, file.getAbsolutePath()));
}
}
return processingInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.chemclipse.msd.converter.supplier.cml.l10n.messages"; //$NON-NLS-1$
//
public static String description;
public static String noMassSpectraStored;
public static String fileNotFound;
public static String fileNotReadable;
public static String fileIsEmpty;
public static String ioError;
public static String fileNotWriteable;
public static String singleSpectrum;
//
static {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
massSpectrumImport=CML Mass Spectrum Import
noMassSpectraStored=No mass spectra are stored.
fileNotFound=The file couldn't be found: {0}
fileNotReadable=The file is not readable: {0}
fileIsEmpty=The file is empty: {0}
ioError=An error occurred while reading the file: {0}
fileNotWriteable=The file is not writable: {0}
singleSpectrum=Only one spectrum per file supported.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2014, 2022 Lablicate GmbH.
* Copyright (c) 2014, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -13,8 +13,13 @@
package org.eclipse.chemclipse.msd.converter.supplier.massbank.converter;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.eclipse.chemclipse.converter.exceptions.FileIsEmptyException;
import org.eclipse.chemclipse.converter.exceptions.FileIsNotReadableException;
import org.eclipse.chemclipse.converter.l10n.ConverterMessages;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.database.IDatabaseImportConverter;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
import org.eclipse.chemclipse.msd.converter.massspectrum.IMassSpectrumImportConverter;
Expand All @@ -23,9 +28,11 @@
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.chemclipse.processing.core.ProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;

public class MassBankImportConverter implements IDatabaseImportConverter, IMassSpectrumImportConverter {

private static final Logger logger = Logger.getLogger(MassBankImportConverter.class);
private static final String DESCRIPTION = "MassBank MassSpectrum Import";

@Override
Expand All @@ -38,10 +45,20 @@ public IProcessingInfo<IMassSpectra> convert(File file, IProgressMonitor monitor
if(massSpectra != null && !massSpectra.isEmpty()) {
processingInfo.setProcessingResult(massSpectra);
} else {
processingInfo.addErrorMessage(DESCRIPTION, "No mass spectra are stored in" + file.getAbsolutePath());
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.noMassSpectraStored, file.getAbsolutePath()));
}
} catch(FileNotFoundException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotFound, file.getAbsolutePath()));
} catch(FileIsNotReadableException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.fileNotReadable, file.getAbsolutePath()));
} catch(FileIsEmptyException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.emptyFile, file.getAbsolutePath()));
} catch(IOException e) {
processingInfo.addErrorMessage(DESCRIPTION, "Error reading file: " + file.getAbsolutePath(), e);
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, NLS.bind(ConverterMessages.failedToReadFile, file.getAbsolutePath()));
}
return processingInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.chemclipse.converter;bundle-version="0.8.0",
org.eclipse.chemclipse.model;bundle-version="0.8.0",
org.eclipse.chemclipse.support;bundle-version="0.8.0",
org.apache.commons.commons-codec;bundle-version="1.16.0"
org.apache.commons.commons-codec;bundle-version="1.16.0",
org.apache.commons.lang3;bundle-version="3.13.0"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Import-Package: org.apache.commons.lang3.tuple;version="3.1.0",
org.eclipse.chemclipse.xxd.converter.supplier.io.exception
Loading
Loading