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_FORMAT_PEPXMLFILE_H
00036 #define OPENMS_FORMAT_PEPXMLFILE_H
00037
00038 #include <OpenMS/CHEMISTRY/AASequence.h>
00039 #include <OpenMS/CHEMISTRY/Element.h>
00040 #include <OpenMS/FORMAT/HANDLERS/XMLHandler.h>
00041 #include <OpenMS/FORMAT/XMLFile.h>
00042 #include <OpenMS/KERNEL/MSExperiment.h>
00043 #include <OpenMS/METADATA/PeptideIdentification.h>
00044 #include <OpenMS/METADATA/ProteinIdentification.h>
00045
00046 #include <vector>
00047 #include <map>
00048 #include <set>
00049
00050
00051 namespace OpenMS
00052 {
00060 class OPENMS_DLLAPI PepXMLFile :
00061 protected Internal::XMLHandler,
00062 public Internal::XMLFile
00063 {
00064 public:
00065
00067 PepXMLFile();
00068
00070 virtual ~PepXMLFile();
00071
00085 void load(const String & filename, std::vector<ProteinIdentification> & proteins, std::vector<PeptideIdentification> & peptides, const String & experiment_name, const MSExperiment<> & experiment, bool use_precursor_data = false);
00086
00093 void load(const String & filename, std::vector<ProteinIdentification> & proteins, std::vector<PeptideIdentification> & peptides, const String & experiment_name = "");
00094
00100 void store(const String & filename, std::vector<ProteinIdentification> & protein_ids, std::vector<PeptideIdentification> & peptide_ids);
00101
00102 protected:
00103
00105 virtual void endElement(const XMLCh * const , const XMLCh * const , const XMLCh * const qname);
00106
00108 virtual void startElement(const XMLCh * const , const XMLCh * const , const XMLCh * const qname, const xercesc::Attributes & attributes);
00109
00110 private:
00111
00113 void makeScanMap_();
00114
00116 void readRTMZCharge_(const xercesc::Attributes & attributes);
00117
00130 void matchModification_(const DoubleReal mass, const String & origin, String & modification_description);
00131
00132 struct AminoAcidModification
00133 {
00134 String aminoacid;
00135 String massdiff;
00136 DoubleReal mass;
00137 bool variable;
00138 String description;
00139 String terminus;
00140
00141 AminoAcidModification() :
00142 mass(0),
00143 variable(false)
00144 {
00145 }
00146
00147 AminoAcidModification(const AminoAcidModification & rhs) :
00148 aminoacid(rhs.aminoacid),
00149 massdiff(rhs.massdiff),
00150 mass(rhs.mass),
00151 variable(rhs.variable),
00152 description(rhs.description),
00153 terminus(rhs.terminus)
00154 {
00155 }
00156
00157 virtual ~AminoAcidModification()
00158 {
00159 }
00160
00161 AminoAcidModification & operator=(const AminoAcidModification & rhs)
00162 {
00163 if (this != &rhs)
00164 {
00165 aminoacid = rhs.aminoacid;
00166 massdiff = rhs.massdiff;
00167 mass = rhs.mass;
00168 variable = rhs.variable;
00169 description = rhs.description;
00170 terminus = rhs.terminus;
00171 }
00172 return *this;
00173 }
00174
00175 };
00176
00178 std::vector<ProteinIdentification> * proteins_;
00179
00181 std::vector<PeptideIdentification> * peptides_;
00182
00184 const MSExperiment<> * experiment_;
00185
00187 String exp_name_;
00188
00190 String search_engine_;
00191
00193 bool use_precursor_data_;
00194
00196 std::map<Size, Size> scan_map_;
00197
00199 DoubleReal rt_tol_, mz_tol_;
00200
00202 Element hydrogen_;
00203
00205 bool wrong_experiment_;
00206
00208 bool seen_experiment_;
00209
00211 std::vector<std::vector<ProteinIdentification>::iterator> current_proteins_;
00212
00214 ProteinIdentification::SearchParameters params_;
00215
00217 ProteinIdentification::DigestionEnzyme enzyme_;
00218
00220 PeptideIdentification current_peptide_;
00221
00223 PeptideHit peptide_hit_;
00224
00226 String current_sequence_;
00227
00229 DoubleReal rt_, mz_;
00230
00232 Int charge_;
00233
00235 UInt search_id_;
00236
00238 String prot_id_;
00239
00241 DateTime date_;
00242
00244 DoubleReal hydrogen_mass_;
00245
00247 std::vector<std::pair<String, Size> > current_modifications_;
00248
00250 std::vector<AminoAcidModification> fixed_modifications_;
00251
00253 std::vector<AminoAcidModification> variable_modifications_;
00254
00256
00257 };
00258
00259 }
00260
00261 #endif // OPENMS_FORMAT_PEPXMLFILE_H