Skip to content

Commit

Permalink
updated column select logic for sample_intensities
Browse files Browse the repository at this point in the history
  • Loading branch information
zargham-ahmad committed Mar 7, 2023
1 parent f159d54 commit a6ded28
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions R/recover.weaker.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ duplicate.row.remove <- function(features, tolerance = 1e-10) {
}
}

if(length(to.remove) > 0) {
if (length(to.remove) > 0) {
new.table <- new.table[-to.remove, ]
}
new.table
Expand Down Expand Up @@ -104,9 +104,9 @@ compute_mass_density <- function(features,
#' @return vector Custom chromatographic tolerances to use for each feature.
#' @export
get_custom_rt_tol <- function(use_observed_range,
peak_rts,
rt_range,
aligned_features) {
peak_rts,
rt_range,
aligned_features) {
custom_rt_tol <- rep(rt_range, nrow(aligned_features))

if (use_observed_range) {
Expand Down Expand Up @@ -331,7 +331,7 @@ compute_pks_vlys_rt <- function(features, times, bandwidth, target_rt, recover_m

num_peaks <- count_peaks(roi, features$rt)

if (!is.null (target_rt) && !is.na(target_rt)) {
if (!is.null(target_rt) && !is.na(target_rt)) {
pks.d <- abs(pks - target_rt) # distance from the target peak location
pks.d[num_peaks == 0] <- Inf
pks <- pks[which.min(pks.d)]
Expand Down Expand Up @@ -682,8 +682,11 @@ recover.weaker <- function(filename,

aver.diff <- mean(diff(times))
vec_delta_rt <- compute_delta_rt(times)

sample_intensities <- unlist(dplyr::select(intensity_table, dplyr::contains(sample_name)), use.names = FALSE)

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

custom.mz.tol <- recover_mz_range * metadata_table$mz
custom.rt.tol <- get_custom_rt_tol(
Expand Down Expand Up @@ -770,7 +773,7 @@ recover.weaker <- function(filename,
rt = this.rec$rt[this.sel],
area = this.rec$intensities[this.sel]
)

this.time.adjust <- (-extracted_features$rt[this.pos.diff] + adjusted_features$rt[this.pos.diff])

adjusted_features <- adjusted_features |> tibble::add_row(
Expand Down

0 comments on commit a6ded28

Please sign in to comment.