libXpertMass Developer Documentation
  • libXpertMass
  • IsotopicClusterGenerator
  • IsotopicClusterGenerator Class

    class MsXpS::libXpertMass::IsotopicClusterGenerator

    The IsotopicClusterGenerator class provides the features needed to model isotopic clusters starting from (elemental-composition, charge) pairs. More...

    Header: #include <IsotopicClusterGenerator.hpp>

    Public Functions

    IsotopicClusterGenerator(libXpertMass::IsotopicDataSPtr isotopic_data_sp)
    virtual ~IsotopicClusterGenerator()
    void appendFormulaChargePair(FormulaChargePair &formula_charge_pair)
    QString clusterToString(const pappso::TraceCstSPtr &isotopic_cluster_sp) const
    QString clustersToString() const
    bool configureIsotopicData(std::map<QString, int> &symbol_count_map, int *&per_element_isotopes_count_array_p, int *&per_element_symbol_count_array_p, double **&per_element_isotope_masses_arrays_p_p, double **&per_element_isotope_probs_arrays_p_p)
    IsotopicClusterChargePair generateIsotopicClusterCentroids(FormulaChargePair formula_charge_pair)
    const std::vector<IsotopicClusterChargePair> &getIsotopicClusterChargePairs() const
    libXpertMass::IsotopicDataSPtr getIsotopicData() const
    std::size_t run()
    pappso::TraceSPtr runIsotopicDataCalculations(std::size_t element_count, int charge, int *per_element_isotopes_count_array_p, int *per_element_symbol_count_array_p, double **per_element_isotope_masses_arrays_p_p, double **per_element_isotope_probs_arrays_p_p)
    void setFormulaChargePair(FormulaChargePair &formula_charge_pair)
    void setFormulaChargePairs(const std::vector<FormulaChargePair> &formula_charge_pairs)
    void setIsotopicData(libXpertMass::IsotopicDataSPtr isotopic_data_sp)
    void setIsotopicDataType(IsotopicDataType isotopic_data_type)
    void setMaxSummedProbability(double max_probability)
    void setNormalizationIntensity(int normalize_intensity)
    void setSortOrder(pappso::SortOrder sort_order)
    void setSortType(pappso::SortType sort_type)
    bool validateAllFormulas()
    bool validateFormula(Formula &formula)

    Protected Functions

    void normalizeIntensities(pappso::TraceSPtr &isotopic_cluster_sp)
    void sortPeakCentroids(pappso::TraceSPtr &isotopic_cluster_sp)

    Protected Variables

    std::vector<FormulaChargePair> m_formulaChargePairs
    std::vector<IsotopicClusterChargePair> m_isotopicClusterChargePairs
    IsotopicDataType m_isotopicDataType
    double m_maxSummedProbability
    int m_normalizeIntensity
    pappso::SortOrder m_sortOrder
    pappso::SortType m_sortType
    libXpertMass::IsotopicDataSPtr msp_isotopicData

    Detailed Description

    The modelling uses the member isotopic data. The generated isotopic clusters only contain cluster centroid peaks. If peaks should have a profile, then they need to be shaped.

    See also IsotopicClusterShaper and MassPeakShaper.

    Member Function Documentation

    IsotopicClusterGenerator::IsotopicClusterGenerator(libXpertMass::IsotopicDataSPtr isotopic_data_sp)

    Constructs a IsotopicClusterGenerator instance.

    [virtual noexcept] IsotopicClusterGenerator::~IsotopicClusterGenerator()

    Destructs this IsotopicClusterGenerator instance.

    void IsotopicClusterGenerator::appendFormulaChargePair(FormulaChargePair &formula_charge_pair)

    Adds the (elemental composition, charge) pair formula_charge_pair to the member list of FormulaChargePair instances.

    QString IsotopicClusterGenerator::clusterToString(const pappso::TraceCstSPtr &isotopic_cluster_sp) const

    Returns a string containing a space-separated set of m/z, intensity pairs, representing the isotopic cluster in isotopic_cluster_sp.

    QString IsotopicClusterGenerator::clustersToString() const

    Returns a string containing a space-separated set of m/z, intensity pairs, representing the isotopic clusters in the member isotopic clusters m_isotopicClusterChargePairs.

    bool IsotopicClusterGenerator::configureIsotopicData(std::map<QString, int> &symbol_count_map, int *&per_element_isotopes_count_array_p, int *&per_element_symbol_count_array_p, double **&per_element_isotope_masses_arrays_p_p, double **&per_element_isotope_probs_arrays_p_p)

    Configures the isotopic data in a set of arrays for the (symbol,count) pairs in symbol_count_map.

    Returns a pappso::Trace with the calculated isotopic cluster.

    IsotopicClusterChargePair IsotopicClusterGenerator::generateIsotopicClusterCentroids(FormulaChargePair formula_charge_pair)

    Calculates the isotopic cluster's peak centroids for formula_charge_pair.

    1. The elemental composition formula string is converted to a Formula and validated.
    2. The proper isotopic data handler is allocated (IsotopicDataType).
    3. The number of symbols in the elemental composition is determined.
    4. The int arrays and arrays of double arrays are allocated.
    5. The arrays are filled-in with configureIsotopicData().
    6. The calculations are performed on these arrays with runIsotopicDataCalculations().

    Returns the results of the computation in the form of a IsotopicClusterChargePair instance.

    const std::vector<IsotopicClusterChargePair> &IsotopicClusterGenerator::getIsotopicClusterChargePairs() const

    Returns the member list ofIsotopicClusterChargePair instances.

    libXpertMass::IsotopicDataSPtr IsotopicClusterGenerator::getIsotopicData() const

    Returns the isotopic data.

    [protected] void IsotopicClusterGenerator::normalizeIntensities(pappso::TraceSPtr &isotopic_cluster_sp)

    Normalizes the intensities of the isotopic cluster's peak centroids in isotopic_cluster_sp.

    If normalization is asked for, the most intense peak centroid in isotopic_cluster_sp is determined. That intensity becomes the m_normalizeIntensity value and all the other peak centroids' intensities are normalized.

    Note: The normalization occurs in place.

    std::size_t IsotopicClusterGenerator::run()

    Starts the computations.

    The member m_isotopicClusterChargePairs are first cleared.

    Returns the count of IsotopicClusterChargePair instances generated upon the calculations.

    pappso::TraceSPtr IsotopicClusterGenerator::runIsotopicDataCalculations(std::size_t element_count, int charge, int *per_element_isotopes_count_array_p, int *per_element_symbol_count_array_p, double **per_element_isotope_masses_arrays_p_p, double **per_element_isotope_probs_arrays_p_p)

    Runs the IsoSpec-based isotopic calculations.

    Returns a pappso::Trace with the calculated isotopic cluster.

    void IsotopicClusterGenerator::setFormulaChargePair(FormulaChargePair &formula_charge_pair)

    Adds the (elemental composition, charge) pair formula_charge_pair to the member list of FormulaChargePair instances.

    The member list of FormulaChargePair instances is first cleared.

    void IsotopicClusterGenerator::setFormulaChargePairs(const std::vector<FormulaChargePair> &formula_charge_pairs)

    Adds the (elemental composition, charge) pairs formula_charge_pairs to the member list of FormulaChargePair instances.

    The member list of FormulaChargePair instances is first cleared.

    void IsotopicClusterGenerator::setIsotopicData(libXpertMass::IsotopicDataSPtr isotopic_data_sp)

    Sets the isotopic data to isotopic_data_sp.

    void IsotopicClusterGenerator::setIsotopicDataType(IsotopicDataType isotopic_data_type)

    Sets the isotopic data type to isotopic_data_type.

    void IsotopicClusterGenerator::setMaxSummedProbability(double max_probability)

    Sets the summed probability maximum value to max_probability.

    void IsotopicClusterGenerator::setNormalizationIntensity(int normalize_intensity)

    Sets the normalization intensity to normalize_intensity.

    void IsotopicClusterGenerator::setSortOrder(pappso::SortOrder sort_order)

    Sets the sort_order.

    void IsotopicClusterGenerator::setSortType(pappso::SortType sort_type)

    Sets the sort_type.

    [protected] void IsotopicClusterGenerator::sortPeakCentroids(pappso::TraceSPtr &isotopic_cluster_sp)

    Sorts the peak centroids of the isotopic cluster isotopic_cluster_sp.

    The sort is performed according to m_sortType.

    bool IsotopicClusterGenerator::validateAllFormulas()

    Validates all the elemental compositions in this IsotopicClusterGenerator instance.

    Each FormulaChargePair in m_formulaChargePairs is validated for its elemental composition by first creating a Formula out of it.

    Returns true if validation was successful, false otherwise.

    See also validateFormula and Formula::validate().

    bool IsotopicClusterGenerator::validateFormula(Formula &formula)

    Validates the elemental composition formula.

    The formula needs to be fully indexed, that is, even an atom present only once needs to be indexed with '1', like this H2O1.

    Returns true if validation was successful, false otherwise.

    See also Formula::validate().

    Member Variable Documentation

    std::vector<FormulaChargePair> IsotopicClusterGenerator::m_formulaChargePairs

    This variable holds the set of (elemental composition, charge) pairs.

    std::vector<IsotopicClusterChargePair> IsotopicClusterGenerator::m_isotopicClusterChargePairs

    This variable holds the set of (isotopic cluster, charge) pairs.

    IsotopicDataType IsotopicClusterGenerator::m_isotopicDataType

    This variable holds the IsotopicDataType type of data.

    double IsotopicClusterGenerator::m_maxSummedProbability

    This variable holds the summed probability of all the isotopic cluster peaks. The computation stops when this probability is reached.

    int IsotopicClusterGenerator::m_normalizeIntensity

    This variable holds the most intense cluster peak's intensity that is used to normalize all the other cluster peaks.

    pappso::SortOrder IsotopicClusterGenerator::m_sortOrder

    This variable holds the order of the sorting for the generated cluster peak centroids.

    pappso::SortType IsotopicClusterGenerator::m_sortType

    This variable holds the type of sorting required for the generated cluster peak centroids.

    libXpertMass::IsotopicDataSPtr IsotopicClusterGenerator::msp_isotopicData

    This variable holds the isotopic data needed for the computations.