35 #ifndef OPENMS_ANALYSIS_TARGETED_PSLPFORMULATION_H 
   36 #define OPENMS_ANALYSIS_TARGETED_PSLPFORMULATION_H 
   44   class PrecursorIonSelectionPreprocessing;
 
   45   class PSProteinInference;
 
   88     template <
typename InputPeakType>
 
   89     void createAndSolveILPForKnownLCMSMapFeatureBased(
const FeatureMap<> & features,
 
   91                                                       std::vector<IndexTriple> & variable_indices,
 
   92                                                       std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
   93                                                       std::set<Int> & charges_set, 
UInt ms2_spectra_per_rt_bin,
 
   94                                                       std::vector<int> & solution_indices);
 
  101                                                    UInt ms2_spectra_per_rt_bin, 
UInt max_list_size,
 
  103                                                    bool solve_ILP = 
true);
 
  105     template <
typename InputPeakType>
 
  106     void createAndSolveCombinedLPForKnownLCMSMapFeatureBased(
const FeatureMap<> & features,
 
  108                                                              std::vector<IndexTriple> & variable_indices,
 
  109                                                              std::vector<int> & solution_indices,
 
  110                                                              std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  111                                                              std::set<Int> & charges_set, 
UInt ms2_spectra_per_rt_bin,
 
  112                                                              Size step_size = 0, 
bool sequential_order = 
false);
 
  114     void updateStepSizeConstraint(
Size iteration, 
UInt step_size);
 
  115     void updateFeatureILPVariables(
FeatureMap<> & new_features, std::vector<IndexTriple> & variable_indices, std::map<
Size, std::vector<String> > & feature_constraints_map);
 
  116     void updateRTConstraintsForSequentialILP(
Size & rt_index, 
UInt ms2_spectra_per_rt_bin, 
Size max_rt_index);
 
  118                            std::vector<String> & new_protein_accs, std::vector<String> & protein_accs, 
PSProteinInference & prot_inference, 
Size & variable_counter,
 
  119                            std::map<
String, std::vector<Size> > & protein_feature_map, 
Feature & new_feature, std::map<String, Size> & protein_variable_index_map,
 
  120                            std::map<
String, std::set<String> > & prot_id_counter);
 
  126     void solveILP(std::vector<int> & solution_indices);
 
  139       std::binary_function<IndexTriple, IndexTriple, bool>
 
  151       std::binary_function<IndexTriple, IndexTriple, bool>
 
  162       std::binary_function<IndexTriple, IndexTriple, bool>
 
  174     template <
typename InputPeakType>
 
  175     void getXIC_(
const std::vector<std::pair<Size, Size> > & end_points,
 
  176                  std::vector<DoubleReal> & weights,
 
  183     template <
typename InputPeakType>
 
  184     void calculateXICs_(std::vector<std::vector<DoubleReal> > & xics,
 
  187                         const std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  193     void createAndSolveILP_(
const FeatureMap<> & features, std::vector<std::vector<DoubleReal> > & intensity_weights,
 
  194                             std::set<Int> & charges_set, std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  195                             std::vector<IndexTriple> & variable_indices, std::vector<int> & solution_indices,
 
  196                             UInt ms2_spectra_per_rt_bin, 
Size number_of_scans);
 
  198     void createAndSolveCombinedLPFeatureBased_(
const FeatureMap<> & features, std::vector<std::vector<DoubleReal> > & intensity_weights,
 
  199                                                std::set<Int> & charges_set, std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  200                                                std::vector<IndexTriple> & variable_indices, std::vector<Int> & solution_indices,
 
  201                                                UInt ms2_spectra_per_rt_bin, 
Size number_of_scans, 
Size step_size = 0, 
bool sequential_order = 
false);
 
  204                           std::map<
String, std::vector<DoubleReal> >::const_iterator map_iter,
 
  205                           Size & counter, 
Size & pep_counter, 
Size & feature_counter,
 
  206                           std::vector<IndexTriple> & variable_indices,
 
  207                           std::map<String, Size> & protein_penalty_index_map, 
FeatureMap<> & precursors);
 
  209     void addPrecursorAcquisitionNumberConstraint_(std::vector<IndexTriple> & variable_indices, 
Size number_of_features, 
UInt number_of_msms_per_precursor);
 
  211     void addMaxInclusionListSizeConstraints_(std::vector<IndexTriple> & variable_indices,  
UInt max_list_size);
 
  213     void addRTBinCapacityConstraint_(std::vector<IndexTriple> & variable_indices,
 
  214                                      Size max_rt_index, 
UInt ms2_spectra_per_rt_bin, 
bool sequential_order = 
false);
 
  216     void addProteinCoverageConstraint_(std::vector<IndexTriple> & variable_indices,
 
  218                                        std::map<String, Size> protein_variable_index_map);
 
  220     void addStepSizeConstraint_(std::vector<IndexTriple> & variable_indices, 
UInt step_size);
 
  228     Int getNumberOfPrecsInSpectrum_(
Int constr_idx);
 
  234   template <
typename InputPeakType>
 
  236                                 std::vector<DoubleReal> & weights,
 
  242     for (
Size i = 0; i < end_points.size(); i += 2)
 
  245       for (
Size j = end_points[i].second; j <= end_points[i + 1].second; ++j)
 
  247         weight += experiment[end_points[i].first][j].getIntensity();
 
  250       if (weight > max_weight)
 
  253       weights.push_back(weight);
 
  259       for (
Size i = 0; i < weights.size(); ++i)
 
  262         if (end_points.size() >= i)
 
  264           std::cout << 
"scan " << end_points[i].first << 
" " << weights[i] << 
" " << max_weight
 
  265                     << 
" " << weights[i] / max_weight << std::endl;
 
  268         weights[i] /= max_weight;
 
  273   template <
typename InputPeakType>
 
  277                                        const std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  281     xics.resize(features.size());
 
  282     for (
Size i = 0; i < features.size(); ++i)
 
  284       getXIC_(mass_ranges[i], xics[i], experiment, normalize);
 
  288   template <
typename InputPeakType>
 
  291                                                                      std::vector<IndexTriple> & variable_indices,
 
  292                                                                      std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  293                                                                      std::set<Int> & charges_set, 
UInt ms2_spectra_per_rt_bin,
 
  294                                                                      std::vector<int> & solution_indices)
 
  297     std::vector<std::vector<DoubleReal> > intensity_weights;
 
  298     calculateXICs_(intensity_weights, features, experiment, mass_ranges, 
true);
 
  300     std::cout << 
"got xics" << std::endl;
 
  303     createAndSolveILP_(features, intensity_weights, charges_set, mass_ranges, variable_indices, solution_indices,
 
  304                        ms2_spectra_per_rt_bin, experiment.
size());
 
  309     os << 
"feature: " << triple.
feature << 
" scan: " << triple.
scan << 
" variable: " << triple.
variable << 
" prot_acc: " << triple.
prot_acc;
 
  313   template <
typename InputPeakType>
 
  316                                                                             std::vector<IndexTriple> & variable_indices,
 
  317                                                                             std::vector<Int> & solution_indices,
 
  318                                                                             std::vector<std::vector<std::pair<Size, Size> > > & mass_ranges,
 
  319                                                                             std::set<Int> & charges_set, 
UInt ms2_spectra_per_rt_bin,
 
  320                                                                             Size step_size, 
bool sequential_order)
 
  323     std::vector<std::vector<DoubleReal> > intensity_weights;
 
  324     calculateXICs_(intensity_weights, features, experiment, mass_ranges, 
true);
 
  326     std::cout << 
"got xics" << std::endl;
 
  330                                           experiment.
size(), step_size, sequential_order);
 
  335 #endif // OPENMS_ANALYSIS_ID_PSLPFORMULATION_H 
A more convenient string class. 
Definition: String.h:56
Size size() const 
Definition: MSExperiment.h:117
SOLVER
Definition: LPWrapper.h:124
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
Definition: LPWrapper.h:61
OPENSWATHALGO_DLLAPI void normalize(const std::vector< double > &intensities, double normalization_factor, std::vector< double > &normalized_intensities)
Normalize intensities in vector by normalization_factor. 
This class implements the database preprocessing needing for precursor ion selection. 
Definition: PrecursorIonSelectionPreprocessing.h:56
An LC-MS feature. 
Definition: Feature.h:66
This class implements protein inference for the precursor ion selection strategies. 
Definition: PSProteinInference.h:53
Representation of a mass spectrometry experiment. 
Definition: MSExperiment.h:68
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144
A base class for all classes handling default parameters. 
Definition: DefaultParamHandler.h:90
int Int
Signed integer type. 
Definition: Types.h:100