Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function to find top 10 recalibrant series #44

Merged
merged 28 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9503c51
function to find top 10 recalibrant series
KristinaGomoryova Aug 22, 2024
4502399
typos corrected
KristinaGomoryova Aug 23, 2024
52978ba
filter_input as a function
KristinaGomoryova Sep 2, 2024
99a1a37
description of the filter_input function added
KristinaGomoryova Sep 2, 2024
7ae9894
description of filter_input function added
KristinaGomoryova Sep 2, 2024
bc75cf5
compute_scores moved out of top-level
KristinaGomoryova Sep 2, 2024
eb6893e
number of combinations and tolerance as arguments
KristinaGomoryova Sep 2, 2024
49dba75
abundance_score_threshold and peak_distance_threshold as global argum…
KristinaGomoryova Sep 2, 2024
f65564b
filter_input changed to filter_recal_series
KristinaGomoryova Sep 2, 2024
60898f7
test for compute_coverage
KristinaGomoryova Sep 2, 2024
4368a58
test and test data for compute_coverage function
KristinaGomoryova Sep 3, 2024
368abe0
gtools added as dependency
KristinaGomoryova Sep 3, 2024
4c23182
tests for the compute_combinations and compute_subsets
KristinaGomoryova Sep 3, 2024
8a9445d
test for selecting final series
KristinaGomoryova Sep 3, 2024
7497e64
test data
KristinaGomoryova Sep 3, 2024
204450f
code refactored
KristinaGomoryova Sep 3, 2024
5f37bdd
test for filtering the input recal list
KristinaGomoryova Sep 4, 2024
f388877
functions documented
KristinaGomoryova Sep 4, 2024
a0c72c8
test for computing final scores
KristinaGomoryova Sep 4, 2024
6da3fca
test for compute_scores
KristinaGomoryova Sep 4, 2024
00fd06b
linting done
KristinaGomoryova Sep 4, 2024
066d94a
linting done
KristinaGomoryova Sep 4, 2024
495a0b4
fixed filling
hechth Sep 5, 2024
e1b7755
type annotations, slice_head
KristinaGomoryova Sep 5, 2024
3617285
Merge branch 'master' into findRecalSeries
hechth Sep 5, 2024
54613e2
arrange instead of order
KristinaGomoryova Sep 5, 2024
dcd4051
find_final_series works only partially
KristinaGomoryova Sep 5, 2024
0380c83
upsated test output to ungrouped df
hechth Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions R/FindRecalSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,28 @@
#' @param df An output from RecalList, containing recalibrant CH2 series.
#' @return A dataframe of 10 best-scoring series.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing descriptions for the other parameters

filter_input <- function(df, abundance_score_threshold, peak_distance_threshold) {
KristinaGomoryova marked this conversation as resolved.
Show resolved Hide resolved
df <- df %>%
filter(Abundance.Score > abundance_score_threshold) %>%
filter(Peak.Distance < peak_distance_threshold) %>%
separate(col = Mass.Range, into = c('Min.Mass.Range', 'Max.Mass.Range'), sep = "-") %>%
mutate(Min.Mass.Range = as.numeric(Min.Mass.Range),
Max.Mass.Range = as.numeric(Max.Mass.Range)) %>%
mutate(Series.Length = Max.Mass.Range - Min.Mass.Range)
}


findSeries <- function(df) {

# Arrange the data
df <- df %>%
separate(col = Mass.Range, into = c('Min.Mass.Range', 'Max.Mass.Range'), sep = "-") %>%
mutate(Min.Mass.Range = as.numeric(Min.Mass.Range),
Max.Mass.Range = as.numeric(Max.Mass.Range)) %>%
mutate(Series.Length = Max.Mass.Range - Min.Mass.Range) %>%
filter(Abundance.Score > 100) %>%
filter(Peak.Distance < 2)
# Arrange the data
df <- filter_input(df, 100, 2)
KristinaGomoryova marked this conversation as resolved.
Show resolved Hide resolved

# Compute the global minimum and maximum (range of a dataset)
# We need to add some tolerance, because there is low chance full 100% would be covered
# Compute the global minimum and maximum (range of a dataset)
# We need to add some tolerance, because there is low chance full 100% would be covered

tolerance <- 100
global_min <- min(df$Min.Mass.Range) + tolerance
global_max <- max(df$Max.Mass.Range) - tolerance
tolerance <- 100
global_min <- min(df$Min.Mass.Range) + tolerance
global_max <- max(df$Max.Mass.Range) - tolerance

# Create all combinations of ions
iter <- combinations(nrow(df), 5, v = 1:nrow(df))
Expand Down
Loading