|
if (dplyr::between(num_features, 2, 10)) { |
|
# linear interpolation of missing intensities and calculate the area for a single EIC |
|
eic_area <- interpol.area(feature_group[, "rt"], feature_group[, "intensity"], base.curve[, "base.curve"], all_diff_mean_rts) |
|
rt_peak_shape <- c(median(feature_group[, "mz"]), median(feature_group[, "rt"]), sd(feature_group[, "rt"]), sd(feature_group[, "rt"]), eic_area) |
|
peak_parameters <- rbind(peak_parameters, rt_peak_shape) |
|
} |
|
if (num_features < 2) { |
|
time_weights <- all_diff_mean_rts[which(base.curve[, "base.curve"] %in% feature_group[2])] |
|
rt_peak_shape <- c(feature_group[1], feature_group[2], NA, NA, feature_group[3] * time_weights) |
|
peak_parameters <- rbind(peak_parameters, rt_peak_shape) |
|
} |
|
# application of selected model and method |
|
if (num_features > 10) { |
|
# find bandwidth for these particular range |
|
rt_range <- range(feature_group[, "rt"]) |
|
bw <- min(max(bandwidth * (max(rt_range) - min(rt_range)), min_bandwidth), max_bandwidth) |
|
bw <- seq(bw, 2 * bw, length.out = 3) |
|
if (bw[1] > 1.5 * min_bandwidth) { |
|
bw <- c(max(min_bandwidth, bw[1] / 2), bw) |
|
} |
|
|
|
rt_profile <- compute_chromatographic_profile(feature_group, base.curve) |
|
if (shape_model == "Gaussian") { |
|
rt_peak_shape <- compute_gaussian_peak_shape(rt_profile, bw, component_eliminate, BIC_factor, aver_diff) |
|
} else { |