Skip to content

Commit

Permalink
Merge pull request #1568 from Mailaender/ms-instrument-api
Browse files Browse the repository at this point in the history
Propose new API for instrument type and ionization mode
  • Loading branch information
eselmeister authored Nov 22, 2023
2 parents 573624f + 879ab62 commit 59976c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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 @@ -255,6 +256,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(Polarity.POSITIVE);
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 @@ -54,6 +54,7 @@ public void testMassSpectrum() {
assertEquals("30(NCE)", regularLibraryMassSpectrum.getProperty(IRegularLibraryMassSpectrum.PROPERTY_COLLISION_ENERGY));
assertEquals(Polarity.POSITIVE, 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

0 comments on commit 59976c5

Please sign in to comment.