Skip to content

Commit

Permalink
Use sample name API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Dec 19, 2023
1 parent c55b1d7 commit ddcde6a
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -228,4 +229,4 @@ private AuditTrailEntrySetType createAuditTrail() {
auditTrail.setSoftware(Common.createSoftware());
return auditTrailEntrySet;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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());
}
}

0 comments on commit ddcde6a

Please sign in to comment.