-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Mailaender/mz5-perf
Improved performance of the mz5 chromatogram reader
- Loading branch information
Showing
10 changed files
with
473 additions
and
47 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...er.supplier.mz5/src/net/openchrom/msd/converter/supplier/mz5/internal/io/ProxyReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************* | ||
* 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.mz5.internal.io; | ||
|
||
import java.io.IOException; | ||
|
||
import org.eclipse.core.runtime.IProgressMonitor; | ||
|
||
import net.openchrom.msd.converter.supplier.mz5.io.IReaderProxy; | ||
import net.openchrom.msd.converter.supplier.mz5.io.ReaderProxy; | ||
import net.openchrom.msd.converter.supplier.mz5.io.support.IScanMarker; | ||
import net.openchrom.msd.converter.supplier.mz5.model.IVendorScanProxy; | ||
|
||
public class ProxyReader { | ||
|
||
public void readMassSpectrum(double[] mzs, float[] spectrumIntensity, IScanMarker scanMarker, IVendorScanProxy massSpectrum, IProgressMonitor monitor) throws IOException { | ||
|
||
IReaderProxy scanReaderProxy = new ReaderProxy(); | ||
scanReaderProxy.readMassSpectrum(mzs, spectrumIntensity, scanMarker, massSpectrum, monitor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
....converter.supplier.mz5/src/net/openchrom/msd/converter/supplier/mz5/io/IReaderProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/******************************************************************************* | ||
* 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.mz5.io; | ||
|
||
import java.io.IOException; | ||
|
||
import org.eclipse.core.runtime.IProgressMonitor; | ||
|
||
import net.openchrom.msd.converter.supplier.mz5.io.support.IScanMarker; | ||
import net.openchrom.msd.converter.supplier.mz5.model.IVendorScanProxy; | ||
|
||
public interface IReaderProxy { | ||
|
||
void readMassSpectrum(double[] mzs, float[] spectrumIntensity, IScanMarker scanMarker, IVendorScanProxy massSpectrum, IProgressMonitor monitor) throws IOException; | ||
} |
51 changes: 51 additions & 0 deletions
51
...d.converter.supplier.mz5/src/net/openchrom/msd/converter/supplier/mz5/io/ReaderProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/******************************************************************************* | ||
* 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.mz5.io; | ||
|
||
import java.io.IOException; | ||
|
||
import org.eclipse.chemclipse.logging.core.Logger; | ||
import org.eclipse.chemclipse.model.exceptions.AbundanceLimitExceededException; | ||
import org.eclipse.chemclipse.msd.model.exceptions.IonLimitExceededException; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
|
||
import net.openchrom.msd.converter.supplier.mz5.io.support.IScanMarker; | ||
import net.openchrom.msd.converter.supplier.mz5.model.IVendorIon; | ||
import net.openchrom.msd.converter.supplier.mz5.model.IVendorScanProxy; | ||
import net.openchrom.msd.converter.supplier.mz5.model.VendorIon; | ||
|
||
public class ReaderProxy implements IReaderProxy { | ||
|
||
private static final Logger logger = Logger.getLogger(ReaderProxy.class); | ||
|
||
@Override | ||
public void readMassSpectrum(double[] mzs, float[] spectrumIntensity, IScanMarker scanMarker, IVendorScanProxy massSpectrum, IProgressMonitor monitor) throws IOException { | ||
|
||
try { | ||
double mz = 0; | ||
int start = scanMarker.getStart(); | ||
int offset = scanMarker.getOffset(); | ||
for(int o = start; o < offset; o++) { | ||
float intensity = spectrumIntensity[o]; | ||
mz += mzs[o]; // first m/z value and then deltas | ||
IVendorIon ion = new VendorIon(mz, intensity); | ||
massSpectrum.addIon(ion); | ||
} | ||
} catch(OutOfMemoryError e) { | ||
logger.error(e); | ||
} catch(AbundanceLimitExceededException e) { | ||
logger.warn(e); | ||
} catch(IonLimitExceededException e) { | ||
logger.warn(e); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ter.supplier.mz5/src/net/openchrom/msd/converter/supplier/mz5/io/support/IScanMarker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/******************************************************************************* | ||
* 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.mz5.io.support; | ||
|
||
public interface IScanMarker { | ||
|
||
int getStart(); | ||
|
||
void setStart(int start); | ||
|
||
int getOffset(); | ||
|
||
void setOffset(int offset); | ||
} |
48 changes: 48 additions & 0 deletions
48
...rter.supplier.mz5/src/net/openchrom/msd/converter/supplier/mz5/io/support/ScanMarker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/******************************************************************************* | ||
* 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.mz5.io.support; | ||
|
||
public class ScanMarker implements IScanMarker { | ||
|
||
private int start; | ||
private int offset; | ||
|
||
public ScanMarker(int start, int offset) { | ||
|
||
this.start = start; | ||
this.offset = offset; | ||
} | ||
|
||
@Override | ||
public int getStart() { | ||
|
||
return start; | ||
} | ||
|
||
@Override | ||
public void setStart(int start) { | ||
|
||
this.start = start; | ||
} | ||
|
||
@Override | ||
public int getOffset() { | ||
|
||
return offset; | ||
} | ||
|
||
@Override | ||
public void setOffset(int offset) { | ||
|
||
this.offset = offset; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ter.supplier.mz5/src/net/openchrom/msd/converter/supplier/mz5/model/IVendorScanProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017, 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.mz5.model; | ||
|
||
import org.eclipse.chemclipse.msd.model.core.IVendorMassSpectrumProxy; | ||
|
||
public interface IVendorScanProxy extends IVendorScan, IVendorMassSpectrumProxy { | ||
} |
Oops, something went wrong.