65 std::map<Int, std::map<Int, SampleAbundances>>
abundances;
68 std::map<Int, std::map<Int, SampleAbundances>>
psm_counts;
139 n_samples(0), quant_proteins(0), too_few_peptides(0),
140 quant_peptides(0), total_peptides(0), quant_features(0),
141 total_features(0), blank_features(0), ambig_features(0) {}
170 std::vector<PeptideIdentification>& peptides,
183 std::vector<PeptideIdentification>());
207 const UInt n_samples,
208 bool remove_unquantified =
true);
251 const std::map<
Int, std::map<Int, SampleAbundances>> & peptide_abundances,
252 std::pair<size_t, size_t> & best)
254 size_t best_n_quant(0);
255 double best_abundance(0);
256 best = std::make_pair(0,0);
258 for (
auto & fa : peptide_abundances)
260 for (
auto & ca : fa.second)
262 const Int & fraction = fa.first;
263 const Int & charge = ca.first;
265 double current_abundance = std::accumulate(
266 std::begin(ca.second),
269 [] (
int value,
const SampleAbundances::value_type& p)
270 { return value + p.second; }
273 if (current_abundance <= 0) {
continue; }
275 const size_t current_n_quant = ca.second.size();
276 if (current_n_quant > best_n_quant)
278 best_abundance = current_abundance;
279 best_n_quant = current_n_quant;
280 best = std::make_pair(fraction, charge);
282 else if (current_n_quant == best_n_quant
283 && current_abundance > best_abundance)
285 best_abundance = current_abundance;
286 best = std::make_pair(fraction, charge);
290 return best_abundance > 0.;
298 template <
typename T>
299 void orderBest_(
const std::map<T, SampleAbundances> & abundances,
300 std::vector<T>& result)
302 typedef std::pair<Size, double> PairType;
303 std::multimap<PairType, T, std::greater<PairType> > order;
304 for (
typename std::map<T, SampleAbundances>::const_iterator ab_it =
305 abundances.begin(); ab_it != abundances.end(); ++ab_it)
308 for (SampleAbundances::const_iterator samp_it = ab_it->second.begin();
309 samp_it != ab_it->second.end(); ++samp_it)
311 total += samp_it->second;
313 if (total <= 0.0)
continue;
314 PairType key = std::make_pair(ab_it->second.size(), total);
315 order.insert(std::make_pair(key, ab_it->first));
318 for (
typename std::multimap<PairType, T, std::greater<PairType> >::
319 iterator ord_it = order.begin(); ord_it != order.end(); ++ord_it)
321 result.push_back(ord_it->second);
345 std::map<String, String>& accession_to_leader);
A container for consensus elements.
Definition: ConsensusMap.h:88
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
Representation of an experimental design in OpenMS. Instances can be loaded with the ExperimentalDesi...
Definition: ExperimentalDesign.h:244
Representation of a Peak2D, RichPeak2D or Feature .
Definition: FeatureHandle.h:60
A container for features.
Definition: FeatureMap.h:105
Helper class for peptide and protein quantification based on feature data annotated with IDs.
Definition: PeptideAndProteinQuant.h:55
void readQuantData(ConsensusMap &consensus, const ExperimentalDesign &ed)
Read quantitative data from a consensus map.
std::map< AASequence, PeptideData > PeptideQuant
Mapping: peptide sequence (modified) -> peptide data.
Definition: PeptideAndProteinQuant.h:87
void readQuantData(FeatureMap &features, const ExperimentalDesign &ed)
Read quantitative data from a feature map.
void quantifyPeptides(const std::vector< PeptideIdentification > &peptides=std::vector< PeptideIdentification >())
Compute peptide abundances.
std::map< String, ProteinData > ProteinQuant
Mapping: protein accession -> protein data.
Definition: PeptideAndProteinQuant.h:114
const ProteinQuant & getProteinResults()
Get protein abundance data.
void quantifyFeature_(const FeatureHandle &feature, size_t fraction, size_t sample, const PeptideHit &hit)
Gather quantitative information from a feature.
void countPeptides_(std::vector< PeptideIdentification > &peptides, const Size &n_fractions)
Count the number of identifications (best hits only) of each peptide sequence and initializes the res...
bool getBest_(const std::map< Int, std::map< Int, SampleAbundances >> &peptide_abundances, std::pair< size_t, size_t > &best)
Determine fraction and charge state of a peptide with the highest number of abundances.
Definition: PeptideAndProteinQuant.h:250
static void annotateQuantificationsToProteins(const ProteinQuant &protein_quants, ProteinIdentification &proteins, const UInt n_samples, bool remove_unquantified=true)
Annotate protein quant results as meta data to protein ids.
PeptideQuant pep_quant_
Peptide quantification data.
Definition: PeptideAndProteinQuant.h:216
const PeptideQuant & getPeptideResults()
Get peptide abundance data.
~PeptideAndProteinQuant() override
Destructor.
Definition: PeptideAndProteinQuant.h:148
void updateMembers_() override
Clear all data when parameters are set.
void normalizePeptides_()
Normalize peptide abundances across samples by (multiplicative) scaling to equal medians.
String getAccession_(const std::set< String > &pep_accessions, std::map< String, String > &accession_to_leader)
Get the "canonical" protein accession from the list of protein accessions of a peptide.
void quantifyProteins(const ProteinIdentification &proteins=ProteinIdentification())
Compute protein abundances.
Statistics stats_
Processing statistics for output in the end.
Definition: PeptideAndProteinQuant.h:213
PeptideHit getAnnotation_(std::vector< PeptideIdentification > &peptides)
Get the "canonical" annotation (a single peptide hit) of a feature/consensus feature from the associa...
const Statistics & getStatistics()
Get summary statistics.
void orderBest_(const std::map< T, SampleAbundances > &abundances, std::vector< T > &result)
Order keys (charges/peptides for peptide/protein quantification) according to how many samples they a...
Definition: PeptideAndProteinQuant.h:299
std::map< UInt64, double > SampleAbundances
Mapping: sample ID -> abundance.
Definition: PeptideAndProteinQuant.h:59
ProteinQuant prot_quant_
Protein quantification data.
Definition: PeptideAndProteinQuant.h:219
PeptideAndProteinQuant()
Constructor.
void readQuantData(std::vector< ProteinIdentification > &proteins, std::vector< PeptideIdentification > &peptides, const ExperimentalDesign &ed)
Read quantitative data from identification results (for quantification via spectral counting).
Representation of a peptide hit.
Definition: PeptideHit.h:57
Representation of a protein identification run.
Definition: ProteinIdentification.h:72
A more convenient string class.
Definition: String.h:61
int Int
Signed integer type.
Definition: Types.h:102
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Quantitative and associated data for a peptide.
Definition: PeptideAndProteinQuant.h:63
SampleAbundances total_psm_counts
spectral counting-based abundances
Definition: PeptideAndProteinQuant.h:74
SampleAbundances total_abundances
mapping: sample -> total abundance
Definition: PeptideAndProteinQuant.h:71
std::set< String > accessions
protein accessions for this peptide
Definition: PeptideAndProteinQuant.h:77
std::map< Int, std::map< Int, SampleAbundances > > abundances
mapping: fraction -> charge -> sample -> abundance
Definition: PeptideAndProteinQuant.h:65
std::map< Int, std::map< Int, SampleAbundances > > psm_counts
mapping: fraction -> charge -> sample -> abundance
Definition: PeptideAndProteinQuant.h:68
PeptideData()=default
constructor
Quantitative and associated data for a protein.
Definition: PeptideAndProteinQuant.h:91
ProteinData()=default
constructor
SampleAbundances total_psm_counts
spectral counting-based abundances
Definition: PeptideAndProteinQuant.h:101
SampleAbundances total_abundances
mapping: sample -> total abundance
Definition: PeptideAndProteinQuant.h:98
std::map< String, SampleAbundances > abundances
mapping: peptide (unmodified) -> sample -> abundance
Definition: PeptideAndProteinQuant.h:93
std::map< String, SampleAbundances > psm_counts
Definition: PeptideAndProteinQuant.h:95
SampleAbundances total_distinct_peptides
number of distinct peptide sequences
Definition: PeptideAndProteinQuant.h:104
Statistics for processing summary.
Definition: PeptideAndProteinQuant.h:118
Size quant_proteins
protein statistics
Definition: PeptideAndProteinQuant.h:129
Size quant_peptides
peptide statistics
Definition: PeptideAndProteinQuant.h:132
Size n_samples
number of samples (or assays in mzTab terms)
Definition: PeptideAndProteinQuant.h:120
Size n_fractions
number of fractions
Definition: PeptideAndProteinQuant.h:123
Statistics()
constructor
Definition: PeptideAndProteinQuant.h:138
Size n_ms_files
number of MS files
Definition: PeptideAndProteinQuant.h:126
Size ambig_features
Definition: PeptideAndProteinQuant.h:135