From ddcde6af80030cd833a623f10b59fb1206c9312b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 19 Dec 2023 21:33:58 +0100 Subject: [PATCH] Use sample name API. --- .../supplier/animl/io/ChromatogramReader.java | 2 +- .../supplier/animl/io/ChromatogramWriter.java | 11 ++++++----- .../supplier/animl/io/ChromatogramReader.java | 5 +++-- .../supplier/animl/io/ChromatogramWriter.java | 9 +++++---- .../supplier/animl/io/MassSpectrumWriter.java | 13 +++++++------ .../supplier/mzdb/io/ChromatogramReader.java | 2 +- .../supplier/abif/io/ChromatogramReader.java | 2 +- .../supplier/animl/io/ChromatogramReader.java | 2 +- .../supplier/animl/io/ChromatogramWriter.java | 4 ++-- .../internal/runnables/NCBIqueuedBLASTRunnable.java | 4 ++-- .../converter/supplier/abif/io/EmptyFile_ITest.java | 4 ++-- 11 files changed, 31 insertions(+), 27 deletions(-) diff --git a/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramReader.java b/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramReader.java index a242aafd3..0041e1f1b 100644 --- a/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramReader.java +++ b/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramReader.java @@ -199,7 +199,7 @@ public IChromatogramOverview readOverview(File file, IProgressMonitor monitor) t private IVendorChromatogram readSample(AnIMLType animl, IVendorChromatogram chromatogram) { SampleType sample = animl.getSampleSet().getSample().get(0); - chromatogram.setDataName(sample.getName()); + chromatogram.setSampleName(sample.getName()); chromatogram.setBarcode(sample.getBarcode()); chromatogram.setDetailedInfo(sample.getSampleID()); chromatogram.setMiscInfo(sample.getComment()); diff --git a/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramWriter.java b/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramWriter.java index cd5c9aca3..bae36f6c2 100644 --- a/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramWriter.java +++ b/openchrom/plugins/net.openchrom.csd.converter.supplier.animl/src/net/openchrom/csd/converter/supplier/animl/io/ChromatogramWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Lablicate GmbH. + * Copyright (c) 2021, 2023 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -27,9 +27,6 @@ import org.eclipse.chemclipse.support.history.IEditInformation; import org.eclipse.core.runtime.IProgressMonitor; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Marshaller; import net.openchrom.xxd.converter.supplier.animl.internal.converter.BinaryReader; import net.openchrom.xxd.converter.supplier.animl.internal.converter.Common; import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AnIMLType; @@ -54,6 +51,10 @@ import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.UnitType; import net.openchrom.xxd.converter.supplier.animl.preferences.PreferenceSupplier; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; + public class ChromatogramWriter extends AbstractChromatogramCSDWriter { private static final Logger logger = Logger.getLogger(ChromatogramWriter.class); @@ -83,7 +84,7 @@ private SampleSetType createSampleSet(IChromatogramCSD chromatogram) { SampleSetType sampleSet = new SampleSetType(); SampleType sample = new SampleType(); sample.setId("OPENCHROM_CSD_EXPORT"); - sample.setName(chromatogram.getHeaderDataOrDefault("Sample Name", chromatogram.getDataName())); + sample.setName(chromatogram.getSampleName()); sample.setBarcode(chromatogram.getBarcode()); sample.setComment(chromatogram.getMiscInfo()); sample.setSampleID(FilenameUtils.removeExtension(chromatogram.getFile().getName())); diff --git a/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramReader.java b/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramReader.java index 354d4a902..ab4773582 100644 --- a/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramReader.java +++ b/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramReader.java @@ -41,7 +41,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.xml.sax.SAXException; -import jakarta.xml.bind.JAXBException; import net.openchrom.msd.converter.supplier.animl.model.IVendorChromatogram; import net.openchrom.msd.converter.supplier.animl.model.IVendorIon; import net.openchrom.msd.converter.supplier.animl.model.IVendorScan; @@ -62,6 +61,8 @@ import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.SeriesType; import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.UnitType; +import jakarta.xml.bind.JAXBException; + public class ChromatogramReader extends AbstractChromatogramMSDReader { private static final Logger logger = Logger.getLogger(ChromatogramReader.class); @@ -273,7 +274,7 @@ public IChromatogramOverview readOverview(File file, IProgressMonitor monitor) t private IVendorChromatogram readSample(AnIMLType animl, IVendorChromatogram chromatogram) { SampleType sample = animl.getSampleSet().getSample().get(0); - chromatogram.setDataName(sample.getName()); + chromatogram.setSampleName(sample.getName()); chromatogram.setBarcode(sample.getBarcode()); chromatogram.setDetailedInfo(sample.getSampleID()); chromatogram.setMiscInfo(sample.getComment()); diff --git a/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramWriter.java b/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramWriter.java index fb388aa82..26e7e37e9 100644 --- a/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramWriter.java +++ b/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/ChromatogramWriter.java @@ -31,9 +31,6 @@ import org.eclipse.chemclipse.support.history.IEditInformation; import org.eclipse.core.runtime.IProgressMonitor; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Marshaller; import net.openchrom.xxd.converter.supplier.animl.internal.converter.BinaryReader; import net.openchrom.xxd.converter.supplier.animl.internal.converter.Common; import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AnIMLType; @@ -60,6 +57,10 @@ import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.UnitType; import net.openchrom.xxd.converter.supplier.animl.preferences.PreferenceSupplier; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; + public class ChromatogramWriter extends AbstractChromatogramMSDWriter { private static final Logger logger = Logger.getLogger(ChromatogramWriter.class); @@ -89,7 +90,7 @@ private SampleSetType createSampleSet(IChromatogramMSD chromatogram) { SampleSetType sampleSet = new SampleSetType(); SampleType sample = new SampleType(); sample.setId("OPENCHROM_MSD_EXPORT"); - sample.setName(chromatogram.getHeaderDataOrDefault("Sample Name", chromatogram.getDataName())); + sample.setName(chromatogram.getSampleName()); sample.setBarcode(chromatogram.getBarcode()); sample.setComment(chromatogram.getMiscInfo()); sample.setSampleID(FilenameUtils.removeExtension(chromatogram.getFile().getName())); diff --git a/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/MassSpectrumWriter.java b/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/MassSpectrumWriter.java index 691670a1d..d883b49a9 100644 --- a/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/MassSpectrumWriter.java +++ b/openchrom/plugins/net.openchrom.msd.converter.supplier.animl/src/net/openchrom/msd/converter/supplier/animl/io/MassSpectrumWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Lablicate GmbH. + * Copyright (c) 2021, 2023 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -26,9 +26,6 @@ import org.eclipse.chemclipse.msd.model.core.IVendorStandaloneMassSpectrum; import org.eclipse.core.runtime.IProgressMonitor; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.Marshaller; import net.openchrom.xxd.converter.supplier.animl.internal.converter.BinaryReader; import net.openchrom.xxd.converter.supplier.animl.internal.converter.Common; import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.AnIMLType; @@ -54,6 +51,10 @@ import net.openchrom.xxd.converter.supplier.animl.internal.model.astm.core.UnitType; import net.openchrom.xxd.converter.supplier.animl.preferences.PreferenceSupplier; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; + public class MassSpectrumWriter implements IMassSpectraWriter { private static final Logger logger = Logger.getLogger(MassSpectrumWriter.class); @@ -114,7 +115,7 @@ private SampleSetType createSampleSet(IVendorStandaloneMassSpectrum massSpectrum SampleSetType sampleSet = new SampleSetType(); SampleType sample = new SampleType(); sample.setId("OPENCHROM_MASS_SPECTRUM_EXPORT"); - sample.setName(massSpectrum.getName()); + sample.setName(massSpectrum.getSampleName()); sample.setComment(massSpectrum.getIdentifier()); sample.setSampleID(FilenameUtils.removeExtension(massSpectrum.getFile().getName())); sample.setSourceDataLocation(massSpectrum.getFile().getAbsolutePath()); @@ -228,4 +229,4 @@ private AuditTrailEntrySetType createAuditTrail() { auditTrail.setSoftware(Common.createSoftware()); return auditTrailEntrySet; } -} \ No newline at end of file +} diff --git a/openchrom/plugins/net.openchrom.msd.converter.supplier.mzdb/src/net/openchrom/msd/converter/supplier/mzdb/io/ChromatogramReader.java b/openchrom/plugins/net.openchrom.msd.converter.supplier.mzdb/src/net/openchrom/msd/converter/supplier/mzdb/io/ChromatogramReader.java index c85b742fa..c0c788a7c 100644 --- a/openchrom/plugins/net.openchrom.msd.converter.supplier.mzdb/src/net/openchrom/msd/converter/supplier/mzdb/io/ChromatogramReader.java +++ b/openchrom/plugins/net.openchrom.msd.converter.supplier.mzdb/src/net/openchrom/msd/converter/supplier/mzdb/io/ChromatogramReader.java @@ -79,7 +79,7 @@ public IChromatogramMSD read(File file, IProgressMonitor monitor) throws IOExcep // ResultSet nameResultSet = statement.executeQuery("SELECT name FROM sample;"); String sampleName = nameResultSet.getString(1); - chromatogram.setDataName(sampleName); + chromatogram.setSampleName(sampleName); nameResultSet.close(); // ResultSet dataProcessingSet = statement.executeQuery("SELECT name FROM data_processing ORDER BY id;"); diff --git a/openchrom/plugins/net.openchrom.wsd.converter.supplier.abif/src/net/openchrom/wsd/converter/supplier/abif/io/ChromatogramReader.java b/openchrom/plugins/net.openchrom.wsd.converter.supplier.abif/src/net/openchrom/wsd/converter/supplier/abif/io/ChromatogramReader.java index 600a2cedc..f9d13957f 100644 --- a/openchrom/plugins/net.openchrom.wsd.converter.supplier.abif/src/net/openchrom/wsd/converter/supplier/abif/io/ChromatogramReader.java +++ b/openchrom/plugins/net.openchrom.wsd.converter.supplier.abif/src/net/openchrom/wsd/converter/supplier/abif/io/ChromatogramReader.java @@ -178,7 +178,7 @@ private IChromatogramWSD readChromatogram(File file, IProgressMonitor monitor) t // Pascal style string (length is stored in first byte) int length = in.read1BShortBE(); String sampleName = in.readBytesAsString(length); - chromatogram.setDataName(sampleName); + chromatogram.setSampleName(sampleName); in.resetPosition(); in.seek(position); break; diff --git a/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramReader.java b/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramReader.java index 190c41129..2e494e97a 100644 --- a/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramReader.java +++ b/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramReader.java @@ -153,7 +153,7 @@ public IChromatogramOverview readOverview(File file, IProgressMonitor monitor) t private IVendorChromatogram readSample(AnIMLType animl, IVendorChromatogram chromatogram) { SampleType sample = animl.getSampleSet().getSample().get(0); - chromatogram.setDataName(sample.getName()); + chromatogram.setSampleName(sample.getName()); chromatogram.setBarcode(sample.getBarcode()); chromatogram.setDetailedInfo(sample.getSampleID()); chromatogram.setMiscInfo(sample.getComment()); diff --git a/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramWriter.java b/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramWriter.java index 9b8e4fd71..11cf7ff0f 100644 --- a/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramWriter.java +++ b/openchrom/plugins/net.openchrom.wsd.converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/io/ChromatogramWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Lablicate GmbH. + * Copyright (c) 2021, 2023 Lablicate GmbH. * * All rights reserved. * This program and the accompanying materials are made available under the @@ -93,7 +93,7 @@ private SampleSetType createSampleSet(IChromatogramWSD chromatogram) { SampleSetType sampleSet = new SampleSetType(); SampleType sample = new SampleType(); sample.setId("OPENCHROM_WSD_EXPORT"); - sample.setName(chromatogram.getHeaderDataOrDefault("Sample Name", chromatogram.getDataName())); + sample.setName(chromatogram.getSampleName()); sample.setBarcode(chromatogram.getBarcode()); sample.setComment(chromatogram.getMiscInfo()); sample.setSampleID(FilenameUtils.removeExtension(chromatogram.getFile().getName())); diff --git a/openchrom/plugins/net.openchrom.wsd.identifier.supplier.geneident.ui/src/net/openchrom/wsd/identifier/supplier/geneident/ui/internal/runnables/NCBIqueuedBLASTRunnable.java b/openchrom/plugins/net.openchrom.wsd.identifier.supplier.geneident.ui/src/net/openchrom/wsd/identifier/supplier/geneident/ui/internal/runnables/NCBIqueuedBLASTRunnable.java index cf5165aaa..4925bf064 100644 --- a/openchrom/plugins/net.openchrom.wsd.identifier.supplier.geneident.ui/src/net/openchrom/wsd/identifier/supplier/geneident/ui/internal/runnables/NCBIqueuedBLASTRunnable.java +++ b/openchrom/plugins/net.openchrom.wsd.identifier.supplier.geneident.ui/src/net/openchrom/wsd/identifier/supplier/geneident/ui/internal/runnables/NCBIqueuedBLASTRunnable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2023 Matthias Mailänder. + * 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 @@ -79,7 +79,7 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte InputStream in = service.getAlignmentResults(requestID, outputProps); reader = new BufferedReader(new InputStreamReader(in)); // Write BLAST output to specified file. - String sampleName = chromtogram.getDataName(); + String sampleName = chromtogram.getSampleName(); File file = File.createTempFile(sampleName + "_" + requestID, ".txt"); StatusLineLogger.setInfo(InfoType.MESSAGE, "Saving query results in file " + file.getAbsolutePath()); writer = new FileWriter(file); diff --git a/openchrom/tests/net.openchrom.wsd.converter.supplier.abif.fragment.test/src/net/openchrom/wsd/converter/supplier/abif/io/EmptyFile_ITest.java b/openchrom/tests/net.openchrom.wsd.converter.supplier.abif.fragment.test/src/net/openchrom/wsd/converter/supplier/abif/io/EmptyFile_ITest.java index 2deba5b6f..ef7dd03bd 100644 --- a/openchrom/tests/net.openchrom.wsd.converter.supplier.abif.fragment.test/src/net/openchrom/wsd/converter/supplier/abif/io/EmptyFile_ITest.java +++ b/openchrom/tests/net.openchrom.wsd.converter.supplier.abif.fragment.test/src/net/openchrom/wsd/converter/supplier/abif/io/EmptyFile_ITest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2018 Matthias Mailänder. + * 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 @@ -42,6 +42,6 @@ public void testEmptySequence() { public void testSampleName() { - assertEquals("226041_C-ME-19_pCAGseqF", chromatogram.getDataName()); + assertEquals("226041_C-ME-19_pCAGseqF", chromatogram.getSampleName()); } }