Repository navigation
add method of "group_mz_int" - #382
MuyaoXi9271 wants to merge 12 commits into
Conversation
Merge branch 'devel' of https://github.com/MuyaoXi9271/Spectra_MX into devel # Conflicts: # R/peak-list-functions.R
|
@MuyaoXi9271 , can you please use 4 whitespaces (not 2)? otherwise also lines that you did not edit or change look as modified. this setting should actually be defined in the .editorconfig file - and ideally, your editor/IDE should read this file and set the configuration accordingly. |
|
Dear @MuyaoXi9271 , can you please also describe what the goal/intention of your updates are? Maybe also have a look at the |
Dear @jorainer, Thanks for your suggestion. The DDA data acquired from the Bruker instrument from my lab is that the same precursor has several spectra at each collision energy (in total 5 ), so I managed to get a consensus spectrum for each precursor at each collision energy. When I use the existing group function within Spectra::combineSpectra like Best, |
|
OK, so the an additional question:
|
I would say a little modification on The idea of the function |
|
Hi @jorainer , should I open a "pull request" under the package of MsCoreUtils? |
|
OK, thanks for explaining. I think I understood it. And yes @MuyaoXi9271 , please make a PR to MsCoreUtils with your Then we can think how to also modify the existing |
jorainer
left a comment
There was a problem hiding this comment.
Thanks for the PR. There are some changes and open questions that need to be addressed.
| combinePeaksData <- function(x, intensityFun = base::mean, | ||
| mzFun = base::mean, weighted = FALSE, | ||
| tolerance = 0, ppm = 0, timeDomain = FALSE, | ||
| group_method = c("group", "group_mz_int"), |
There was a problem hiding this comment.
Please use groupMethod instead of group_method to be consistent with the other parameter names. Also, please add the groupMethod parameter as last parameter (i.e., after minProp) to not cause problems if any user uses positional argument passing instead of named parameters.
| group_method = c("group", "group_mz_int"), | ||
| peaks = c("union", "intersect"), main = integer(), | ||
| minProp = 0.5, ...) { | ||
| peaks <- match.arg(peaks) |
There was a problem hiding this comment.
you should also do a groupMethod <- match.arg(groupMethod) here so that the input parameter values are checked and a single one is chosen (by default the first).
| } | ||
|
|
||
| #New lines start-------- | ||
| mzs <- mzs[mz_groups != -1] |
There was a problem hiding this comment.
these lines (mzs <- mzs[mz_groups != -1] to mz_groups <- mz_groups[mz_groups != -1]) should go above inside the else if (group_method == "group_mz_int"). this is not needed for the "group" method and will slow the function down.
| ints <- split(ints, mz_groups) | ||
|
|
||
|
|
||
| # --- New lines start for keeping the mz within the tolerance ---------------------- |
There was a problem hiding this comment.
why is this whole code (line 255 until 276) needed? this is what the group_mz_int() should actually do, no?
| } else | ||
| mzs <- vapply1d(mzs, FUN = mzFun) | ||
|
|
||
| #New lines start --------------------------------------------- |
There was a problem hiding this comment.
why are these changes here needed? mzs and ints where already ordered by m/z before, so why should they be re-ordered?
| @@ -0,0 +1,3 @@ | |||
| Optimization of function of "peak-list-function.R" from lin 231 to line 252 | |||
There was a problem hiding this comment.
please remove the Update.txt file.
No description provided.