Skip to content

Commit

Permalink
Merge pull request #911 from Mailaender/mmass-msd
Browse files Browse the repository at this point in the history
Added an import converter for mMass .msd files
  • Loading branch information
eselmeister authored Feb 21, 2022
2 parents 1c9e44b + cb19533 commit 82a5d7f
Show file tree
Hide file tree
Showing 28 changed files with 771 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.chemclipse.msd.converter.supplier.mmass.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin.includes = feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.chemclipse.msd.converter.supplier.mmass.feature"
label="mMass Converter"
version="0.9.0.qualifier"
provider-name="ChemClipse"
plugin="org.eclipse.chemclipse.feature.branding">

<description url="http://www.mmass.org/">
This is the mMass .msd file converter.
</description>

<copyright url="http://www.chemclipse.net/">
Copyright (c) 2022 Lablicate GmbH.
</copyright>

<license url="http://www.eclipse.org/legal/epl-v10.html">
Copyright (c) 2022 Lablicate GmbH.

All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License
v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
</license>

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

</feature>
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.chemclipse.msd.converter.supplier.mzml.feature"
label="MSD mzML"
label="mzML Converter"
version="0.9.0.qualifier"
provider-name="ChemClipse" plugin="org.eclipse.chemclipse.feature.branding">
provider-name="ChemClipse"
plugin="org.eclipse.chemclipse.feature.branding">

<description url="http://www.chemclipse.net/plugins/converter/mzml/">
This is the mzML chromatogram converter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
id="org.eclipse.chemclipse.rcp.app.compilation.core.feature"
label="ChemClipse Core"
version="0.9.0.qualifier"
provider-name="ChemClipse" plugin="org.eclipse.chemclipse.feature.branding">
provider-name="ChemClipse"
plugin="org.eclipse.chemclipse.feature.branding">

<description url="http://www.chemclipse.net">
This is the ChemClipse core feature.
Expand Down Expand Up @@ -232,18 +233,18 @@ http://www.eclipse.org/legal/epl-v10.html
<includes
id="org.eclipse.chemclipse.msd.classifier.supplier.molpeak.feature"
version="0.0.0"/>

<includes
id="org.eclipse.chemclipse.xxd.converter.supplier.ascii.feature"
version="0.0.0"/>

<includes
id="org.eclipse.chemclipse.csd.converter.supplier.arw.feature"
version="0.0.0"/>

<includes
id="org.eclipse.chemclipse.wsd.converter.supplier.arw.feature"
version="0.0.0"/>
version="0.0.0"/>

<includes
id="org.eclipse.chemclipse.xxd.converter.supplier.zip.feature"
Expand All @@ -269,4 +270,8 @@ http://www.eclipse.org/legal/epl-v10.html
id="org.eclipse.chemclipse.msd.converter.supplier.sirius.feature"
version="0.0.0"/>

<includes
id="org.eclipse.chemclipse.msd.converter.supplier.mmass.feature"
version="0.0.0"/>

</feature>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.chemclipse.msd.converter.supplier.mmass</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.chemclipse.msd.converter.supplier.mzml
Eclipse-RegisterBuddy: org.eclipse.chemclipse.model, org.eclipse.chemclipse.msd.model
Bundle-ManifestVersion: 2
Bundle-Name: mMass Converter
Bundle-SymbolicName: org.eclipse.chemclipse.msd.converter.supplier.mmass;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.eclipse.chemclipse.msd.converter.supplier.mmass.Activator
Bundle-Vendor: ChemClipse
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.chemclipse.msd.converter;bundle-version="0.8.0",
org.eclipse.chemclipse.msd.model;bundle-version="0.8.0",
org.eclipse.chemclipse.logging;bundle-version="0.8.0",
org.eclipse.chemclipse.processing;bundle-version="0.8.0",
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.codec;bundle-version="1.9.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: org.apache.commons.lang3.tuple;version="3.1.0",
org.eclipse.chemclipse.xxd.converter.supplier.io.exception
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#Properties file
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.chemclipse.msd.converter.massSpectrumSupplier">
<MassSpectrumSupplier
description="Reads mMass .msd Mass Spectra"
exportConverter="org.eclipse.chemclipse.msd.converter.supplier.mmass.converter.MassSpectrumExportConverter"
fileExtension=".msd"
filterName="mMass Mass Spectrum (*.msd)"
id="org.eclipse.chemclipse.msd.converter.supplier.mmass"
importConverter="org.eclipse.chemclipse.msd.converter.supplier.mmass.converter.MassSpectrumImportConverter"
importMagicNumberMatcher="org.eclipse.chemclipse.msd.converter.supplier.mmass.converter.MassSpectrumMagicNumberMatcher"
isExportable="false"
isImportable="true">
</MassSpectrumSupplier>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2013, 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Dr. Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.msd.converter.supplier.mmass;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

private static BundleContext context;

public static BundleContext getContext() {

return context;
}

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {

Activator.context = bundleContext;
}

/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {

Activator.context = null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Matthias Mailänder - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.msd.converter.supplier.mmass.converter;

import java.io.File;

import org.eclipse.chemclipse.msd.converter.massspectrum.AbstractMassSpectrumExportConverter;
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.msd.model.core.IScanMSD;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.chemclipse.processing.core.ProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public class MassSpectrumExportConverter extends AbstractMassSpectrumExportConverter {

private static final String DESCRIPTION = "mMass .msd Mass Spectra Export Converter";

@Override
public IProcessingInfo<IMassSpectra> convert(File file, IScanMSD massSpectrum, boolean append, IProgressMonitor monitor) {

return getProcessingInfo();
}

@Override
public IProcessingInfo<IMassSpectra> convert(File file, IMassSpectra massSpectra, boolean append, IProgressMonitor monitor) {

return getProcessingInfo();
}

private IProcessingInfo<IMassSpectra> getProcessingInfo() {

IProcessingInfo<IMassSpectra> processingInfo = new ProcessingInfo<>();
processingInfo.addErrorMessage(DESCRIPTION, "It's not possible to export mass spectra as mMass .msd yet.");
return processingInfo;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright (c) 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Matthias Mailänder - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.msd.converter.supplier.mmass.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.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraReader;
import org.eclipse.chemclipse.msd.converter.massspectrum.AbstractMassSpectrumImportConverter;
import org.eclipse.chemclipse.msd.converter.supplier.mmass.converter.io.MassSpectrumReader;
import org.eclipse.chemclipse.msd.model.core.IMassSpectra;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public class MassSpectrumImportConverter extends AbstractMassSpectrumImportConverter {

private static final Logger logger = Logger.getLogger(MassSpectrumImportConverter.class);
private static final String DESCRIPTION = "mMass .msd annotated Mass Spectrum Import";

@Override
public IProcessingInfo<IMassSpectra> convert(File file, IProgressMonitor monitor) {

IProcessingInfo<IMassSpectra> processingInfo = super.validate(file);
if(!processingInfo.hasErrorMessages()) {
try {
IMassSpectraReader massSpectraReader = new MassSpectrumReader();
IMassSpectra massSpectra = massSpectraReader.read(file, monitor);
if(massSpectra != null && massSpectra.size() > 0) {
processingInfo.setProcessingResult(massSpectra);
} else {
processingInfo.addErrorMessage(DESCRIPTION, "No mass spectra are stored." + file.getAbsolutePath());
}
} catch(FileNotFoundException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "The file couldn't be found: " + file.getAbsolutePath());
} catch(FileIsNotReadableException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "The file is not readable: " + file.getAbsolutePath());
} catch(FileIsEmptyException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "The file is empty: " + file.getAbsolutePath());
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has gone completely wrong: " + file.getAbsolutePath());
}
}
return processingInfo;
}
}
Loading

0 comments on commit 82a5d7f

Please sign in to comment.