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

Propose new API for instrument type and ionization mode #1568

Merged
merged 2 commits into from
Nov 22, 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
Expand Up @@ -71,6 +71,7 @@ public class MSPReader extends AbstractMassSpectraReader implements IMassSpectra
private static final Pattern ionPattern = Pattern.compile("([+]?\\d+\\.?\\d*)([\t ,;:]+)([+-]?\\d+\\.?\\d*([eE][+-]?\\d+)?)");
private static final Pattern precursorTypePattern = Pattern.compile("(Precursor_type:)(.*)", Pattern.CASE_INSENSITIVE);
private static final Pattern precursorMassPattern = Pattern.compile("(PrecursorMZ:)(.*)", Pattern.CASE_INSENSITIVE);
private static final Pattern instrumentTypePattern = Pattern.compile("(Instrument_type:)(.*)", Pattern.CASE_INSENSITIVE);
private static final Pattern instrumentPattern = Pattern.compile("(Instrument:)(.*)", Pattern.CASE_INSENSITIVE);
private static final Pattern collisionEnergyPattern = Pattern.compile("(Collision_energy:)(.*)", Pattern.CASE_INSENSITIVE);
private static final Pattern exactMassPattern = Pattern.compile("(ExactMass:)(.*)", Pattern.CASE_INSENSITIVE);
Expand Down Expand Up @@ -254,6 +255,9 @@ private void addMassSpectrum(IMassSpectra massSpectra, String massSpectrumData,
String instrument = extractContentAsString(massSpectrumData, instrumentPattern, 2);
massSpectrum.putProperty(IRegularLibraryMassSpectrum.PROPERTY_INSTRUMENT_NAME, instrument);
//
String instrumentType = extractContentAsString(massSpectrumData, instrumentTypePattern, 2);
massSpectrum.putProperty(IRegularLibraryMassSpectrum.PROPERTY_INSTRUMENT_TYPE, instrumentType);
//
String ionMode = extractContentAsString(massSpectrumData, ionModePattern, 2);
if(ionMode.equals("POSITIVE")) {
massSpectrum.setPolarity("+");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public interface IRegularLibraryMassSpectrum extends IRegularMassSpectrum, ILibr
public static final String PROPERTY_PRECURSOR_TYPE = "Precursor Type"; // [M+H]+, [M-H]-, ...
public static final String PROPERTY_COLLISION_ENERGY = "Collision Energy"; // 30
public static final String PROPERTY_INSTRUMENT_NAME = "Instrument Name"; // Agilent QTOF 6530
public static final String PROPERTY_INSTRUMENT_TYPE = "Instrument Type"; // LC-ESI-QTOF
public static final String PROPERTY_IONIZATION_MODE = "Ionization Mode"; // APCI

String getPrecursorType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public void testMassSpectrum() {
assertEquals("30(NCE)", regularLibraryMassSpectrum.getProperty(IRegularLibraryMassSpectrum.PROPERTY_COLLISION_ENERGY));
assertEquals("+", regularLibraryMassSpectrum.getPolarity());
assertEquals("[M+H]+", regularLibraryMassSpectrum.getProperty(IRegularLibraryMassSpectrum.PROPERTY_PRECURSOR_TYPE));
assertEquals("LC-ESI-ITFT", regularLibraryMassSpectrum.getProperty(IRegularLibraryMassSpectrum.PROPERTY_INSTRUMENT_TYPE));
assertEquals("Q-Exactive Orbitrap Thermo Scientific", regularLibraryMassSpectrum.getProperty(IRegularLibraryMassSpectrum.PROPERTY_INSTRUMENT_NAME));
}
}
Expand Down