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 AnIML plotting hints #206

Merged
merged 2 commits into from
Feb 10, 2022
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 @@ -44,6 +44,7 @@
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterTypeType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.PlotScaleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleType;
Expand Down Expand Up @@ -134,6 +135,7 @@ private ResultType createResult(IChromatogramCSD chromatogram) {
retentionTimeSeries.setUnit(retentionTimeUnit);
retentionTimeSeries.setDependency(DependencyType.INDEPENDENT);
retentionTimeSeries.setSeriesType(ParameterTypeType.FLOAT_32);
retentionTimeSeries.setPlotScale(PlotScaleType.LINEAR);
//
SeriesType totalSignalSeries = new SeriesType();
totalSignalSeries.setSeriesID("TOTAL_SIGNAL");
Expand All @@ -144,6 +146,7 @@ private ResultType createResult(IChromatogramCSD chromatogram) {
totalSignalSeries.setUnit(totalSignalUnit);
totalSignalSeries.setDependency(DependencyType.DEPENDENT);
totalSignalSeries.setSeriesType(ParameterTypeType.FLOAT_32);
totalSignalSeries.setPlotScale(PlotScaleType.LINEAR);
//
if(PreferenceSupplier.getChromatogramSaveEncoded()) {
int scans = chromatogram.getNumberOfScans();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterTypeType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.PlotScaleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleType;
Expand Down Expand Up @@ -151,6 +152,7 @@ private List<ResultType> createMS(IChromatogramMSD chromatogram) {
massChargeSeries.setUnit(massChargeUnit);
massChargeSeries.setDependency(DependencyType.DEPENDENT);
massChargeSeries.setSeriesType(ParameterTypeType.FLOAT_64);
massChargeSeries.setPlotScale(PlotScaleType.LINEAR);
//
SeriesType intensitySeries = new SeriesType();
intensitySeries.setSeriesID("INTENSITY");
Expand All @@ -159,8 +161,9 @@ private List<ResultType> createMS(IChromatogramMSD chromatogram) {
intensityUnit.setLabel("Abundance");
intensityUnit.setQuantity("arbitrary");
intensitySeries.setUnit(intensityUnit);
massChargeSeries.setDependency(DependencyType.DEPENDENT);
massChargeSeries.setSeriesType(ParameterTypeType.FLOAT_32);
intensitySeries.setDependency(DependencyType.DEPENDENT);
intensitySeries.setSeriesType(ParameterTypeType.FLOAT_32);
intensitySeries.setPlotScale(PlotScaleType.LINEAR);
//
if(PreferenceSupplier.getChromatogramSaveEncoded()) {
int scans = scanMSD.getNumberOfIons();
Expand Down Expand Up @@ -214,6 +217,7 @@ private ResultType createTIC(IChromatogramMSD chromatogram) {
retentionTimeSeries.setUnit(retentionTimeUnit);
retentionTimeSeries.setDependency(DependencyType.INDEPENDENT);
retentionTimeSeries.setSeriesType(ParameterTypeType.INT_32);
retentionTimeSeries.setPlotScale(PlotScaleType.LINEAR);
//
SeriesType totalSignalSeries = new SeriesType();
totalSignalSeries.setSeriesID("TOTAL_SIGNAL");
Expand All @@ -224,6 +228,7 @@ private ResultType createTIC(IChromatogramMSD chromatogram) {
totalSignalSeries.setUnit(totalSignalUnit);
totalSignalSeries.setDependency(DependencyType.DEPENDENT);
totalSignalSeries.setSeriesType(ParameterTypeType.FLOAT_32);
totalSignalSeries.setPlotScale(PlotScaleType.LINEAR);
//
if(PreferenceSupplier.getChromatogramSaveEncoded()) {
int scans = chromatogram.getNumberOfScans();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 Lablicate GmbH.
* Copyright (c) 2021, 2022 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
Expand All @@ -19,6 +19,7 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import org.apache.commons.io.FilenameUtils;
import org.eclipse.chemclipse.converter.exceptions.FileIsNotWriteableException;
import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.msd.converter.io.IMassSpectraWriter;
Expand All @@ -34,12 +35,15 @@
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AuditTrailEntrySetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AuditTrailEntryType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.CategoryType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.DependencyType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.EncodedValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ExperimentStepSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ExperimentStepType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.MethodType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterTypeType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.PlotScaleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SampleType;
Expand Down Expand Up @@ -95,6 +99,7 @@ private void writeAnIML(FileWriter fileWriter, IVendorMassSpectrum massSpectrum)
Marshaller marshaller = jaxbContext.createMarshaller();
//
AnIMLType anIML = new AnIMLType();
anIML.setVersion("0.90");
anIML.setSampleSet(createSampleSet(massSpectrum));
anIML.setExperimentStepSet(createExperimentStep(massSpectrum));
anIML.setAuditTrailEntrySet(createAuditTrail());
Expand All @@ -105,8 +110,10 @@ private SampleSetType createSampleSet(IVendorMassSpectrum massSpectrum) {

SampleSetType sampleSet = new SampleSetType();
SampleType sample = new SampleType();
sample.setId("OPENCHROM_MASS_SPECTRUM_EXPORT");
sample.setName(massSpectrum.getName());
sample.setSampleID(massSpectrum.getIdentifier());
sample.setComment(massSpectrum.getIdentifier());
sample.setSampleID(FilenameUtils.removeExtension(massSpectrum.getFile().getName()));
sample.setSourceDataLocation(massSpectrum.getFile().getAbsolutePath());
sampleSet.getSample().add(sample);
return sampleSet;
Expand All @@ -116,6 +123,8 @@ private ExperimentStepSetType createExperimentStep(IVendorMassSpectrum massSpect

ExperimentStepSetType experimentStepSet = new ExperimentStepSetType();
ExperimentStepType massSpecStep = new ExperimentStepType();
massSpecStep.setName("Mass Spectrometry");
massSpecStep.setId("MASS_SPECTROMETRY");
massSpecStep.setTechnique(createMassSpecTechnique());
massSpecStep.getResult().add(createResult(massSpectrum));
massSpecStep.setMethod(createMethod());
Expand All @@ -139,17 +148,24 @@ private ResultType createResult(IVendorMassSpectrum massSpectrum) {
//
SeriesType massChargeSeries = new SeriesType();
massChargeSeries.setName("Mass/Charge");
massChargeSeries.setSeriesID("MASS_CHARGE");
UnitType massChargeUnit = new UnitType();
massChargeUnit.setLabel("Mass/Charge Ratio");
massChargeUnit.setQuantity("mz");
massChargeSeries.setUnit(massChargeUnit);
massChargeSeries.setDependency(DependencyType.INDEPENDENT);
massChargeSeries.setSeriesType(ParameterTypeType.FLOAT_64);
massChargeSeries.setPlotScale(PlotScaleType.LINEAR);
//
SeriesType intensitySeries = new SeriesType();
intensitySeries.setName("Intensity");
UnitType intensityUnit = new UnitType();
intensityUnit.setLabel("Abundance");
intensityUnit.setQuantity("arbitrary");
intensitySeries.setUnit(intensityUnit);
intensitySeries.setDependency(DependencyType.DEPENDENT);
intensitySeries.setSeriesType(ParameterTypeType.FLOAT_32);
intensitySeries.setPlotScale(PlotScaleType.LINEAR);
//
if(PreferenceSupplier.getMassSpectrumSaveEncoded()) {
int scans = massSpectrum.getNumberOfIons();
Expand Down Expand Up @@ -186,8 +202,9 @@ private ResultType createResult(IVendorMassSpectrum massSpectrum) {
parameter.setName("Type");
if(massSpectrum.getMassSpectrumType() == 0) {
parameter.getS().add("Centroided");
} else
} else {
parameter.getS().add("Continuous");
}
category.getParameter().add(parameter);
result.getCategory().add(category);
result.setSeriesSet(seriesSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.DependencyType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.IndividualValueSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ParameterTypeType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.PlotScaleType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.ResultType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesSetType;
import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesType;
Expand All @@ -38,6 +39,11 @@

public class Common {

private Common() {

// only static access
}

public static SoftwareType createSoftware() {

SoftwareType software = new SoftwareType();
Expand All @@ -62,21 +68,25 @@ public static ResultType createPeaks(IChromatogram chromatogram) {
numberSeries.setSeriesID("NUMBER");
numberSeries.setName("Number");
numberSeries.setSeriesType(ParameterTypeType.INT_32);
numberSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType idSeries = new SeriesType();
idSeries.setSeriesID("ID");
idSeries.setName("ID");
idSeries.setSeriesType(ParameterTypeType.STRING);
idSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType groupIdSeries = new SeriesType();
groupIdSeries.setSeriesID("GROUP_ID");
groupIdSeries.setName("Group ID");
groupIdSeries.setSeriesType(ParameterTypeType.STRING);
groupIdSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType nameSeries = new SeriesType();
nameSeries.setSeriesID("NAME");
nameSeries.setName("Name");
nameSeries.setSeriesType(ParameterTypeType.STRING);
nameSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType retentionTimeSeries = new SeriesType();
retentionTimeSeries.setSeriesID("RETENTION_TIME");
Expand All @@ -87,6 +97,7 @@ public static ResultType createPeaks(IChromatogram chromatogram) {
retentionTimeSeries.setUnit(retentionTimeUnit);
retentionTimeSeries.setSeriesType(ParameterTypeType.FLOAT_32);
retentionTimeSeries.setDependency(DependencyType.INDEPENDENT);
retentionTimeSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType adjustedRetentionTimeSeries = new SeriesType();
adjustedRetentionTimeSeries.setSeriesID("ADJUSTED_RETENTION_TIME");
Expand All @@ -97,6 +108,7 @@ public static ResultType createPeaks(IChromatogram chromatogram) {
adjustedRetentionTimeSeries.setUnit(adjustedRetentionTimeUnit);
adjustedRetentionTimeSeries.setSeriesType(ParameterTypeType.FLOAT_32);
adjustedRetentionTimeSeries.setDependency(DependencyType.DEPENDENT);
adjustedRetentionTimeSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType startTimeSeries = new SeriesType();
startTimeSeries.setSeriesID("START_TIME");
Expand All @@ -107,6 +119,7 @@ public static ResultType createPeaks(IChromatogram chromatogram) {
startTimeSeries.setUnit(startTimeUnit);
startTimeSeries.setSeriesType(ParameterTypeType.FLOAT_32);
startTimeSeries.setDependency(DependencyType.DEPENDENT);
startTimeSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType endTimeSeries = new SeriesType();
endTimeSeries.setName("End Time");
Expand All @@ -116,6 +129,7 @@ public static ResultType createPeaks(IChromatogram chromatogram) {
endTimeSeries.setUnit(endTimeUnit);
endTimeSeries.setSeriesType(ParameterTypeType.FLOAT_32);
endTimeSeries.setDependency(DependencyType.DEPENDENT);
endTimeSeries.setPlotScale(PlotScaleType.NONE);
//
SeriesType peakHeightSeries = new SeriesType();
peakHeightSeries.setName("Value");
Expand All @@ -125,6 +139,7 @@ public static ResultType createPeaks(IChromatogram chromatogram) {
peakHeightSeries.setUnit(peakHeightUnit);
peakHeightSeries.setSeriesType(ParameterTypeType.FLOAT_32);
peakHeightSeries.setDependency(DependencyType.DEPENDENT);
peakHeightSeries.setPlotScale(PlotScaleType.NONE);
//
IndividualValueSetType numbers = new IndividualValueSetType();
IndividualValueSetType ids = new IndividualValueSetType();
Expand Down