Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_ANALYSIS_QUANTITATION_PROTEINRESOLVER_H
00036 #define OPENMS_ANALYSIS_QUANTITATION_PROTEINRESOLVER_H
00037
00038 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
00039 #include <OpenMS/KERNEL/ConsensusMap.h>
00040 #include <OpenMS/KERNEL/FeatureMap.h>
00041 #include <OpenMS/FORMAT/FASTAFile.h>
00042 #include <OpenMS/METADATA/PeptideIdentification.h>
00043 #include <OpenMS/METADATA/ProteinIdentification.h>
00044 #include <OpenMS/CHEMISTRY/EnzymaticDigestion.h>
00045
00046
00047 namespace OpenMS
00048 {
00059 class OPENMS_DLLAPI ProteinResolver :
00060 public DefaultParamHandler
00061 {
00062
00063 public:
00064
00065
00066 ProteinResolver();
00067
00068
00069 ProteinResolver(const ProteinResolver & rhs);
00070
00071
00072 ProteinResolver & operator=(const ProteinResolver & rhs);
00073
00074
00075 virtual ~ProteinResolver();
00076
00077
00078 struct ProteinEntry;
00079 struct PeptideEntry;
00080 struct ISDGroup;
00081 struct MSDGroup;
00082 struct ResolverResult;
00083
00084
00085 struct ProteinEntry
00086 {
00087 std::list<PeptideEntry *> peptides;
00088 bool traversed;
00089 FASTAFile::FASTAEntry * fasta_entry;
00090 enum type {primary, secondary, primary_indistinguishable, secondary_indistinguishable} protein_type;
00091 DoubleReal weight;
00092 Real coverage;
00093
00094 std::list<ProteinEntry *> indis;
00095 Size index;
00096 Size msd_group;
00097 Size isd_group;
00098 Size number_of_experimental_peptides;
00099 };
00100
00101
00102 struct PeptideEntry
00103 {
00104 std::list<ProteinEntry *> proteins;
00105 bool traversed;
00106 String sequence;
00107 Size peptide_identification;
00108 Size peptide_hit;
00109 Size index;
00110 Size msd_group;
00111 Size isd_group;
00112 bool experimental;
00113 Real intensity;
00114 String origin;
00115 };
00116
00117
00118 struct MSDGroup
00119 {
00120 std::list<ProteinEntry *> proteins;
00121 std::list<PeptideEntry *> peptides;
00122 Size index;
00123 ISDGroup * isd_group;
00124 Size number_of_decoy;
00125 Size number_of_target;
00126 Size number_of_target_plus_decoy;
00127 Real intensity;
00128 };
00129
00130 struct ISDGroup
00131 {
00132 std::list<ProteinEntry *> proteins;
00133 std::list<PeptideEntry *> peptides;
00134 Size index;
00135 std::list<Size> msd_groups;
00136 };
00137
00138 struct ResolverResult
00139 {
00140 String identifier;
00141 std::vector<ISDGroup> * isds;
00142 std::vector<MSDGroup> * msds;
00143 std::vector<ProteinEntry> * protein_entries;
00144 std::vector<PeptideEntry> * peptide_entries;
00145 std::vector<Size> * reindexed_peptides;
00146 std::vector<Size> * reindexed_proteins;
00147 enum type {PeptideIdent, Consensus} input_type;
00148 std::vector<PeptideIdentification> * peptide_identification;
00149 ConsensusMap * consensus_map;
00150 };
00151
00159 void resolveConsensus(ConsensusMap & consensus);
00160
00168 void resolveID(std::vector<PeptideIdentification> & peptide_identifications);
00169
00180
00189 void writePeptideTable(std::vector<PeptideEntry> & peptides, std::vector<Size> & reindexed_peptides, std::vector<PeptideIdentification> & identifications, String & output_file);
00198 void writePeptideTable(std::vector<PeptideEntry> & peptides, std::vector<Size> & reindexed_peptides, ConsensusMap & consensus, String & output_file);
00206 void writeProteinTable(std::vector<ProteinEntry> & proteins, std::vector<Size> & reindexed_proteins, String & output_file);
00214 void writeProteinGroups(std::vector<ISDGroup> & isd_groups, std::vector<MSDGroup> & msd_groups, String & output_file);
00215
00222 void countTargetDecoy(std::vector<MSDGroup> & msd_groups, ConsensusMap & consensus);
00223
00231 void countTargetDecoy(std::vector<MSDGroup> & msd_groups, std::vector<PeptideIdentification> & peptide_nodes);
00232
00233 void clearResult();
00234
00235 void setProteinData(std::vector<FASTAFile::FASTAEntry> & protein_data);
00236
00237 const std::vector<ResolverResult> & getResults();
00238
00239
00240 const PeptideIdentification & getPeptideIdentification(const ConsensusMap & consensus, const PeptideEntry * peptide);
00241 const PeptideHit & getPeptideHit(const ConsensusMap & consensus, const PeptideEntry * peptide);
00242 const PeptideIdentification & getPeptideIdentification(const std::vector<PeptideIdentification> & peptide_nodes, const PeptideEntry * peptide);
00243 const PeptideHit & getPeptideHit(const std::vector<PeptideIdentification> & peptide_nodes, const PeptideEntry * peptide);
00244
00245 private:
00246
00247 std::vector<ResolverResult> resolver_result_;
00248 std::vector<FASTAFile::FASTAEntry> protein_data_;
00249
00250 void computeIntensityOfMSD_(std::vector<MSDGroup> & msd_groups);
00251
00252
00253 void traversProtein_(ProteinEntry * prot_node, ISDGroup & group);
00254 void traversProtein_(ProteinEntry * prot_node, MSDGroup & group);
00255 void traversPeptide_(PeptideEntry * pep_node, ISDGroup & group);
00256 void traversPeptide_(PeptideEntry * pep_node, MSDGroup & group);
00257
00258 Size findPeptideEntry_(String seq, std::vector<PeptideEntry> & nodes);
00259
00260 Size binarySearchNodes_(String & seq, std::vector<PeptideEntry> & nodes, Size start, Size end);
00261
00262 Size includeMSMSPeptides_(std::vector<PeptideIdentification> & peptide_identifications, std::vector<PeptideEntry> & peptide_nodes);
00263
00264
00265 Size includeMSMSPeptides_(ConsensusMap & consensus, std::vector<PeptideEntry> & peptide_nodes);
00266
00267 void reindexingNodes_(std::vector<MSDGroup> & msd_groups, std::vector<Size> & reindexed_proteins, std::vector<Size> & reindexed_peptides);
00268
00269 void primaryProteins_(std::vector<PeptideEntry> & peptide_nodes, std::vector<Size> & reindexed_peptides);
00270 void buildingMSDGroups_(std::vector<MSDGroup> & msd_groups, std::vector<ISDGroup> & isd_groups);
00271 void buildingISDGroups_(std::vector<ProteinEntry> & protein_nodes, std::vector<PeptideEntry> & peptide_nodes,
00272 std::vector<ISDGroup> & isd_groups);
00273
00274
00275
00276 };
00277
00278 }
00279
00280 #endif // OPENMS_ANALYSIS_QUANTITATION_PROTEINRESOLVER_H