/usr/include/OpenMS/ANALYSIS/QUANTITATION/ProteinResolver.h is in libopenms-dev 1.11.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | // --------------------------------------------------------------------------
// OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
//
// This software is released under a three-clause BSD license:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of any author or any participating institution
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: David Wojnar $
// $Authors: David Wojnar $
// --------------------------------------------------------------------------
#ifndef OPENMS_ANALYSIS_QUANTITATION_PROTEINRESOLVER_H
#define OPENMS_ANALYSIS_QUANTITATION_PROTEINRESOLVER_H
#include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
#include <OpenMS/KERNEL/ConsensusMap.h>
#include <OpenMS/KERNEL/FeatureMap.h>
#include <OpenMS/FORMAT/FASTAFile.h>
#include <OpenMS/METADATA/PeptideIdentification.h>
#include <OpenMS/METADATA/ProteinIdentification.h>
#include <OpenMS/CHEMISTRY/EnzymaticDigestion.h>
namespace OpenMS
{
/**
@brief Helper class for peptide and protein quantification based on feature data annotated with IDs
This class is used by @ref TOPP_ProteinResolver. See there for further documentation.
@htmlinclude OpenMS_ProteinResolver.parameters
@ingroup Analysis_QUANTITATION
*/
class OPENMS_DLLAPI ProteinResolver :
public DefaultParamHandler
{
public:
//default construtor
ProteinResolver();
//copy constructor
ProteinResolver(const ProteinResolver & rhs);
//assignment operator
ProteinResolver & operator=(const ProteinResolver & rhs);
//destructor
virtual ~ProteinResolver();
struct ProteinEntry;
struct PeptideEntry;
struct ISDGroup;
struct MSDGroup;
struct ResolverResult;
//represents a protein from fasta file
struct ProteinEntry
{
std::list<PeptideEntry *> peptides;
bool traversed;
FASTAFile::FASTAEntry * fasta_entry;
enum type {primary, secondary, primary_indistinguishable, secondary_indistinguishable} protein_type;
DoubleReal weight; //monoisotopic
Real coverage; //in percent
//if Protein is indistinguishable all his fellows are in the list indis
std::list<ProteinEntry *> indis;
Size index;
Size msd_group; //index
Size isd_group; //index
Size number_of_experimental_peptides;
};
//represents a peptide. First in silco. If experimental is set to true it is MS/MS derived.
struct PeptideEntry
{
std::list<ProteinEntry *> proteins;
bool traversed;
String sequence;
Size peptide_identification;
Size peptide_hit;
Size index;
Size msd_group; //index
Size isd_group; //index
bool experimental;
Real intensity;
String origin;
};
//representation of an msd group. contains peptides, proteins and a pointer to its ISD group
struct MSDGroup
{
std::list<ProteinEntry *> proteins;
std::list<PeptideEntry *> peptides;
Size index;
ISDGroup * isd_group;
Size number_of_decoy;
Size number_of_target;
Size number_of_target_plus_decoy;
Real intensity; // intensity of the MSD Group. Defined as the median of the peptide intensities.
};
struct ISDGroup
{
std::list<ProteinEntry *> proteins;
std::list<PeptideEntry *> peptides;
Size index;
std::list<Size> msd_groups;
};
struct ResolverResult
{
String identifier;
std::vector<ISDGroup> * isds;
std::vector<MSDGroup> * msds;
std::vector<ProteinEntry> * protein_entries;
std::vector<PeptideEntry> * peptide_entries;
std::vector<Size> * reindexed_peptides;
std::vector<Size> * reindexed_proteins;
enum type {PeptideIdent, Consensus} input_type;
std::vector<PeptideIdentification> * peptide_identification;
ConsensusMap * consensus_map;
};
/**
@brief Computing protein groups from peptide identifications OR consensus map.
Computes ISD and MSD groups.
@param consensus ConsensusMap in case consensusXML file is given as input
*/
void resolveConsensus(ConsensusMap & consensus);
/**
@brief Computing protein groups from peptide identifications OR consensus map.
Computes ISD and MSD groups.
@param peptide_identifications Vector of PeptideIdentification in case idXML is given as input
*/
void resolveID(std::vector<PeptideIdentification> & peptide_identifications);
/**
@brief NOT IMPLEMENTED YET
@param protein_nodes
@param peptide_nodes
@param reindexed_proteins
@param reindexed_peptides
@param peptide_identifications
@param output
*/
// void writeProteinsAndPeptidesmzTab(std::vector<ProteinEntry>& protein_nodes, std::vector<PeptideEntry>& peptide_nodes, std::vector<Size>& reindexed_proteins, std::vector<Size>& reindexed_peptides, std::vector<PeptideIdentification>& peptide_identifications, String& output );
/**
@brief Writing peptide table into text file
@param peptides
@param reindexed_peptides
@param identifications
@param output_file
*/
// void writePeptideTable(std::vector<PeptideEntry> & peptides, std::vector<Size> & reindexed_peptides, std::vector<PeptideIdentification> & identifications, String & output_file); // not implemented
/**
@brief Writing peptide table into text file
@param peptides
@param reindexed_peptides
@param consensus
@param output
*/
// void writePeptideTable(std::vector<PeptideEntry> & peptides, std::vector<Size> & reindexed_peptides, ConsensusMap & consensus, String & output_file); // not implemented
/**
@brief Writing protein table into text file
@param proteins
@param reindexed_proteins
@param output_file
*/
// void writeProteinTable(std::vector<ProteinEntry> & proteins, std::vector<Size> & reindexed_proteins, String & output_file); // not implemented
/**
@brief Writing protein groups into text file
@param isd_groups ISD groups
@param msd_groups MSD groups
@param output_file Path of output file
*/
// void writeProteinGroups(std::vector<ISDGroup> & isd_groups, std::vector<MSDGroup> & msd_groups, String & output_file); // not implemented
/**
@brief brief
@param msd_groups
@param consensus
*/
void countTargetDecoy(std::vector<MSDGroup> & msd_groups, ConsensusMap & consensus);
/**
@brief brief
@param msd_groups
@param peptide_nodes
*/
void countTargetDecoy(std::vector<MSDGroup> & msd_groups, std::vector<PeptideIdentification> & peptide_nodes);
void clearResult();
void setProteinData(std::vector<FASTAFile::FASTAEntry> & protein_data);
const std::vector<ResolverResult> & getResults();
//overloaded functions -- return a const reference to a PeptideIdentification object or a peptideHit either from a consensusMap or a vector<PeptideIdentification>
static const PeptideIdentification & getPeptideIdentification(const ConsensusMap & consensus, const PeptideEntry * peptide);
static const PeptideHit & getPeptideHit(const ConsensusMap & consensus, const PeptideEntry * peptide);
static const PeptideIdentification & getPeptideIdentification(const std::vector<PeptideIdentification> & peptide_nodes, const PeptideEntry * peptide);
static const PeptideHit & getPeptideHit(const std::vector<PeptideIdentification> & peptide_nodes, const PeptideEntry * peptide);
private:
std::vector<ResolverResult> resolver_result_;
std::vector<FASTAFile::FASTAEntry> protein_data_;
void computeIntensityOfMSD_(std::vector<MSDGroup> & msd_groups);
//travers Protein and peptide nodes. Once for building ISD groups and once for building MSD groups
void traversProtein_(ProteinEntry * prot_node, ISDGroup & group);
void traversProtein_(ProteinEntry * prot_node, MSDGroup & group);
void traversPeptide_(PeptideEntry * pep_node, ISDGroup & group);
void traversPeptide_(PeptideEntry * pep_node, MSDGroup & group);
//searches given sequence in all nodes and returns its index or nodes.size() if not found.
Size findPeptideEntry_(String seq, std::vector<PeptideEntry> & nodes);
//helper function for findPeptideEntry.
Size binarySearchNodes_(String & seq, std::vector<PeptideEntry> & nodes, Size start, Size end);
//includes all MSMS derived peptides into the graph --idXML
Size includeMSMSPeptides_(std::vector<PeptideIdentification> & peptide_identifications, std::vector<PeptideEntry> & peptide_nodes);
//TODO include run information for each peptide
//includes all MSMS derived peptides into the graph --consensusXML
Size includeMSMSPeptides_(ConsensusMap & consensus, std::vector<PeptideEntry> & peptide_nodes);
//Proteins and Peptides get reindexed, based on whether they belong to msd groups or not. Indexes of Proteins which are in an ISD group but in none of the MSD groups will not be used anymore.
void reindexingNodes_(std::vector<MSDGroup> & msd_groups, std::vector<Size> & reindexed_proteins, std::vector<Size> & reindexed_peptides);
//marks Proteins which have a unique peptide as primary. Uses reindexed vector, thus reindexingNodes has to be called before.
void primaryProteins_(std::vector<PeptideEntry> & peptide_nodes, std::vector<Size> & reindexed_peptides);
void buildingMSDGroups_(std::vector<MSDGroup> & msd_groups, std::vector<ISDGroup> & isd_groups);
void buildingISDGroups_(std::vector<ProteinEntry> & protein_nodes, std::vector<PeptideEntry> & peptide_nodes,
std::vector<ISDGroup> & isd_groups);
//not tested
//ProteinResolver::indistinguishableProteins(vector<MSDGroup>& msd_groups);
}; // class
} // namespace
#endif // OPENMS_ANALYSIS_QUANTITATION_PROTEINRESOLVER_H
|