| 87 | } |
| 88 | |
| 89 | ExitCodes main_(int, const char **) override |
| 90 | { |
| 91 | //---------------------------------------------------------------- |
| 92 | // load data |
| 93 | //---------------------------------------------------------------- |
| 94 | String in = getStringOption_("in"); |
| 95 | String out = getStringOption_("out"); |
| 96 | double sampling_rate = getDoubleOption_("sampling_rate"); |
| 97 | double min_int_cutoff = getDoubleOption_("min_int_cutoff"); |
| 98 | bool align_sampling = getFlag_("align_sampling"); |
| 99 | bool ppm = getFlag_("ppm"); |
| 100 | PeakMap exp; |
| 101 | MzMLFile f; |
| 102 | f.setLogType(log_type_); |
| 103 | f.load(in, exp); |
| 104 | |
| 105 | Param resampler_param; |
| 106 | resampler_param.setValue("spacing", sampling_rate); |
| 107 | if (ppm) resampler_param.setValue("ppm", "true"); |
| 108 | else resampler_param.setValue("ppm", "false"); |
| 109 | |
| 110 | if (!align_sampling) |
| 111 | { |
| 112 | LinearResampler lin_resampler; |
| 113 | lin_resampler.setParameters(resampler_param); |
| 114 | |
| 115 | // resample every scan |
| 116 | for (Size i = 0; i < exp.size(); ++i) |
| 117 | { |
| 118 | lin_resampler.raster(exp[i]); |
| 119 | } |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | LinearResamplerAlign lin_resampler; |
| 124 | lin_resampler.setParameters(resampler_param); |
| 125 | |
| 126 | bool start_pos_set = false; |
| 127 | bool end_pos_set = false; |
| 128 | double start_pos = 0.0; |
| 129 | double end_pos = 0.0; |
| 130 | // get max / min positions across whole map |
| 131 | for (Size i = 0; i < exp.size(); ++i) |
| 132 | { |
| 133 | if (!exp[i].empty() && (!start_pos_set || exp[i][0].getMZ() < start_pos) ) |
| 134 | { |
| 135 | start_pos = exp[i][0].getMZ(); |
| 136 | start_pos_set = true; |
| 137 | } |
| 138 | if (!exp[i].empty() && (!end_pos_set || exp[i].back().getMZ() > end_pos) ) |
| 139 | { |
| 140 | end_pos = exp[i].back().getMZ(); |
| 141 | end_pos_set = true; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | if (start_pos_set) |
| 146 | { |
nothing calls this directly
no test coverage detected