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 support for reading .mzMLb chromatograms #126

Merged
merged 1 commit into from
Aug 3, 2021
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
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.openchrom.msd.converter.supplier.mzmlb.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,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="net.openchrom.msd.converter.supplier.mzmlb.feature"
label="mzMLb converter"
version="1.4.0.qualifier"
provider-name="OpenChrom"
plugin="net.openchrom.feature.branding">

<description url="http://www.openchrom.net">
This is the mzMLb chromatogram converter.
</description>

<copyright url="http://www.openchrom.net">
Copyright (c) 2014, 2021 Lablicate GmbH.
</copyright>

<license url="http://www.eclipse.org/legal/epl-v10.html">
Copyright (c) 2014, 2021 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>

<url>
<discovery label="mzMLb Converter" url="http://www.openchrom.net"/>
</url>

<plugin
id="net.openchrom.msd.converter.supplier.mzmlb"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="net.openchrom.msd.converter.supplier.mzmlb.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
4 changes: 4 additions & 0 deletions openchrom/features/net.openchrom.platform.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
id="net.openchrom.nmr.converter.supplier.nmrml.feature"
version="0.0.0"/>

<includes
id="net.openchrom.msd.converter.supplier.mzmlb.feature"
version="0.0.0"/>

<plugin
id="net.openchrom.rcp.compilation.community.ui"
download-size="0"
Expand Down
1 change: 1 addition & 0 deletions openchrom/features/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@
<module>net.openchrom.msd.converter.supplier.mz5.feature</module>
<module>net.openchrom.xxd.converter.supplier.gaml.feature</module>
<module>net.openchrom.nmr.converter.supplier.nmrml.feature</module>
<module>net.openchrom.msd.converter.supplier.mzmlb.feature</module>
</modules>
</project>
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>net.openchrom.msd.converter.supplier.mzmlb</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,24 @@
Manifest-Version: 1.0
Automatic-Module-Name: net.openchrom.msd.converter.supplier.mz5
Bundle-ManifestVersion: 2
Bundle-Name: mzMLb
Bundle-SymbolicName: net.openchrom.msd.converter.supplier.mzmlb;singleton:=true
Bundle-Version: 1.4.0.qualifier
Bundle-Activator: net.openchrom.msd.converter.supplier.mzmlb.Activator
Bundle-Vendor: OpenChrom
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",
net.openchrom.thirdpartylibraries.jhdf5,
org.eclipse.chemclipse.msd.converter.supplier.mzml
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: net.openchrom.msd.converter.supplier.mzmlb,
net.openchrom.msd.converter.supplier.mzmlb.converter,
net.openchrom.msd.converter.supplier.mzmlb.io,
net.openchrom.msd.converter.supplier.mzmlb.model
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
###############################################################################
# Copyright (c) 2015, 2017 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
###############################################################################
#Properties file
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.chemclipse.msd.converter.chromatogramSupplier">
<ChromatogramSupplier
description="Reads mzMLb Chromatograms"
fileExtension=".mzMLb"
filterName="mzML Chromatogram (*.mzMLb)"
id="net.openchrom.msd.converter.supplier.mzmlb"
importConverter="net.openchrom.msd.converter.supplier.mzmlb.converter.ChromatogramImportConverter"
importMagicNumberMatcher="net.openchrom.msd.converter.supplier.mzmlb.converter.MagicNumberMatcher"
isExportable="false"
isImportable="true">
</ChromatogramSupplier>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*******************************************************************************
* Copyright (c) 2014, 2021 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 net.openchrom.msd.converter.supplier.mzmlb;

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) 2014, 2021 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 net.openchrom.msd.converter.supplier.mzmlb;

import java.io.IOException;
import java.net.URL;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

public class PathResolver {

/**
* Returns a absolute path of the specified Folder. For example
* TESTDATA_IMPORT_EMPTY as an absolute Path:
* $PluginPath$/testData/files/data.mzMLb
*
* @param string
* @return String absolutePath
*/
public static String getAbsolutePath(String string) {

Bundle bundle = Platform.getBundle(Activator.getContext().getBundle().getSymbolicName());
IPath path = new Path(string);
URL url = FileLocator.find(bundle, path, null);
try {
return FileLocator.resolve(url).getPath().toString();
} catch(IOException e) {
e.printStackTrace();
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*******************************************************************************
* Copyright (c) 2013, 2021 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
* Christoph Läubrich - add generics
*******************************************************************************/
package net.openchrom.msd.converter.supplier.mzmlb.converter;

import java.io.File;

import org.eclipse.chemclipse.converter.chromatogram.AbstractChromatogramImportConverter;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.core.IChromatogramOverview;
import org.eclipse.chemclipse.msd.converter.io.IChromatogramMSDReader;
import org.eclipse.chemclipse.msd.model.core.IChromatogramMSD;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

import net.openchrom.msd.converter.supplier.mzmlb.internal.support.IConstants;
import net.openchrom.msd.converter.supplier.mzmlb.io.ChromatogramReader;

public class ChromatogramImportConverter extends AbstractChromatogramImportConverter<IChromatogramMSD> {

private static final Logger logger = Logger.getLogger(ChromatogramImportConverter.class);
private static final String DESCRIPTION = "mzMLb Import Converter";

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

IProcessingInfo<IChromatogramMSD> processingInfo = super.validate(file);
if(!processingInfo.hasErrorMessages()) {
/*
* Read the chromatogram.
*/
IChromatogramMSDReader reader = new ChromatogramReader();
monitor.subTask(IConstants.IMPORT_CHROMATOGRAM);
try {
IChromatogramMSD chromatogram = reader.read(file, monitor);
processingInfo.setProcessingResult(chromatogram);
} catch(Exception e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has definitely gone wrong with the file: " + file.getAbsolutePath());
}
}
return processingInfo;
}

@Override
public IProcessingInfo<IChromatogramOverview> convertOverview(File file, IProgressMonitor monitor) {

IProcessingInfo<IChromatogramOverview> processingInfo = super.validate(file);
if(!processingInfo.hasErrorMessages()) {
IChromatogramMSDReader reader = new ChromatogramReader();
monitor.subTask(IConstants.IMPORT_CHROMATOGRAM_OVERVIEW);
try {
IChromatogramOverview chromatogramOverview = reader.readOverview(file, monitor);
processingInfo.setProcessingResult(chromatogramOverview);
} catch(Exception e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Something has definitely gone wrong with the file: " + file.getAbsolutePath());
}
}
return processingInfo;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2021 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 net.openchrom.msd.converter.supplier.mzmlb.converter;

import java.io.File;

import org.eclipse.chemclipse.converter.core.AbstractMagicNumberMatcher;
import org.eclipse.chemclipse.converter.core.IMagicNumberMatcher;

public class MagicNumberMatcher extends AbstractMagicNumberMatcher implements IMagicNumberMatcher {

@Override
public boolean checkFileFormat(File file) {

return checkFileExtension(file, ".mzMLb");
}
}
Loading