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_TARGETED_INCLUSIONEXCLUSIONLIST_H
00036 #define OPENMS_ANALYSIS_TARGETED_INCLUSIONEXCLUSIONLIST_H
00037
00038 #include <OpenMS/ANALYSIS/TARGETED/TargetedExperiment.h>
00039 #include <OpenMS/FORMAT/FASTAFile.h>
00040 #include <OpenMS/KERNEL/FeatureMap.h>
00041
00042 namespace OpenMS
00043 {
00050 class OPENMS_DLLAPI InclusionExclusionList :
00051 public DefaultParamHandler
00052 {
00053 protected:
00054 struct IEWindow
00055 {
00056 IEWindow(const DoubleReal RTmin, const DoubleReal RTmax, const DoubleReal MZ) :
00057 RTmin_(RTmin),
00058 RTmax_(RTmax),
00059 MZ_(MZ)
00060 {
00061 }
00062
00063 DoubleReal RTmin_;
00064 DoubleReal RTmax_;
00065 DoubleReal MZ_;
00066 };
00067
00075 class WindowDistance_
00076 {
00077 public:
00078 WindowDistance_(const DoubleReal rt_bridge, const DoubleReal mz_max, const bool mz_as_ppm) :
00079 rt_bridge_(rt_bridge),
00080 mz_max_(mz_max),
00081 mz_as_ppm_(mz_as_ppm)
00082 {
00083 }
00084
00085
00086 double operator()(const IEWindow & first, const IEWindow & second) const
00087 {
00088
00089 DoubleReal d_mz = fabs(first.MZ_ - second.MZ_);
00090 if (mz_as_ppm_)
00091 {
00092 d_mz = d_mz / first.MZ_ * 1e6;
00093 }
00094 if (d_mz > mz_max_) {return 0; }
00095
00096
00097
00098 if (first.RTmin_ <= second.RTmin_ && second.RTmin_ <= first.RTmax_) return 1;
00099
00100 if (first.RTmin_ <= second.RTmax_ && second.RTmax_ <= first.RTmax_) return 1;
00101
00102 if (second.RTmin_ <= first.RTmin_ && first.RTmax_ <= second.RTmax_) return 1;
00103
00104
00105
00106 if ((fabs(first.RTmin_ - second.RTmax_) <= rt_bridge_) ||
00107 (fabs(first.RTmax_ - second.RTmin_) <= rt_bridge_))
00108 {
00109 return 1;
00110 }
00111
00112
00113 return 0;
00114 }
00115
00116 protected:
00117
00118 DoubleReal rt_bridge_;
00119 DoubleReal mz_max_;
00120 bool mz_as_ppm_;
00121
00122 };
00123
00124
00125 typedef std::vector<IEWindow> WindowList;
00126
00137 void mergeOverlappingWindows_(WindowList & list) const;
00138
00139
00149 void writeToFile_(const String & out_path, const WindowList & windows) const;
00150
00151 public:
00155
00156 InclusionExclusionList();
00157
00158
00160
00161
00162
00163
00164
00165
00166
00172 void writeTargets(const std::vector<FASTAFile::FASTAEntry> & fasta_entries,
00173 const String & out_path,
00174 const IntList & charges,
00175 const String rt_model_path);
00176
00182 void writeTargets(const FeatureMap<> & map,
00183 const String & out_path);
00184
00192 void writeTargets(const std::vector<PeptideIdentification> & pep_ids,
00193 const String & out_path,
00194 const IntList & charges);
00195
00196 };
00197
00198
00199 }
00200
00201 #endif