35 #ifndef OPENMS_ANALYSIS_OPENSWATH_OPENSWATHTSVWRITER_H 36 #define OPENMS_ANALYSIS_OPENSWATH_OPENSWATHTSVWRITER_H 69 String input_filename =
"inputfile",
70 bool ms1_scores =
false,
72 bool uis_scores =
false) :
73 ofs(output_filename.c_str()),
74 input_filename_(input_filename),
75 doWrite_(!output_filename.empty()),
76 use_ms1_traces_(ms1_scores),
78 enable_uis_scoring_(uis_scores)
92 ofs <<
"transition_group_id\tpeptide_group_label\trun_id\tfilename\tRT\tid\tSequence\tFullPeptideName" <<
93 "\tCharge\tm/z\tIntensity\tProteinName\tdecoy\tassay_rt\tdelta_rt\tleftWidth" <<
94 "\tmain_var_xx_swath_prelim_score\tnorm_RT\tnr_peaks\tpeak_apices_sum\tpotentialOutlier\tinitialPeakQuality" <<
95 "\trightWidth\trt_score\tsn_ratio\ttotal_xic\tvar_bseries_score\tvar_dotprod_score" <<
96 "\tvar_intensity_score\tvar_isotope_correlation_score\tvar_isotope_overlap_score" <<
97 "\tvar_library_corr\tvar_library_dotprod\tvar_library_manhattan\tvar_library_rmsd" <<
98 "\tvar_library_rootmeansquare\tvar_library_sangle\tvar_log_sn_score\tvar_manhatt_score" <<
99 "\tvar_massdev_score\tvar_massdev_score_weighted\tvar_norm_rt_score\tvar_xcorr_coelution" <<
100 "\tvar_xcorr_coelution_weighted\tvar_xcorr_shape\tvar_xcorr_shape_weighted" <<
101 "\tvar_yseries_score\tvar_elution_model_fit_score";
104 ofs <<
"\tvar_ms1_ppm_diff\tvar_ms1_isotope_corr\tvar_ms1_isotope_overlap\tvar_ms1_xcorr_coelution\tvar_ms1_xcorr_shape";
106 ofs <<
"\txx_lda_prelim_score\txx_swath_prelim_score";
109 ofs <<
"\tvar_sonar_lag\tvar_sonar_shape\tvar_sonar_log_sn\tvar_sonar_log_diff\tvar_sonar_log_trend\tvar_sonar_rsq";
113 ofs <<
"\taggr_prec_Peak_Area\taggr_prec_Peak_Apex\taggr_prec_Fragment_Annotation";
115 ofs <<
"\taggr_Peak_Area\taggr_Peak_Apex\taggr_Fragment_Annotation";
116 if (enable_uis_scoring_)
118 ofs <<
"\tuis_target_transition_names" 119 <<
"\tuis_target_var_ind_log_intensity" 120 <<
"\tuis_target_num_transitions" 121 <<
"\tuis_target_var_ind_xcorr_coelution" 122 <<
"\tuis_target_main_var_ind_xcorr_shape" 123 <<
"\tuis_target_var_ind_log_sn_score" 124 <<
"\tuis_target_var_ind_massdev_score" 125 <<
"\tuis_target_var_ind_isotope_correlation" 126 <<
"\tuis_target_var_ind_isotope_overlap" 127 <<
"\tuis_decoy_transition_names" 128 <<
"\tuis_decoy_var_ind_log_intensity" 129 <<
"\tuis_decoy_num_transitions" 130 <<
"\tuis_decoy_var_ind_xcorr_coelution" 131 <<
"\tuis_decoy_main_var_ind_xcorr_shape" 132 <<
"\tuis_decoy_var_ind_log_sn_score" 133 <<
"\tuis_decoy_var_ind_massdev_score" 134 <<
"\tuis_decoy_var_ind_isotope_correlation" 135 <<
"\tuis_decoy_var_ind_isotope_overlap";
160 if (transition->
decoy)
165 for (FeatureMap::const_iterator feature_it = output.begin(); feature_it != output.end(); ++feature_it)
168 char intensity_char[40];
169 char intensity_apex_char[40];
170 String aggr_Peak_Area =
"";
171 String aggr_Peak_Apex =
"";
172 String aggr_Fragment_Annotation =
"";
173 String aggr_prec_Peak_Area =
"";
174 String aggr_prec_Peak_Apex =
"";
175 String aggr_prec_Fragment_Annotation =
"";
176 for (std::vector<Feature>::const_iterator sub_it = feature_it->getSubordinates().begin(); sub_it != feature_it->getSubordinates().end(); ++sub_it)
178 sprintf(intensity_char,
"%f", sub_it->getIntensity());
179 sprintf(intensity_apex_char,
"%f", (
double)sub_it->getMetaValue(
"peak_apex_int"));
180 if (sub_it->metaValueExists(
"FeatureLevel") && sub_it->getMetaValue(
"FeatureLevel") ==
"MS2")
182 aggr_Peak_Area += (
String)intensity_char +
";";
183 aggr_Peak_Apex += (
String)intensity_apex_char +
";";
184 aggr_Fragment_Annotation += (
String)sub_it->getMetaValue(
"native_id") +
";";
186 else if (sub_it->metaValueExists(
"FeatureLevel") && sub_it->getMetaValue(
"FeatureLevel") ==
"MS1")
188 aggr_prec_Peak_Area += (
String)intensity_char +
";";
189 aggr_Peak_Apex += (
String)intensity_apex_char +
";";
190 aggr_prec_Fragment_Annotation += (
String)sub_it->getMetaValue(
"native_id") +
";";
193 if (!feature_it->getSubordinates().empty())
195 aggr_Peak_Area = aggr_Peak_Area.
substr(0, aggr_Peak_Area.size() - 1);
196 aggr_Peak_Apex = aggr_Peak_Apex.
substr(0, aggr_Peak_Apex.size() - 1);
197 aggr_Fragment_Annotation = aggr_Fragment_Annotation.
substr(0, aggr_Fragment_Annotation.size() - 1);
198 aggr_prec_Peak_Area = aggr_prec_Peak_Area.
substr(0, aggr_prec_Peak_Area.size() - 1);
199 aggr_prec_Peak_Apex = aggr_prec_Peak_Apex.
substr(0, aggr_prec_Peak_Apex.size() - 1);
200 aggr_prec_Fragment_Annotation = aggr_prec_Fragment_Annotation.
substr(0, aggr_prec_Fragment_Annotation.size() - 1);
203 String full_peptide_name =
"";
204 for (
int loc = -1; loc <= (int)pep.
sequence.size(); loc++)
206 if (loc > -1 && loc < (
int)pep.
sequence.size())
208 full_peptide_name += pep.
sequence[loc];
223 if (group_label.empty()) group_label =
id;
224 if (group_label ==
"light") group_label = id;
225 if (group_label ==
"NA") group_label = id;
238 +
"\t" + input_filename_
239 +
"\t" + (
String)feature_it->getRT()
240 +
"\t" +
"f_" + feature_it->getUniqueId()
242 +
"\t" + full_peptide_name
245 +
"\t" + (
String)feature_it->getIntensity()
246 +
"\t" + protein_name
249 +
"\t" + (
String)feature_it->getMetaValue(
"assay_rt")
250 +
"\t" + (
String)feature_it->getMetaValue(
"delta_rt")
251 +
"\t" + (
String)feature_it->getMetaValue(
"leftWidth")
252 +
"\t" + (
String)feature_it->getMetaValue(
"main_var_xx_swath_prelim_score")
253 +
"\t" + (
String)feature_it->getMetaValue(
"norm_RT")
254 +
"\t" + (
String)feature_it->getMetaValue(
"nr_peaks")
255 +
"\t" + (
String)feature_it->getMetaValue(
"peak_apices_sum")
256 +
"\t" + (
String)feature_it->getMetaValue(
"potentialOutlier")
257 +
"\t" + (
String)feature_it->getMetaValue(
"initialPeakQuality")
258 +
"\t" + (
String)feature_it->getMetaValue(
"rightWidth")
259 +
"\t" + (
String)feature_it->getMetaValue(
"rt_score")
260 +
"\t" + (
String)feature_it->getMetaValue(
"sn_ratio")
261 +
"\t" + (
String)feature_it->getMetaValue(
"total_xic")
262 +
"\t" + (
String)feature_it->getMetaValue(
"var_bseries_score")
263 +
"\t" + (
String)feature_it->getMetaValue(
"var_dotprod_score")
264 +
"\t" + (
String)feature_it->getMetaValue(
"var_intensity_score")
265 +
"\t" + (
String)feature_it->getMetaValue(
"var_isotope_correlation_score")
266 +
"\t" + (
String)feature_it->getMetaValue(
"var_isotope_overlap_score")
267 +
"\t" + (
String)feature_it->getMetaValue(
"var_library_corr")
268 +
"\t" + (
String)feature_it->getMetaValue(
"var_library_dotprod")
269 +
"\t" + (
String)feature_it->getMetaValue(
"var_library_manhattan")
270 +
"\t" + (
String)feature_it->getMetaValue(
"var_library_rmsd")
271 +
"\t" + (
String)feature_it->getMetaValue(
"var_library_rootmeansquare")
272 +
"\t" + (
String)feature_it->getMetaValue(
"var_library_sangle")
273 +
"\t" + (
String)feature_it->getMetaValue(
"var_log_sn_score")
274 +
"\t" + (
String)feature_it->getMetaValue(
"var_manhatt_score")
275 +
"\t" + (
String)feature_it->getMetaValue(
"var_massdev_score")
276 +
"\t" + (
String)feature_it->getMetaValue(
"var_massdev_score_weighted")
277 +
"\t" + (
String)feature_it->getMetaValue(
"var_norm_rt_score")
278 +
"\t" + (
String)feature_it->getMetaValue(
"var_xcorr_coelution")
279 +
"\t" + (
String)feature_it->getMetaValue(
"var_xcorr_coelution_weighted")
280 +
"\t" + (
String)feature_it->getMetaValue(
"var_xcorr_shape")
281 +
"\t" + (
String)feature_it->getMetaValue(
"var_xcorr_shape_weighted")
282 +
"\t" + (
String)feature_it->getMetaValue(
"var_yseries_score")
283 +
"\t" + (
String)feature_it->getMetaValue(
"var_elution_model_fit_score");
287 line +=
"\t" + (
String)feature_it->getMetaValue(
"var_ms1_ppm_diff")
288 +
"\t" + (
String)feature_it->getMetaValue(
"var_ms1_isotope_correlation")
289 +
"\t" + (
String)feature_it->getMetaValue(
"var_ms1_isotope_overlap")
290 +
"\t" + (
String)feature_it->getMetaValue(
"var_ms1_xcorr_coelution")
291 +
"\t" + (
String)feature_it->getMetaValue(
"var_ms1_xcorr_shape");
294 line +=
"\t" + (
String)feature_it->getMetaValue(
"xx_lda_prelim_score")
295 +
"\t" + (
String)feature_it->getMetaValue(
"xx_swath_prelim_score");
298 line +=
"\t" + (
String)feature_it->getMetaValue(
"var_sonar_lag")
299 +
"\t" + (
String)feature_it->getMetaValue(
"var_sonar_shape")
300 +
"\t" + (
String)feature_it->getMetaValue(
"var_sonar_log_sn")
301 +
"\t" + (
String)feature_it->getMetaValue(
"var_sonar_log_diff")
302 +
"\t" + (
String)feature_it->getMetaValue(
"var_sonar_log_trend")
303 +
"\t" + (
String)feature_it->getMetaValue(
"var_sonar_rsq");
308 line +=
"\t" + aggr_prec_Peak_Area +
"\t" + aggr_prec_Peak_Apex +
"\t" + aggr_prec_Fragment_Annotation;
310 line +=
"\t" + aggr_Peak_Area +
"\t" + aggr_Peak_Apex +
"\t" + aggr_Fragment_Annotation;
311 if (enable_uis_scoring_)
313 line +=
"\t" + (
String)feature_it->getMetaValue(
"id_target_transition_names")
314 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_log_intensity")
315 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_num_transitions")
316 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_xcorr_coelution")
317 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_xcorr_shape")
318 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_log_sn_score")
319 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_massdev_score")
320 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_isotope_correlation")
321 +
"\t" + (
String)feature_it->getMetaValue(
"id_target_ind_isotope_overlap")
322 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_transition_names")
323 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_log_intensity")
324 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_num_transitions")
325 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_xcorr_coelution")
326 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_xcorr_shape")
327 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_log_sn_score")
328 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_massdev_score")
329 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_isotope_correlation")
330 +
"\t" + (
String)feature_it->getMetaValue(
"id_decoy_ind_isotope_overlap");
332 line +=
"\n"; result += line;
349 for (
Size i = 0; i < to_output.size(); i++) { ofs << to_output[i]; }
356 #endif // OPENMS_ANALYSIS_OPENSWATH_OPENSWATHTSVWRITER_H void writeLines(std::vector< String > to_output)
Write data to disk.
Definition: OpenSwathTSVWriter.h:347
A more convenient string class.
Definition: String.h:57
std::vector< LightModification > modifications
Definition: TransitionExperiment.h:186
bool use_ms1_traces_
Definition: OpenSwathTSVWriter.h:62
A container for features.
Definition: FeatureMap.h:94
bool sonar_
Definition: OpenSwathTSVWriter.h:63
Class to write out an OpenSwath TSV output (mProphet input)
Definition: OpenSwathTSVWriter.h:57
double precursor_mz
Definition: TransitionExperiment.h:60
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
bool decoy
Definition: TransitionExperiment.h:62
String prepareLine(const OpenSwath::LightCompound &pep, const OpenSwath::LightTransition *transition, const FeatureMap &output, const String id)
Prepare a single line (feature) for output.
Definition: OpenSwathTSVWriter.h:154
String substr(size_t pos=0, size_t n=npos) const
Wrapper for the STL substr() method. Returns a String object with its contents initialized to a subst...
bool isActive()
Definition: OpenSwathTSVWriter.h:81
std::string peptide_group_label
Definition: TransitionExperiment.h:163
bool enable_uis_scoring_
Definition: OpenSwathTSVWriter.h:64
std::ofstream ofs
Definition: OpenSwathTSVWriter.h:59
void writeHeader()
Initializes file by writing TSV header.
Definition: OpenSwathTSVWriter.h:90
Definition: TransitionExperiment.h:150
std::string sequence
Definition: TransitionExperiment.h:160
std::vector< std::string > protein_refs
Definition: TransitionExperiment.h:161
Definition: TransitionExperiment.h:47
String input_filename_
Definition: OpenSwathTSVWriter.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
bool doWrite_
Definition: OpenSwathTSVWriter.h:61
OpenSwathTSVWriter(String output_filename, String input_filename="inputfile", bool ms1_scores=false, bool sonar=false, bool uis_scores=false)
Definition: OpenSwathTSVWriter.h:68
int charge
Definition: TransitionExperiment.h:159