Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
75dd711
propose new IM type
timosachsenberg Jan 13, 2025
2699787
Merge branch 'develop' into im_types
timosachsenberg Jan 13, 2025
a2727e0
add stub for PeakPickerIM
timosachsenberg Jan 14, 2025
7d71674
make it compile
timosachsenberg Jan 14, 2025
94adc43
todo for IMTypes
timosachsenberg Jan 14, 2025
c82a56a
add UNKNOWN to IMFormat
timosachsenberg Jan 14, 2025
e25c41d
allow both drift time and IM arrays
timosachsenberg Jan 14, 2025
d6b5ba6
add to pxd
timosachsenberg Jan 14, 2025
dcab937
apply reviewer suggestions
timosachsenberg Jan 14, 2025
97b65df
fix logic
timosachsenberg Jan 14, 2025
7ea05eb
fix logic add test
timosachsenberg Jan 14, 2025
8eb8f27
fix logic add test
timosachsenberg Jan 14, 2025
d255658
check for MIXED already in setIMFormat
timosachsenberg Jan 14, 2025
6d1abf2
fix test
timosachsenberg Jan 14, 2025
478d484
update tests
timosachsenberg Jan 14, 2025
60675b1
fix removed constructor
timosachsenberg Jan 14, 2025
ba72039
add some comments
timosachsenberg Jan 15, 2025
2431838
Merge branch 'develop' into im_types
timosachsenberg Jan 17, 2025
acd9528
Merge branch 'develop' into im_types
timosachsenberg Jan 31, 2025
b60a9de
started to populate peakpickerIM with code
Feb 23, 2025
48c247b
included linear resampler
Feb 23, 2025
ee1f326
added topp tool to feed in real mobilograms
Mar 6, 2025
6cb5d43
PeakPickerIM basic skeleton is complete. It accepts raw TimsTOF frame…
Mar 22, 2025
4ddd7a9
Added Author
Mar 26, 2025
d55e173
Potential Runtime Improvement of GaussTraceFilter.cpp^
Mar 28, 2025
d2d6a19
patched
Mar 28, 2025
0a64adf
modified XMLHandler.h/cpp Changed Implementation of appendASCII added…
Apr 9, 2025
2dd2bb6
added test for XMLHeader, Debugged it
Apr 11, 2025
ac506f9
t rid of print statements in function
Apr 14, 2025
e057e09
Moved the function in the right part of the String Manager Class
Apr 15, 2025
1383969
fferent Impelmentation of append/isAscii with potentially silghtly le…
Apr 17, 2025
4c0ca9a
Test formatted to Conventions
Apr 17, 2025
9f90780
Changed the packus_epi16 function with the shuffle function for impro…
Apr 22, 2025
212c9e7
Implemented strLength function with simde for potential runtime impro…
May 13, 2025
8ca0562
Added strLength Method using simde for Potential runtime improvement.…
May 13, 2025
83d290a
Added Description of strLength method for documentation
May 13, 2025
3209298
code is now up to the coding conventions
May 13, 2025
d411bf6
Neue Stringlenght funktion durch alte ersetzt aus dem MzMLHandler.Cpp…
May 14, 2025
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
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ the authors tag in the respective file header.
- Anton Kriese
- Anton Pervukhin
- Bastian Blank
- Bela Pfeffer
- Chenghao Zhu
- Chris Bauer
- Chris Bielow
Expand Down Expand Up @@ -120,4 +121,4 @@ the authors tag in the respective file header.
- Witold Wolski
- Xiao Liang
- Yasset Perez-Riverol
- Peter Jones
- Peter Jones
2 changes: 1 addition & 1 deletion contrib
Submodule contrib updated 1 files
+12 −11 CMakeLists.txt
25 changes: 22 additions & 3 deletions src/openms/include/OpenMS/FORMAT/HANDLERS/XMLHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <OpenMS/CONCEPT/Types.h>
#include <OpenMS/CONCEPT/Macros.h>

#include <OpenMS/DATASTRUCTURES/ListUtils.h> // StringList
#include <OpenMS/DATASTRUCTURES/DateTime.h>
#include <OpenMS/DATASTRUCTURES/DataValue.h>
#include <OpenMS/DATASTRUCTURES/ListUtils.h>
Expand All @@ -21,6 +21,7 @@
#include <xercesc/util/XMLString.hpp>

#include <iosfwd>
#include <iostream>
#include <string>
#include <memory>

Expand Down Expand Up @@ -224,8 +225,18 @@ namespace OpenMS

// Converts from a wide-character string to a narrow-character string.
inline static String toNative_(const XMLCh* str)
{
return String(unique_xerces_ptr<char>(xercesc::XMLString::transcode(str)).get());
{
String r;
XMLSize_t l = xercesc::XMLString::stringLen(str);
if(isASCII(str, l))
{
appendASCII(str,l,r);
}
else
{
r = (unique_xerces_ptr<char>(xercesc::XMLString::transcode(str)).get());
}
return r;
}

// Converts from a wide-character string to a narrow-character string.
Expand All @@ -242,6 +253,9 @@ namespace OpenMS
/// Destructor
~StringManager();

/// Calculates the length of a XMLCh* string using SIMDe
static int strLength(const XMLCh* input_ptr);

/// Transcode the supplied C string to a xerces string
inline static XercesString convert(const char * str)
{
Expand Down Expand Up @@ -283,7 +297,12 @@ namespace OpenMS
{
return toNative_(str);
}
/// Checks if supplied if chars in XMLCh* can be encoded with ASCII
static bool isASCII(const XMLCh * chars, const XMLSize_t length);

/// Compresses eight 8x16bit Chars in XMLCh* to 8x8bit Chars by cutting upper byte
static void compress64 (const XMLCh * input_it, char* output_it);

/**
* @brief Transcodes the supplied XMLCh* and appends it to the OpenMS String
*
Expand Down
6 changes: 6 additions & 0 deletions src/openms/include/OpenMS/IONMOBILITY/IMTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ namespace OpenMS
OPENMS_DLLAPI const std::string& toString(const DriftTimeUnit value);

/// Different ways to represent ion mobility data in a spectrum
/// Note:
/// 1. MIXED is only used for MSExperiment, not for MSSpectrum
/// 2. UNKNOWN should be used if the format is not yet determined.
/// FileHandler or e.g. IM peak picker should ideally set the format a known value.
enum class IMFormat
{
NONE, ///< no ion mobility
CONCATENATED, ///< ion mobility frame is stacked in a single spectrum (i.e. has an IM float data array)
MULTIPLE_SPECTRA,///< ion mobility is recorded as multiple spectra per frame (i.e. has one IM annotation per spectrum)
MIXED, ///< an MSExperiment contains both CONCATENATED and MULTIPLE_SPECTRA
CENTROIDED, ///< ion mobility of peaks after centroiding in IM dimension. Ion mobility is annotated in a single float data array (i.e., each peak might have a different IM value in the data array); identical to CONCATENATED in terms of data layout.
UNKNOWN, ///< ion mobility format not yet determined.
SIZE_OF_IMFORMAT
};
/// Names of IMFormat
Expand Down
6 changes: 3 additions & 3 deletions src/openms/include/OpenMS/METADATA/MetaInfoInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace OpenMS
public:

/// Constructor
MetaInfoInterface();
MetaInfoInterface() = default;
/// Copy constructor
MetaInfoInterface(const MetaInfoInterface& rhs);
/// Move constructor
Expand Down Expand Up @@ -107,8 +107,8 @@ namespace OpenMS
/// Creates the MetaInfo object if it does not exist
inline void createIfNotExists_();

/// Pointer to the MetaInfo object (0 by default)
MetaInfo* meta_;
/// Pointer to the MetaInfo object
MetaInfo* meta_ = nullptr;
};

} // namespace OpenMS
22 changes: 17 additions & 5 deletions src/openms/include/OpenMS/METADATA/SpectrumSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//
// --------------------------------------------------------------------------
// $Maintainer: Timo Sachsenberg $
// $Authors: Marc Sturm $
// $Authors: Marc Sturm, Timo Sachsenberg $
// --------------------------------------------------------------------------

#pragma once
Expand All @@ -16,6 +16,7 @@
#include <OpenMS/METADATA/Product.h>
#include <OpenMS/METADATA/PeptideIdentification.h>
#include <OpenMS/METADATA/DataProcessing.h>
#include <OpenMS/IONMOBILITY/IMTypes.h>

#include <map>
#include <vector>
Expand Down Expand Up @@ -52,13 +53,13 @@ namespace OpenMS
static const std::string NamesOfSpectrumType[SIZE_OF_SPECTRUMTYPE];

/// Constructor
SpectrumSettings();
SpectrumSettings() = default;
/// Copy constructor
SpectrumSettings(const SpectrumSettings &) = default;
/// Move constructor
SpectrumSettings(SpectrumSettings&&) = default;
SpectrumSettings(SpectrumSettings&&) noexcept = default;
/// Destructor
~SpectrumSettings();
~SpectrumSettings() noexcept = default;

// Assignment operator
SpectrumSettings & operator=(const SpectrumSettings &) = default;
Expand All @@ -78,6 +79,16 @@ namespace OpenMS
///sets the spectrum type
void setType(SpectrumType type);

/// @brief sets the IMFormat of the spectrum
/// @param im_type
void setIMFormat(const IMFormat& im_type);

/// @brief returns the IMFormat of the spectrum if set. Otherwise UNKNOWN (default).
///
/// Note: If UNKNOWN, use IMFormat::determineIMFormat to determine the IMFormat based on the data.
/// @return IMFormat of the spectrum
IMFormat getIMFormat() const;

/// returns the native identifier for the spectrum, used by the acquisition software.
const String & getNativeID() const;
/// sets the native identifier for the spectrum, used by the acquisition software.
Expand Down Expand Up @@ -141,7 +152,8 @@ namespace OpenMS

protected:

SpectrumType type_;
SpectrumType type_ = UNKNOWN;
IMFormat im_type_ = IMFormat::UNKNOWN;
String native_id_;
String comment_;
InstrumentSettings instrument_settings_;
Expand Down
71 changes: 71 additions & 0 deletions src/openms/include/OpenMS/PROCESSING/CENTROIDING/PeakPickerIM.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
// SPDX-License-Identifier: BSD-3-Clause
//
// --------------------------------------------------------------------------
// $Author: Timo Sachsenberg, Mohammed Alhigaylan $
// $Maintainer: Timo Sachsenberg $
// -------------------------------------------------------------------------------------------------------------------------------------------

#pragma once

#include <OpenMS/KERNEL/MSSpectrum.h>
#include <OpenMS/DATASTRUCTURES/Param.h>

namespace OpenMS
{
/**
@brief Peak picking algorithm for ion mobility data

@ingroup PeakPicking
*/
class OPENMS_DLLAPI PeakPickerIM
{
public:
/// Default constructor initializing parameters with default values.
PeakPickerIM();

/// Destructor.
virtual ~PeakPickerIM();

/// Picks ion mobility traces from the given spectrum.
void pickIMTraces(MSSpectrum& spectrum);

/// Sets the parameters for peak picking.
void setParameters(const Param& param);

/// Gets the current parameters.
Param getParameters() const;

protected:
/// Updates internal member variables when parameters are changed.
void updateMembers_();

/// Returns the default parameters.
Param getDefaultParameters() const;

/// Stores the parameters for peak picking.
Param parameters_;

private:
/// determine sampling rate for linear resampler
double computeOptimalSamplingRate(const std::vector<MSSpectrum>& spectra);

/// Sum up the intensity of data points with nearly identical float values
MSSpectrum SumFrame(const MSSpectrum& spectrum, double ppm_tolerance = 0.01);

/// Compute lower and upper m/z bounds based on ppm
std::pair<double, double> ppmBounds(double mz, double ppm);

/// Extract ion mobility traces as MSSpectra from the raw TimsTOF frame
/// Ion mobility is temporarily written in place of m/z inside Peak1D object.
/// raw m/z values are allocated to float data arrays with the label 'raw_mz'
std::vector<MSSpectrum> extractIonMobilityTraces(
const MSSpectrum& picked_spectrum,
const MSSpectrum& raw_spectrum);

/// compute m/z and ion mobility centers for picked traces. Returns centroided spectrum.
MSSpectrum ComputeCenters(const std::vector<MSSpectrum>& mobilogram_traces,
const std::vector<MSSpectrum>& picked_traces);
};

} // namespace OpenMS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(directory include/OpenMS/PROCESSING/CENTROIDING)
set(sources_list_h
PeakPickerHiRes.h
PeakPickerIterative.h
PeakPickerIM.h
)

### add path to the filenames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ namespace OpenMS
{
//store map of abort reasons for failed seeds
FeatureMap abort_map;
abort_map.reserve(abort_reasons_.size());
abort_map.reserve( abort_reasons_.size());
Size counter = 0;
for (std::map<Seed, String>::iterator it2 = abort_reasons_.begin(); it2 != abort_reasons_.end(); ++it2, ++counter)
{
Expand Down
12 changes: 8 additions & 4 deletions src/openms/source/FEATUREFINDER/GaussTraceFitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// --------------------------------------------------------------------------

#include <OpenMS/FEATUREFINDER/GaussTraceFitter.h>

#include <iostream>
#include <OpenMS/CONCEPT/LogStream.h>
#include <Eigen/Core>

Expand Down Expand Up @@ -171,19 +171,23 @@ namespace OpenMS
double sig_sq = pow(sig, 2);
double sig_3 = pow(sig, 3);
double c_fac = -0.5 / sig_sq;
// std::cout << sig_3 << std::endl;


Size count = 0;
for (Size t = 0; t < m_data->traces_ptr->size(); ++t)
{
const FeatureFinderAlgorithmPickedHelperStructs::MassTrace& trace = (*m_data->traces_ptr)[t];
double weight = m_data->weighted ? trace.theoretical_int : 1.0;
double constant = trace.theoretical_int * weight;
for (Size i = 0; i < trace.peaks.size(); ++i)
{
double rt = trace.peaks[i].first;
double e = exp(c_fac * pow(rt - x0, 2));
J(count, 0) = trace.theoretical_int * e * weight;
J(count, 1) = trace.theoretical_int * height * e * (rt - x0) / sig_sq * weight;
J(count, 2) = 0.125* trace.theoretical_int* height* e* pow(rt - x0, 2) / sig_3 * weight;
double eConstant = constant * e;
J(count, 0) = eConstant;
J(count, 1) = eConstant* height * (rt - x0) / sig_sq;
J(count, 2) = 0.125* eConstant * height * pow(rt - x0, 2) / sig_3;
++count;
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/openms/source/FORMAT/HANDLERS/MzMLHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
#include <OpenMS/INTERFACES/IMSDataConsumer.h>
#include <OpenMS/SYSTEM/File.h>


#include <map>



namespace OpenMS::Internal
{

Expand Down
Loading