Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

PepXMLFile.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Chris Bielow, Hendrik Weisser $
00032 // $Authors: Chris Bielow, Hendrik Weisser $
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 /*uri*/, const XMLCh * const /*local_name*/, const XMLCh * const qname);
00106 
00108     virtual void startElement(const XMLCh * const /*uri*/, const XMLCh * const /*local_name*/, 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 } // namespace OpenMS
00260 
00261 #endif // OPENMS_FORMAT_PEPXMLFILE_H

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:43 using doxygen 1.7.1