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

Included more metabolic labelling options #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 60 additions & 10 deletions R/massShift.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
#'
#' \itemize{
#' \item silac_13c
#' \href{http://www.unimod.org/modifications_view.php?editid1=188}{Unimod 188}
#' \href{https://www.unimod.org/modifications_view.php?editid1=188}{Unimod 188}
#'
#' \item silac_13c15n
#' \href{http://www.unimod.org/modifications_view.php?editid1=259}{Unimod 259} and
#' \href{http://www.unimod.org/modifications_view.php?editid1=267}{Unimod 267}
#' \href{https://www.unimod.org/modifications_view.php?editid1=259}{Unimod 259} and
#' \href{https://www.unimod.org/modifications_view.php?editid1=267}{Unimod 267}
#'
#' \item 15n
#' \href{http://www.unimod.org/modifications_view.php?editid1=994}{Unimod 994},
#' \href{http://www.unimod.org/modifications_view.php?editid1=995}{Unimod 995},
#' \href{http://www.unimod.org/modifications_view.php?editid1=996}{Unimod 996} and
#' \href{http://www.unimod.org/modifications_view.php?editid1=897}{Unimod 897}
#' \href{https://www.unimod.org/modifications_view.php?editid1=994}{Unimod 994},
#' \href{https://www.unimod.org/modifications_view.php?editid1=995}{Unimod 995},
#' \href{https://www.unimod.org/modifications_view.php?editid1=996}{Unimod 996} and
#' \href{https://www.unimod.org/modifications_view.php?editid1=897}{Unimod 897}
#'
#' }
#' @examples
Expand All @@ -34,8 +34,8 @@ function(seq, label = "none", aaShift = NULL, monoisotopic = TRUE){

# Check inputs
label <- tolower(label) # Renders case-insensitive input string.
if(!(label %in% c("none", "silac_13c", "silac_13c15n", "15n"))){
stop("Given label type unknown. Please use one of 'none', '15N', 'Silac_13C15N', or 'Silac_13C' (case-insensitive).")
if(!(label %in% c("none", "silac_13c", "silac_13c15n", "15n", "13c", "13c15n"))){
stop("Given label type unknown. Please use one of 'none', '15N', '13C', '13C15N', 'Silac_13C15N', or 'Silac_13C' (case-insensitive).")
}
if(!is.null(aaShift) & is.null(names(aaShift))){
stop("'aaShift' must be given as a named vector, e.g. 'aaShift = c(K = 6.020129)'.")
Expand Down Expand Up @@ -74,7 +74,57 @@ function(seq, label = "none", aaShift = NULL, monoisotopic = TRUE){
W = 2,
Y = 1,
V = 1
) * 0.997035 -0.003635*!monoisotopic # 0.997035 equals the mass shift from 14N to 15N. 0.9934 equals the average mass shift.
) * (0.997035 -0.003635*!monoisotopic) # 0.997035 equals the mass shift from 14N to 15N. 0.9934 equals the mass shift from average N to 15N.
} else if(label == "13c"){
aaShift <- c(
# U = ,
# O = ,
A = 3,
R = 6,
N = 4,
D = 4,
C = 3,
E = 5,
Q = 5,
G = 2,
H = 6,
I = 6,
L = 6,
K = 6,
M = 5,
F = 9,
P = 5,
S = 3,
T = 4,
W = 11,
Y = 9,
V = 5
) * (1.003355 -0.010705*!monoisotopic) # 1.003355 equals the mass shift from 12C to 13C. 0.99265 equals the mass shift from average C to 13C.
} else if(label == "13c15n"){
n <- 0.997035 -0.003635*!monoisotopic
c <- 1.003355 -0.010705*!monoisotopic
aaShift <- c(
A = 1*n + 3*c,
R = 4*n + 6*c,
N = 2*n + 4*c,
D = 1*n + 4*c,
C = 1*n + 3*c,
E = 1*n + 5*c,
Q = 2*n + 5*c,
G = 1*n + 2*c,
H = 3*n + 6*c,
I = 1*n + 6*c,
L = 1*n + 6*c,
K = 2*n + 6*c,
M = 1*n + 5*c,
F = 1*n + 9*c,
P = 1*n + 5*c,
S = 1*n + 3*c,
T = 1*n + 4*c,
W = 2*n + 11*c,
Y = 1*n + 9*c,
V = 1*n + 5*c
)
}

# Split sequence by amino acids
Expand Down
14 changes: 13 additions & 1 deletion tests/testthat/test.massShift.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ test_that("massShift function: the computed value is wrong",{
test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "15n"), expected = 14.95552, tolerance = 0.001)
})
test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "13c"), expected = 47.15769, tolerance = 0.001)
})
test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "13c15n"), expected = 62.11321, tolerance = 0.001)
})

# CHECK SHIFT VALUE - PREDEFINED LABELS - AVERAGE
test_that("massShift function: the computed value is wrong",{
Expand All @@ -27,7 +33,13 @@ test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "silac_13c15n", monoisotopic = F), expected = 17.8723, tolerance = 0.001)
})
test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "15n", monoisotopic = F), expected = 14.91554, tolerance = 0.001)
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "15n", monoisotopic = F), expected = 14.901, tolerance = 0.001)
})
test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "13c", monoisotopic = F), expected = 46.65455, tolerance = 0.001)
})
test_that("massShift function: the computed value is wrong",{
expect_equal(object = massShift(seq = "AGEPKLDAGVR", label = "13c15n", monoisotopic = F), expected = 61.55555, tolerance = 0.001)
})

# CHECK OUTPUT CLASS
Expand Down