Skip to content

Commit

Permalink
Merge pull request #212 from xtrojak/211-remove-suffixes
Browse files Browse the repository at this point in the history
Remove sample name suffixes and peak picking corner case
  • Loading branch information
hechth authored Jul 1, 2023
2 parents d6be955 + 8b9231a commit 6fa5873
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [dev] - unreleased
### Added
### Changed
- sample names in aligned tables no longer use _intensity and _rt suffixes [#212](https://github.com/RECETOX/recetox-aplcms/pull/212)
### Removed
- corner case in peak picking when an EIC was between 2 and 10 features [#212](https://github.com/RECETOX/recetox-aplcms/pull/212)

## [0.11.0] - 2023-05-09
### Added
- implemented new clustering algorithm and included parallelism in unsupervised and hybrid [#201](https://github.com/RECETOX/recetox-aplcms/pull/201)
Expand Down
4 changes: 2 additions & 2 deletions R/feature.align.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ create_aligned_feature_table <- function(features_table,

number_of_samples <- length(sample_names)
metadata_colnames <- c("id", "mz", "mzmin", "mzmax", "rt", "rtmin", "rtmax", "npeaks", sample_names)
intensity_colnames <- c("id", paste0(sample_names, "_intensity"))
rt_colnames <- c("id", paste0(sample_names, "_rt"))
intensity_colnames <- c("id", sample_names)
rt_colnames <- c("id", sample_names)

aligned_features <- create_empty_tibble(number_of_samples, metadata_colnames, intensity_colnames, rt_colnames)

Expand Down
10 changes: 1 addition & 9 deletions R/prof.to.features.R
Original file line number Diff line number Diff line change
Expand Up @@ -933,19 +933,11 @@ prof.to.features <- function(profile,
num_features <- nrow(feature_group)
# The estimation procedure for a single peak
# Defines the dataframe containing median_mz, median_rt, sd1, sd2, and area
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) {
} else {
# 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)
Expand Down
2 changes: 1 addition & 1 deletion R/recover.weaker.R
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ recover.weaker <- function(filename,
vec_delta_rt <- compute_delta_rt(times)

sample_intensities <- unlist(dplyr::select(
intensity_table %>% dplyr::rename_with(~str_remove(., "_intensity")),
intensity_table,
all_of(sample_name)
), use.names = FALSE)

Expand Down

0 comments on commit 6fa5873

Please sign in to comment.