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

MzTab.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: Timo Sachsenberg $
00032 // $Authors: Timo Sachsenberg $
00033 // --------------------------------------------------------------------------
00034 
00035 #ifndef OPENMS_FORMAT_MZTAB_H
00036 #define OPENMS_FORMAT_MZTAB_H
00037 
00038 #include <OpenMS/FORMAT/SVOutStream.h>
00039 #include <OpenMS/CONCEPT/Exception.h>
00040 #include <map>
00041 #include <vector>
00042 #include <list>
00043 #include <algorithm>
00044 #include <OpenMS/DATASTRUCTURES/StringList.h>
00045 
00046 namespace OpenMS
00047 {
00057   // interface for all MzTab datatypes that can be NA
00058   class MzTabNAAbleInterface
00059   {
00060   public:
00061     virtual bool isNA() const = 0;
00062     virtual void setNA(bool na) = 0;
00063     virtual String toCellString() const = 0;
00064     virtual void fromCellString(String) = 0;
00065   };
00066 
00067   // base class for the atomic non-container like MzTab data types (Double, Int)
00068   class MzTabNAAbleBase : public MzTabNAAbleInterface
00069   {
00070   public:
00071     MzTabNAAbleBase():
00072         na_(true)
00073     {
00074     }
00075 
00076     bool isNA() const
00077     {
00078       return na_;
00079     }
00080 
00081     void setNA(bool na)
00082     {
00083       na_ = na;
00084     }
00085 
00086   protected:
00087     bool na_;
00088   };
00089 
00090   class MzTabDouble : public MzTabNAAbleBase
00091   {
00092   public:
00093     void set(const DoubleReal& value)
00094     {
00095       value_ = value;
00096     }
00097 
00098     DoubleReal get() const
00099     {
00100       return value_;
00101     }
00102 
00103     String toCellString() const
00104     {
00105       if (isNA())
00106       {
00107         return "NA";
00108       } else
00109       {
00110         return String(value_);
00111       }
00112     }
00113 
00114     void fromCellString(String s)
00115     {
00116       s.trim();
00117       if (s.toUpper() == "NA")
00118       {
00119         setNA(true);
00120       } else
00121       {
00122         value_ = s.toDouble();
00123       }
00124     }
00125 
00126   protected:
00127     DoubleReal value_;
00128   };
00129 
00130   class MzTabDoubleList : public MzTabNAAbleBase
00131   {
00132   public:
00133     MzTabDoubleList()
00134     {
00135     }
00136 
00137     bool isNA() const
00138     {
00139       return entries_.empty();
00140     }
00141 
00142     void setNA(bool na)
00143     {
00144       if (na)
00145       {
00146         entries_.clear();
00147       }
00148     }
00149 
00150     String toCellString() const
00151     {
00152       if (isNA())
00153       {
00154         return "NA";
00155       } else
00156       {
00157         String ret;
00158         for (std::vector<MzTabDouble>::const_iterator it = entries_.begin(); it != entries_.end(); ++it)
00159         {
00160           if (it != entries_.begin())
00161           {
00162             ret += ",";
00163           }
00164           ret += it->toCellString();
00165         }
00166         return ret;
00167       }
00168     }
00169 
00170     void fromCellString(String s)
00171     {
00172       s.trim();
00173       if (s.toUpper() == "NA")
00174       {
00175         setNA(true);
00176       } else
00177       {
00178         std::vector<String> fields;
00179         s.split(",", fields);
00180         for (Size i = 0; i != fields.size(); ++i)
00181         {
00182           MzTabDouble ds;
00183           ds.fromCellString(fields[i]);
00184           entries_.push_back(ds);
00185         }
00186       }
00187     }
00188 
00189     std::vector<MzTabDouble> get() const
00190     {
00191       return entries_;
00192     }
00193 
00194     void set(const std::vector<MzTabDouble>& entries)
00195     {
00196       entries_ = entries;
00197     }
00198 
00199   protected:
00200     std::vector<MzTabDouble> entries_;
00201   };
00202 
00203   class MzTabInteger : public MzTabNAAbleBase
00204   {
00205   public:
00206     void set(const Int& value)
00207     {
00208       value_ = value;
00209     }
00210 
00211     Int get() const
00212     {
00213       return value_;
00214     }
00215 
00216     String toCellString() const
00217     {
00218       if (isNA())
00219       {
00220         return "NA";
00221       } else
00222       {
00223         return String(value_);
00224       }
00225     }
00226 
00227     void fromCellString(String s)
00228     {
00229       s.trim();
00230       if (s.toUpper() == "NA")
00231       {
00232         setNA(true);
00233       } else
00234       {
00235         value_ = s.toInt();
00236       }
00237     }
00238 
00239   protected:
00240     Int value_;
00241   };
00242 
00243   class MzTabBoolean : public MzTabNAAbleBase
00244   {
00245   public:
00246     void set(const bool& value)
00247     {
00248       value_ = value;
00249     }
00250 
00251     Int get() const
00252     {
00253       return value_;
00254     }
00255 
00256     String toCellString() const
00257     {
00258       if (isNA())
00259       {
00260         return "NA";
00261       } else
00262       {
00263         if (value_)
00264         {
00265           return "1";
00266         } else
00267         {
00268           return "0";
00269         }
00270       }
00271     }
00272 
00273     void fromCellString(String s)
00274     {
00275       s.trim();
00276       if (s.toUpper() == "NA")
00277       {
00278         setNA(true);
00279       } else
00280       {
00281         if (s == "0")
00282         {
00283           value_ = false;
00284         } else if (s == "1")
00285         {
00286           value_ = true;
00287         } else
00288         {
00289           throw Exception::ConversionError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("Could not convert String '") +s + "' to MzTabBoolean");
00290         }
00291       }
00292     }
00293 
00294   protected:
00295     bool value_;
00296   };
00297 
00298   class MzTabString : public MzTabNAAbleInterface
00299   {
00300   public:
00301     void set(const String& value)
00302     {
00303       value_ = value;
00304     }
00305 
00306     String get() const
00307     {
00308       return value_;
00309     }
00310 
00311     bool isNA() const
00312     {
00313       return value_.empty();
00314     }
00315 
00316     void setNA(bool na)
00317     {
00318       if (na)
00319       {
00320         value_.clear();
00321       }
00322     }
00323 
00324     String toCellString() const
00325     {
00326       if (isNA())
00327       {
00328         return "NA";
00329       } else
00330       {
00331         return value_;
00332       }
00333     }
00334 
00335     void fromCellString(String s)
00336     {
00337       s.trim();
00338       if (s.toUpper() == "NA")
00339       {
00340         setNA(true);
00341       } else
00342       {
00343         value_ = s;
00344       }
00345     }
00346 
00347   protected:
00348     String value_;
00349   };
00350 
00351   class MzTabParameter : public MzTabNAAbleInterface
00352   {
00353   public:
00354     bool isNA() const
00355     {
00356       return (CV_label_.empty() && accession_.empty() && name_.empty() && value_.empty());
00357     }
00358 
00359     void setNA(bool na)
00360     {
00361       if (na)
00362       {
00363         CV_label_.clear();
00364         accession_.clear();
00365         name_.clear();
00366         value_.clear();
00367       }
00368     }
00369 
00370     void setCVLabel(const String& CV_label)
00371     {
00372       CV_label_ = CV_label;
00373     }
00374 
00375     void setAccession(const String& accession)
00376     {
00377       accession_ = accession;
00378     }
00379 
00380     void setName(const String& name)
00381     {
00382       name_ = name;
00383     }
00384 
00385     void setValue(const String& value)
00386     {
00387       value_ = value;
00388     }
00389 
00390     String getCVLabel() const
00391     {
00392       assert(!isNA());
00393       return CV_label_;
00394     }
00395 
00396     String getAccession() const
00397     {
00398       assert(!isNA());
00399       return accession_;
00400     }
00401 
00402     String getName() const
00403     {
00404       assert(!isNA());
00405       return name_;
00406     }
00407 
00408     String getValue() const
00409     {
00410       assert(!isNA());
00411       return value_;
00412     }
00413 
00414     String toCellString() const
00415     {
00416       if (isNA())
00417       {
00418         return "NA";
00419       } else
00420       {
00421         String ret = "[";
00422         ret += CV_label_ + ",";
00423         ret += accession_ + ",";
00424         ret += name_ + ",";
00425         ret += value_;
00426         ret += "]";
00427         return ret;
00428       }
00429     }
00430 
00431     void fromCellString(String s)
00432     {
00433       s.trim();
00434       if (s.toUpper() == "NA")
00435       {
00436         setNA(true);
00437       } else
00438       {
00439         std::vector<String> fields;
00440         s.split(',', fields);
00441         if (fields.size() != 4)
00442         {
00443           throw Exception::ConversionError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("Could not convert String '") + s + "' to MzTabParameter");
00444         } else
00445         {
00446           CV_label_ = fields[0];
00447           accession_ = fields[1];
00448           name_ = fields[2];
00449           value_ = fields[3];
00450         }
00451       }
00452     }
00453 
00454   protected:
00455     String CV_label_;
00456     String accession_;
00457     String name_;
00458     String value_;
00459   };
00460 
00461   class MzTabParameterList : public MzTabNAAbleInterface
00462   {
00463   public:
00464     bool isNA() const
00465     {
00466       return parameters_.empty();
00467     }
00468 
00469     void setNA(bool na)
00470     {
00471       if (na)
00472       {
00473         parameters_.clear();
00474       }
00475     }
00476 
00477     String toCellString() const
00478     {
00479       if (isNA())
00480       {
00481         return "NA";
00482       } else
00483       {
00484         String ret;
00485         for (std::vector<MzTabParameter>::const_iterator it = parameters_.begin(); it != parameters_.end(); ++it)
00486         {
00487           if (it != parameters_.begin())
00488           {
00489             ret += "|";
00490           }
00491           ret += it->toCellString();
00492         }
00493         return ret;
00494       }
00495     }
00496 
00497     void fromCellString(String s)
00498     {
00499       s.trim();
00500       if (s.toUpper() == "NA")
00501       {
00502         setNA(true);
00503       } else
00504       {
00505         std::vector<String> fields;
00506         s.split('|', fields);
00507         for (Size i = 0; i != fields.size(); ++i)
00508         {
00509           MzTabParameter p;
00510           if (fields[i].toUpper() == "NA")
00511           {
00512             throw Exception::ConversionError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("MzTabParameter in MzTabParameterList must not be NA '") + s);
00513           }
00514           p.fromCellString(fields[i]);
00515           parameters_.push_back(p);
00516         }
00517       }
00518     }
00519 
00520     std::vector<MzTabParameter> get() const
00521     {
00522       return parameters_;
00523     }
00524 
00525     void set(const std::vector<MzTabParameter>& parameters)
00526     {
00527       parameters_ = parameters;
00528     }
00529 
00530   protected:
00531     std::vector<MzTabParameter> parameters_;
00532   };
00533 
00534   class MzTabStringList : public MzTabNAAbleInterface
00535   {
00536   public:
00537     MzTabStringList():
00538         sep_('|')
00539     {
00540     }
00541 
00542     // needed for e.g. ambiguity_members and GO accessions as these use ',' as separator while the others use '|'
00543     void setSeparator(char sep)
00544     {
00545       sep_ = sep;
00546     }
00547 
00548     bool isNA() const
00549     {
00550       return entries_.empty();
00551     }
00552 
00553     void setNA(bool na)
00554     {
00555       if (na)
00556       {
00557         entries_.clear();
00558       }
00559     }
00560 
00561     String toCellString() const
00562     {
00563       if (isNA())
00564       {
00565         return "NA";
00566       } else
00567       {
00568         String ret;
00569         for (std::vector<MzTabString>::const_iterator it = entries_.begin(); it != entries_.end(); ++it)
00570         {
00571           if (it != entries_.begin())
00572           {
00573             ret += sep_;
00574           }
00575           ret += it->toCellString();
00576         }
00577         return ret;
00578       }
00579     }
00580 
00581     void fromCellString(String s)
00582     {
00583       s.trim();
00584       if (s.toUpper() == "NA")
00585       {
00586         setNA(true);
00587       } else
00588       {
00589         std::vector<String> fields;
00590         s.split(sep_, fields);
00591         for (Size i = 0; i != fields.size(); ++i)
00592         {
00593           MzTabString ts;
00594           ts.fromCellString(fields[i]);
00595           entries_.push_back(ts);
00596         }
00597       }
00598     }
00599 
00600     std::vector<MzTabString> get() const
00601     {
00602       return entries_;
00603     }
00604 
00605     void set(const std::vector<MzTabString>& entries)
00606     {
00607       entries_ = entries;
00608     }
00609 
00610   protected:
00611     std::vector<MzTabString> entries_;
00612     char sep_;
00613   };
00614 
00615   struct MzTabModification : public MzTabNAAbleInterface
00616   {
00617   public:
00618     MzTabModification():
00619         position_(-1),
00620         reliability_score_(-1)
00621     {
00622     }
00623 
00624     bool isNA() const
00625     {
00626       return ((position_ == -1) && (reliability_score_ == -1) && (mod_identifier_.empty()));
00627     }
00628 
00629     void setNA(bool na)
00630     {
00631       if (na)
00632       {
00633         position_ = -1;
00634         reliability_score_ = -1;
00635         mod_identifier_.clear();
00636       }
00637     }
00638 
00639     void setPosition(Int index)
00640     {
00641       position_ = index;
00642     }
00643 
00644     void setReliabilityScore(DoubleReal score)
00645     {
00646       reliability_score_ = score;
00647     }
00648 
00649     void setModIdentifier(String mod_id)
00650     {
00651       mod_identifier_ = mod_id;
00652     }
00653 
00654     Int getPosition() const
00655     {
00656       assert(!isNA());
00657       return position_;
00658     }
00659 
00660     DoubleReal getReliabilityScore() const
00661     {
00662       assert(!isNA());
00663       return reliability_score_;
00664     }
00665 
00666     String getModIdentifier() const
00667     {
00668       assert(!isNA());
00669       return mod_identifier_;
00670     }
00671 
00672     String toCellString() const
00673     {
00674       if (isNA())
00675       {
00676         return String("NA");
00677       } else
00678       {
00679         String position_string;
00680         if (position_  >= 0)
00681         {
00682           position_string = String(position_);
00683         }
00684 
00685         String reliablility_string;
00686         if (reliability_score_  >= -1e-10)
00687         {
00688           reliablility_string = String("[") + String(reliability_score_) + String("]");
00689         }
00690 
00691         String res;
00692         if (!(position_string.empty() && reliablility_string.empty()))
00693         {
00694           res = position_string + reliablility_string + "-" + mod_identifier_;
00695         } else
00696         {
00697           res = mod_identifier_;
00698         }
00699         return res;
00700       }
00701     }
00702 
00703     void fromCellString(String s)
00704     {
00705       s.trim();
00706       if (s.toUpper() == "NA")
00707       {
00708         setNA(true);
00709       } else
00710       {
00711         if (!s.hasSubstring("-"))  // no position or reliability fields? simply use s as mod identifier
00712         {
00713           position_ = -1;
00714           reliability_score_ = -1;
00715           mod_identifier_ = s;
00716         } else
00717         {
00718           std::vector<String> fields;
00719           s.split("-", fields);
00720           if (fields.size() != 2)
00721           {
00722             throw Exception::ConversionError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("Can't convert to MzTabModification from '") + s);
00723           }
00724           mod_identifier_ = fields[1];
00725 
00726           Size spos = fields[0].find_first_of("[");
00727           if (spos == std::string::npos)  // only position information
00728           {
00729             position_ = fields[0].toInt();
00730           } else
00731           {
00732             String pos_string(fields[0].begin(), fields[0].begin() + spos);
00733             String rel_string(fields[0].begin() + spos, fields[0].end());
00734 
00735             if (pos_string.empty())
00736             {
00737               position_ = -1;
00738             } else
00739             {
00740               position_ = pos_string.toInt();
00741             }
00742 
00743             if (rel_string.empty())
00744             {
00745               reliability_score_ = -1;
00746             } else
00747             {
00748               rel_string.remove('[').remove(']');
00749               reliability_score_ = rel_string.toDouble();
00750             }
00751           }
00752         }
00753       }
00754     }
00755 
00756   protected:
00757     Int position_;
00758     DoubleReal reliability_score_;
00759     String mod_identifier_;
00760   };
00761 
00762   class MzTabModificationList : public MzTabNAAbleBase
00763   {
00764   public:
00765     bool isNA() const
00766     {
00767       return entries_.empty();
00768     }
00769 
00770     void setNA(bool na)
00771     {
00772       if (na)
00773       {
00774         entries_.clear();
00775       }
00776     }
00777 
00778     String toCellString() const
00779     {
00780       if (isNA())
00781       {
00782         return "NA";
00783       } else
00784       {
00785         String ret;
00786         for (std::vector<MzTabModification>::const_iterator it = entries_.begin(); it != entries_.end(); ++it)
00787         {
00788           if (it != entries_.begin())
00789           {
00790             ret += ",";
00791           }
00792           ret += it->toCellString();
00793         }
00794         return ret;
00795       }
00796     }
00797 
00798     void fromCellString(String s)
00799     {
00800       s.trim();
00801       if (s.toUpper() == "NA")
00802       {
00803         setNA(true);
00804       } else
00805       {
00806         std::vector<String> fields;
00807         s.split(",", fields);
00808         for (Size i = 0; i != fields.size(); ++i)
00809         {
00810           MzTabModification ms;
00811           ms.fromCellString(fields[i]);
00812           entries_.push_back(ms);
00813         }
00814       }
00815     }
00816 
00817     std::vector<MzTabModification> get() const
00818     {
00819       return entries_;
00820     }
00821 
00822     void set(const std::vector<MzTabModification>& entries)
00823     {
00824       entries_ = entries;
00825     }
00826 
00827   protected:
00828     std::vector<MzTabModification> entries_;
00829 
00830   };
00831 
00832   class MzTabSpectraRef : public MzTabNAAbleInterface
00833   {
00834   public:
00835     MzTabSpectraRef():
00836         ms_file_(0)
00837     {
00838     }
00839 
00840     bool isNA() const
00841     {
00842       return ((ms_file_ < 1) || (spec_ref_.empty()));
00843     }
00844 
00845     void setNA(bool na)
00846     {
00847       if (na)
00848       {
00849         ms_file_ = 0;
00850         spec_ref_.clear();
00851       }
00852     }
00853 
00854     void setMSFile(Size index)
00855     {
00856       assert(index >= 1);
00857       if (index >= 1)
00858       {
00859         ms_file_ = index;
00860       }
00861     }
00862 
00863     void setSpecRef(String spec_ref)
00864     {
00865       assert(!spec_ref.empty());
00866       if (!spec_ref.empty())
00867       {
00868         spec_ref_ = spec_ref;
00869       }
00870     }
00871 
00872     String getSpecRef() const
00873     {
00874       assert(!isNA());
00875       return spec_ref_;
00876     }
00877 
00878     Size getMSFile() const
00879     {
00880       assert(!isNA());
00881       return ms_file_;
00882     }
00883 
00884     void setSpecRefFile(const String& spec_ref)
00885     {
00886       assert(!spec_ref.empty());
00887       if (!spec_ref.empty())
00888       {
00889         spec_ref_ = spec_ref;
00890       }
00891     }
00892 
00893     String toCellString() const
00894     {
00895       if (isNA())
00896       {
00897         return String("NA");
00898       } else
00899       {
00900         return String("ms_file[") + String(ms_file_) + "]:" + spec_ref_;
00901       }
00902     }
00903 
00904     void fromCellString(String s)
00905     {
00906       s.trim();
00907       if (s.toUpper() == "NA")
00908       {
00909         setNA(true);
00910       } else
00911       {
00912         std::vector<String> fields;
00913         s.split(':', fields);
00914         if (fields.size() != 2)
00915         {
00916           throw Exception::ConversionError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("Can not convert to MzTabSpectraRef from '") + s);
00917         }
00918 
00919         spec_ref_ = fields[1];
00920         ms_file_= (Size)(fields[0].substitute("ms_file[", "").remove(']').toInt());
00921       }
00922     }
00923 
00924   protected:
00925     Size ms_file_; // number is specified in the meta data section.
00926     String spec_ref_;
00927   };
00928 
00929   // MTD - Metadata section (Key-value)
00930 
00931   // all meta data belonging to a (potentially empty) sub unit id
00932   struct MzTabSubIdMetaData
00933   {
00934     // ranges denote multiplicity as specified in the specification document
00935     String sub_id; // 0..1 empty string if no sub samples have been recorded and SUB_ID is optional
00936     std::vector<MzTabParameter> species; // 0..* Species of the unit / subsample.
00937     std::vector<MzTabParameter> tissue; // 0..* Tissue of the unit / subsample.
00938     std::vector<MzTabParameter> cell_type; // 0..* Parameter  Cell type of the unit / subsample.
00939     std::vector<MzTabParameter> disease; // 0..* Disease state of the unit / subsample.
00940     std::vector<String> description; // 0..* Description of the subsample.
00941     std::vector<MzTabParameter> quantification_reagent; // 0..* Quantification reagent used to label the subsample.
00942     std::vector<MzTabParameter> custom; // 0..* Additional parameters for the subsample.
00943   };
00944 
00945   // all meta data belonging to one unit id
00946   struct MzTabUnitIdMetaData
00947   {
00948     MzTabUnitIdMetaData():
00949         title("NA"),
00950         description("NA")
00951     {
00952     }
00953 
00954     //String unit_id; // the unit id not NA able!
00955     String title; // 0..1 The unit’s title
00956     String description; // 0..1
00957     std::vector<MzTabParameterList> sample_processing; // 0..* Description of the sample processing.
00958     std::vector<MzTabParameter> instrument_source; // 0..* The instrument’s source
00959     std::vector<MzTabParameter> instrument_analyzer; // 0..* The instrument’s analyzer
00960     std::vector<MzTabParameter> instrument_detector; // 0..* The instrument’s detector
00961     std::vector<MzTabParameter> software; // 0..* Analysis software used in the order it was used.
00962     std::vector<MzTabParameterList> false_discovery_rate; // 0..* False discovery rate(s)for the experiment.
00963     std::vector<MzTabStringList> publication; // 0..* Publication ids (pubmed / doi).
00964     std::vector<MzTabString> contact_name; // 0..* Contact name.
00965     std::vector<MzTabString> contact_affiliation; // 0..* Contact affiliation.
00966     std::vector<MzTabString> contact_email; // 0..* Contact’s e-mail address.
00967     std::vector<String> uri; // 0..* Points to the unit’s source data.
00968     MzTabParameterList mod; // 0..1 Modifications reported in the unit.
00969     MzTabParameter mod_probability_method; // 0..1 Method used to report modification probabilities.
00970     MzTabParameter quantification_method; // 0..1 Quantification method used.
00971     MzTabParameter protein_quantification_unit; // 0..1 Unit of protein quantification results.
00972     MzTabParameter peptide_quantification_unit; // 0..1 Unit of peptide quantification results.
00973     std::vector<MzTabParameter> ms_file_format; // // 0..* Data format of the external MS data file.
00974     std::vector<MzTabParameter> ms_file_location; // 0..* Location of the external MS data file.
00975     std::vector<MzTabParameter> ms_file_id_format; // 0..* Identifier format of the external MS data file.
00976     std::vector<MzTabParameter> custom; // 0..*  Additional parameters.
00977     std::vector<MzTabSubIdMetaData> sub_id_data; // can contain none, one or multiple sub ids
00978   };
00979 
00980   typedef std::pair<String, MzTabString> MzTabOptionalColumnEntry; //  column name (not NA able), value (NA able)
00981 
00982   // PRT - Protein section (Table based)
00983   struct MzTabProteinSectionRow
00984   {
00985     MzTabProteinSectionRow()
00986     {
00987       // use "," as list separator because "|" can be used for go terms and protein accessions
00988       go_terms.setSeparator(',');
00989       ambiguity_members.setSeparator(',');
00990     }
00991 
00992     MzTabString accession; // The protein’s accession.
00993     //String unit_id; // The unit’s id. not NA able!
00994     MzTabString description; // Human readable description (i.e. the name)
00995     MzTabInteger taxid; // NEWT taxonomy for the species.
00996     MzTabString species; // Human readable name of the species
00997     MzTabString database; // Name of the protein database.
00998     MzTabString database_version; // String Version of the protein database.
00999     MzTabParameterList search_engine; // Search engine(s) identifying the protein.
01000     MzTabParameterList search_engine_score; // Search engine(s) reliability score(s).
01001     MzTabInteger reliability; // (1-3) Identification reliability.
01002     MzTabInteger num_peptides; // Number of PSMs assigned to the protein.
01003     MzTabInteger num_peptides_distinct; // Distinct (sequence + modifications) # of peptides.
01004     MzTabInteger num_peptides_unambiguous; // Distinct number of unambiguous peptides.
01005     MzTabStringList ambiguity_members; // Alternative protein identifications.
01006     MzTabModificationList modifications; // Modifications identified in the protein.
01007     MzTabString uri; // Location of the protein’s source entry.
01008     MzTabStringList go_terms; // List of GO terms for the protein.
01009     MzTabDouble protein_coverage; // (0-1) Amount of protein sequence identified.
01010     std::vector<DoubleReal> protein_abundance_sub; // Protein abundance in the subsample.
01011     std::vector<DoubleReal> protein_abundance_stdev_sub; // Standard deviation of the protein abundance.
01012     std::vector<DoubleReal> protein_abundance_std_error_sub; // Standard error of the protein abundance.
01013     std::vector<MzTabOptionalColumnEntry> opt_; // Optional Columns must start with “opt_”
01014   };
01015 
01016   // PEP - Peptide section (Table based)
01017   struct MzTabPeptideSectionRow
01018   {
01019     MzTabString sequence; // The peptide’s sequence.
01020     MzTabString accession; // The protein’s accession.
01021     //String unit_id; // The unit’s id.
01022     MzTabBoolean unique; // 0=false, 1=true, NA else: Peptide is unique for the protein.
01023     MzTabString database; // Name of the sequence database.
01024     MzTabString database_version; // Version (and optionally # of entries).
01025     MzTabParameterList search_engine; // Search engine(s) that identified the peptide.
01026     MzTabParameterList search_engine_score; // Search engine(s) score(s) for the peptide.
01027     MzTabInteger reliability; // (1-3) 0=NA Identification reliability for the peptide.
01028     MzTabModificationList modifications; // Modifications identified in the peptide.
01029     MzTabDoubleList retention_time; // Time points in seconds. Semantics may vary.
01030     MzTabDouble charge; // Precursor ion’s charge.
01031     MzTabDouble mass_to_charge; // Precursor ion’s m/z.
01032     MzTabString uri; // Location of the PSM’s source entry.
01033     MzTabSpectraRef spectra_ref; // Spectra identifying the peptide.
01034     std::vector<DoubleReal> peptide_abundance_sub; // Peptide abundance in the subsample;
01035     std::vector<DoubleReal> peptide_abundance_stdev_sub; // Peptide abundance standard deviation.
01036     std::vector<DoubleReal> peptide_abundance_std_error_sub; // Peptide abundance standard error.
01037     std::vector<MzTabOptionalColumnEntry> opt_; // Optional columns must start with “opt_”.
01038   };
01039 
01040   // SML Small molecule section (table based)
01041   struct MzTabSmallMoleculeSectionRow
01042   {
01043     MzTabStringList identifier; // The small molecule’s identifier.
01044     MzTabString chemical_formula; // Chemical formula of the identified compound.
01045     MzTabString smiles; // Molecular structure in SMILES format.
01046     MzTabString inchi_key; // InChi Key of the identified compound.
01047     MzTabString description; // Human readable description (i.e. the name)
01048     MzTabDouble mass_to_charge; // Precursor ion’s m/z.
01049     MzTabDouble charge; // Precursor ion’s charge.
01050     MzTabDoubleList retention_time; // Time points in seconds. Semantics may vary.
01051     MzTabInteger taxid; // NEWT taxonomy for the species.
01052     MzTabString species; // Human readable name of the species
01053     MzTabString database; // Name of the used database.
01054     MzTabString database_version; // String Version of the database (and optionally # of compounds).
01055     MzTabInteger reliability; // (1-3) The identification reliability.
01056     MzTabString uri; // The source entry’s location.
01057     MzTabSpectraRef spectra_ref; // Spectra identifying the small molecule.
01058     MzTabParameterList search_engine; // Search engine(s) identifying the small molecule.
01059     MzTabParameterList search_engine_score; // Search engine(s) identifications score(s).
01060     MzTabModificationList modifications; // Modifications identified on the small molecule.
01061     std::vector<MzTabDouble> smallmolecule_abundance_sub; // Abundance in the subsample;
01062     std::vector<MzTabDouble> smallmolecule_abundance_stdev_sub; // Standard deviation of the abundance.
01063     std::vector<MzTabDouble> smallmolecule_abundance_std_error_sub; // Standard errpr of the abundance.
01064     std::vector<MzTabOptionalColumnEntry> opt_; // Optional columns must start with “opt_”.
01065   };
01066 
01067   typedef std::vector<MzTabProteinSectionRow> MzTabProteinSectionRows;
01068 
01069   typedef std::vector<MzTabPeptideSectionRow> MzTabPeptideSectionRows;
01070 
01071   typedef std::vector<MzTabSmallMoleculeSectionRow> MzTabSmallMoleculeSectionRows;
01072 
01073   typedef std::map<String, MzTabUnitIdMetaData> MzTabMetaData;
01074   typedef std::map<String, MzTabProteinSectionRows> MzTabProteinSectionData;
01075   typedef std::map<String, MzTabPeptideSectionRows> MzTabPeptideSectionData;
01076   typedef std::map<String, MzTabSmallMoleculeSectionRows> MzTabSmallMoleculeSectionData;
01077 
01085   class OPENMS_DLLAPI MzTab
01086   {
01087   public:
01089     MzTab();
01090 
01092     ~MzTab();
01093 
01094     const MzTabMetaData& getMetaData() const
01095     {
01096       return map_unitid_to_meta_data_;
01097     }
01098 
01099     const MzTabProteinSectionData& getProteinSectionData() const
01100     {
01101       return map_unitid_to_protein_data_;
01102     }
01103 
01104     const MzTabPeptideSectionData& getPeptideSectionData() const
01105     {
01106       return map_unitid_to_peptide_data_;
01107     }
01108 
01109     const MzTabSmallMoleculeSectionData& getSmallMoleculeSectionData() const
01110     {
01111       return map_unitid_to_small_molecule_data_;
01112     }
01113 
01114   protected:
01115     MzTabMetaData map_unitid_to_meta_data_;
01116     MzTabProteinSectionData map_unitid_to_protein_data_;
01117     MzTabPeptideSectionData map_unitid_to_peptide_data_;
01118     MzTabSmallMoleculeSectionData map_unitid_to_small_molecule_data_;
01119   };
01120 
01121 } // namespace OpenMS
01122 
01123 #endif // OPENMS_FORMAT_MZTAB_H

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