Skip to content

Commit

Permalink
add poly parameter in diso() function
Browse files Browse the repository at this point in the history
a precursor-dereived metabolite might be the modification of the dimer , trimer or even polymer of the precursor. For instance, [2Try + x + H]+. In this situation, the mass difference of this labeled and unlabed metabolite will be 2 times of this labeled precursor. Poly parameter is therefore used to catch this kind of metabolotes.
  • Loading branch information
YonghuiDong committed Feb 19, 2019
1 parent 00ef8fb commit 041516e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions R/diso.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param exp.iso isotope labeled group.
#' @param ppm m/z tolarance, default value 30.
#' @param rt.dif retention time tolarance, default value 6 seconds.
#' @param poly polymer of the feeding precursor derived metabolites, e.g. dimer poly = 2, trimer poly =3, default value 1.
#' @return results containing unlabled and their corresponding labled analytes, with RT and labeling information.
#' @export
#' @examples
Expand All @@ -23,7 +24,7 @@
#' exp.base = iso.C[,1:3], exp.iso = exp.D)

diso <- function(iso1, n11, n12, iso2 = 'NO', n21 = 0, n22 = 0, exp.base,
exp.iso, ppm = 10, rt.dif = 6) {
exp.iso, ppm = 10, rt.dif = 6, poly = 1) {
# check the input variables
cat("\n(1) Checking input parameters...");
element <- isoDB$element
Expand All @@ -35,12 +36,14 @@ diso <- function(iso1, n11, n12, iso2 = 'NO', n21 = 0, n22 = 0, exp.base,
if(!is.numeric(n22)) {stop('n22 is not numeric')}
if (n11 < n12) {stop('The argument "n11" must be no less than "n12"' )}
if (n21 < n22) {stop('The argument "n21" must be no less than "n22"' )}
if (poly <= 0) {stop('poly should be >= 1')}
if (poly %% 1 != 0) {stop('poly should be integer')}
cat("done");

cat("\n(2) Preparing datacube...");
# prepare the labelling pattern according to the feeding precusor. iso2 is 0 by default.
pattern1 <- seq(n11, n12, by = -1)
pattern2 <- seq(n21, n22, by = -1)
pattern1 <- seq(n11, n12, by = -1) * poly
pattern2 <- seq(n21, n22, by = -1) * poly
mass_dif1 <- isoDB$mass_dif[match(iso1, isoDB$element)]
mass_dif2 <- isoDB$mass_dif[match(iso2, isoDB$element)]
iso.pattern1 <- mass_dif1 * pattern1
Expand Down
4 changes: 3 additions & 1 deletion man/diso.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 041516e

Please sign in to comment.