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 basic read support for RDML #1537

Merged
merged 2 commits into from
Oct 26, 2023
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>org.eclipse.chemclipse.pcr.converter.supplier.rdml.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,2 @@
eclipse.preferences.version=1
encoding/<project>=utf8
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.pcr.converter.supplier.rdml.feature"
label="RDML Converter"
version="0.9.0.qualifier"
provider-name="ChemClipse"
plugin="org.eclipse.chemclipse.feature.branding"
license-feature="org.eclipse.license"
license-feature-version="1.0.0.qualifier">

<description url="http://www.chemclipse.net/">
This is the Real-Time PCR Data Markup Language qPCR converter.
</description>

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

<license url="%licenseURL">
%license
</license>

<url>
<discovery label="RDML" url="http://rdml.org/"/>
</url>

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

</feature>
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,8 @@
id="org.eclipse.chemclipse.chromatogram.xxd.report.supplier.image.feature"
version="0.0.0"/>

<includes
id="org.eclipse.chemclipse.pcr.converter.supplier.rdml.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-17"/>
<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.pcr.converter.supplier.rdml</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,2 @@
eclipse.preferences.version=1
encoding/<project>=utf8
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=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=17
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.chemclipse.pcr.converter.supplier.rdml
Bundle-ManifestVersion: 2
Bundle-Name: RDML PCR Converter
Bundle-SymbolicName: org.eclipse.chemclipse.pcr.converter.supplier.rdml;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.eclipse.chemclipse.pcr.converter.supplier.rdml.Activator
Bundle-Vendor: ChemClipse
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.chemclipse.converter;bundle-version="0.8.0",
org.eclipse.chemclipse.pcr.converter;bundle-version="0.8.0",
org.eclipse.chemclipse.model;bundle-version="0.8.0",
org.eclipse.chemclipse.pcr.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.support;bundle-version="0.8.0",
jakarta.xml.bind-api;bundle-version="4.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Import-Package: jakarta.xml.bind,
jakarta.xml.bind.annotation,
jakarta.xml.bind.annotation.adapters
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/,\
.,\
OSGI-INF/,\
plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.chemclipse.pcr.converter.plateSupplier">
<PlateSupplier
description="Reads Real-time PCR Data Markup Language (RDML) qPCR experiments."
exportConverter="org.eclipse.chemclipse.pcr.converter.supplier.rdml.core.PCRExportConverter"
fileExtension=".rdml"
fileName=""
filterName="qPCR experiments (*.rdml)"
id="org.eclipse.chemclipse.pcr.converter.supplier.rdml"
importConverter="org.eclipse.chemclipse.pcr.converter.supplier.rdml.core.PCRImportConverter"
importMagicNumberMatcher="org.eclipse.chemclipse.pcr.converter.supplier.rdml.core.MagicNumberMatcher"
isExportable="false"
isImportable="true">
</PlateSupplier>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2023 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.pcr.converter.supplier.rdml;

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

@Override
public void start(BundleContext bundleContext) throws Exception {

Activator.context = bundleContext;
}

@Override
public void stop(BundleContext bundleContext) throws Exception {

Activator.context = null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2016, 2023 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
* Dr. Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.pcr.converter.supplier.rdml;

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/test.rdml
*
* @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();
} catch(IOException e) {
e.printStackTrace();
}
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2023 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.pcr.converter.supplier.rdml.core;

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, ".rdml");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2023 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.pcr.converter.supplier.rdml.core;

import java.io.File;

import org.eclipse.chemclipse.pcr.converter.core.AbstractPlateExportConverter;
import org.eclipse.chemclipse.pcr.converter.core.IPlateExportConverter;
import org.eclipse.chemclipse.pcr.model.core.IPlate;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public class PCRExportConverter extends AbstractPlateExportConverter implements IPlateExportConverter {

private static IPlateExportConverter instance = null;

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

throw new UnsupportedOperationException();
}

public static IPlateExportConverter getInstance() {

if(instance == null) {
instance = new PCRExportConverter();
}
return instance;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*******************************************************************************
* Copyright (c) 2023 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.pcr.converter.supplier.rdml.core;

import java.io.File;
import java.io.IOException;
import java.security.InvalidParameterException;

import javax.xml.parsers.ParserConfigurationException;

import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.pcr.converter.core.AbstractPlateImportConverter;
import org.eclipse.chemclipse.pcr.converter.core.IPlateImportConverter;
import org.eclipse.chemclipse.pcr.converter.supplier.rdml.io.PCRReader;
import org.eclipse.chemclipse.pcr.model.core.IPlate;
import org.eclipse.chemclipse.processing.core.IProcessingInfo;
import org.eclipse.core.runtime.IProgressMonitor;
import org.xml.sax.SAXException;

import jakarta.xml.bind.JAXBException;

public class PCRImportConverter extends AbstractPlateImportConverter implements IPlateImportConverter {

private static final Logger logger = Logger.getLogger(PCRImportConverter.class);
private static final String DESCRIPTION = "RDML Converter";
private static IPlateImportConverter instance = null;

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

IProcessingInfo<IPlate> processingInfo = super.validate(file);
if(!processingInfo.hasErrorMessages()) {
PCRReader qPCR = new PCRReader();
try {
IPlate plate = qPCR.read(file);
processingInfo.setProcessingResult(plate);
} catch(IOException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file: " + file.getAbsolutePath(), e);
} catch(SAXException | JAXBException
| ParserConfigurationException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Failed to read file contents: " + file.getAbsolutePath(), e);
} catch(InvalidParameterException e) {
logger.warn(e);
processingInfo.addErrorMessage(DESCRIPTION, "Unsupported data in file: " + file.getAbsolutePath(), e);
}
}
return processingInfo;
}

public static IPlateImportConverter getInstance() {

if(instance == null) {
instance = new PCRImportConverter();
}
return instance;
}
}
Loading