Skip to content

Commit

Permalink
use PSMatch fragment functions - close #574
Browse files Browse the repository at this point in the history
  • Loading branch information
lgatto committed Dec 24, 2023
1 parent c766fc7 commit 9e08755
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 551 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: MSnbase
Title: Base Functions and Classes for Mass Spectrometry and Proteomics
Version: 2.29.1
Version: 2.29.2
Description: MSnbase provides infrastructure for manipulation,
processing and visualisation of mass spectrometry and
proteomics data, ranging from raw to quantitative and
Expand Down Expand Up @@ -79,6 +79,7 @@ Depends:
ProtGenerics (>= 1.29.1)
Imports:
MsCoreUtils,
PSMatch,
BiocParallel,
IRanges (>= 2.13.28),
plyr,
Expand Down Expand Up @@ -167,7 +168,6 @@ Collate:
'functions-Spectrum1.R'
'functions-Spectrum2.R'
'functions-addIdentificationData.R'
'functions-fragments.R'
'functions-mzR.R'
'functions-plotting.R'
'header.R'
Expand Down
17 changes: 9 additions & 8 deletions NAMESPACE
Expand Up @@ -17,6 +17,10 @@ import(scales)
import(lattice)
import(methods)

importFrom(PSMatch,
getAminoAcids,
defaultNeutralLoss)

importFrom(MsCoreUtils, closest, rbindFill,
impute_matrix, normalize_matrix,
robustSummary, medianPolish,
Expand Down Expand Up @@ -74,7 +78,6 @@ S3method(t, MSnSet)
export(MSnSet,
abstract,
compareMSnSets,
defaultNeutralLoss,
readMgfData,
readMSData,
readMSData2,
Expand Down Expand Up @@ -111,8 +114,6 @@ export(MSnSet,
updateFeatureNames,
updateSampleNames,
normalise, ## for normalize method
get.amino.acids,
get.atomic.mass,
listOf,
npcv,
selectFeatureData,
Expand Down Expand Up @@ -327,11 +328,11 @@ exportMethods(updateObject,
"isolationWindowUpperMz",
"filterPrecursorMz",
"filterIsolationWindow",
"alignRt",
"filterIntensity",
c,
compareChromatograms,
transformIntensity
"alignRt",
"filterIntensity",
c,
compareChromatograms,
transformIntensity
)

## methods NOT exported
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,5 +1,10 @@
# MSnbase 2.29

## MSnbase 2.29.2

- Use fragmentation functions from PSMatch.
- Mention R for Mass Spectrometry in start-up message.

## MSnbase 2.29.1

- Check for identical ion header in `readMgfData()` (see [issue
Expand Down
59 changes: 0 additions & 59 deletions R/environment.R
Expand Up @@ -14,63 +14,4 @@ ClassVersions <- c(

assign("ClassVersions", ClassVersions, envir = .MSnbaseEnv)

assign("amino.acids",
data.frame(AA = c("peg","A","R","N","D","C","E",
"Q","G","H","I","L", "K","M","F",
"P","S","T","W","Y","V"),
ResidueMass = c(44.00000,
71.03711, 156.10111, 114.04293, 115.02694,
103.00919, 129.04259, 128.05858, 57.02146,
137.05891, 113.08406, 113.08406, 128.09496,
131.04049, 147.06841, 97.05276, 87.03203,
101.04768, 186.07931, 163.06333, 99.06841),
Abbrev3 = c(NA,
"Ala", "Arg", "Asn", "Asp", "Cys",
"Glu", "Gln", "Gly", "His", "Ile",
"Leu", "Lys", "Met", "Phe", "Pro",
"Ser", "Thr", "Trp", "Tyr", "Val"),
ImmoniumIonMass = c(NA,
44.05003, 129.11400, 87.05584, 88.03986, 76.02210,
102.05550, 101.07150, 30.03438, 110.07180, 86.09698,
86.09698, 101.10790, 104.05340, 120.08130, 70.06568,
60.04494, 74.06059, 159.09220, 136.07620, 72.08133),
Name = c("Polyethylene glycol",
"Alanine", "Arginine", "Asparagine", "Aspartic acid",
"Cysteine", "Glutamic acid", "Glutamine", "Glycine",
"Histidine", "Isoleucine", "Leucine", "Lysine",
"Methionine", "Phenylalanine", "Proline", "Serine",
"Threonine", "Tryptophan", "Tyrosine", "Valine"),
## The hydrophobicity values are from JACS, 1962, 84: 4240-4246. (C. Tanford)
Hydrophobicity = c(NA, 0.62, -2.53, -0.78, -0.9, 0.29,
-0.74, -0.85, 0.48, -0.4, 1.38, 1.06, -1.5, 0.64, 1.19,
0.12, -0.18, -0.05, 0.81, 0.26, 1.08),
## The hydrophilicity values are from PNAS, 1981, 78:3824-3828 (T.P.Hopp & K.R.Woods)
Hydrophilicity = c(NA, -0.5, 3, 0.2, 3, -1, 3, 0.2, 0,
-0.5, -1.8, -1.8, 3, -1.3, -2.5, 0, 0.3, -0.4, -3.4,
-2.3, -1.5),
SideChainMass = c(NA, 15, 101, 58, 59, 47, 73, 72,
1, 82, 57, 57, 73, 75, 91, 42, 31, 45, 130, 107, 43),
## CRC Handbook of Chemistry and Physics, 66th ed., CRC Press, Boca Raton, Florida (1985).
## R.M.C. Dawson, D.C. Elliott, W.H. Elliott, K.M. Jones, Data for Biochemical Research 3rd ed., Clarendon Press Oxford
pK1 = c(NA, 2.35, 2.18, 2.18, 1.88, 1.71, 2.19,
2.17, 2.34, 1.78, 2.32, 2.36, 2.2, 2.28, 2.58,
1.99, 2.21, 2.15, 2.38, 2.2, 2.29),
pK2 = c(NA, 9.87, 9.09, 9.09, 9.6, 10.78, 9.67, 9.13,
9.6, 8.97, 9.76, 9.6, 8.9, 9.21, 9.24, 10.6, 9.15,
9.12, 9.39, 9.11, 9.74),
pI = c(NA, 6.11, 10.76, 10.76, 2.98, 5.02, 3.08,
5.65, 6.06, 7.64, 6.04, 6.04, 9.47, 5.74, 5.91,
6.3, 5.68, 5.6, 5.88, 5.63, 6.02)),
envir = .MSnbaseEnv)

assign("atomic.mass",
## taken from:
## http://www.chem.ualberta.ca/~massspec/atomic_mass_abund.pdf
c(H=1.007825,
C=12,
N=14.003074,
O=15.994915,
p=1.007276),
envir = .MSnbaseEnv)

lockEnvironment(.MSnbaseEnv,bindings=TRUE)
2 changes: 1 addition & 1 deletion R/functions-Spectrum2.R
Expand Up @@ -7,7 +7,7 @@
#' equal
#' @param method matching method
#' @param relative relative (or absolute) deviation
#' @param ... further arguments passed to calculateFragments
#' @param ... further arguments passed to `PSMarch:::.calculateFragments()`
#' @noRd
calculateFragments_Spectrum2 <- function(sequence, object, tolerance=0.1,
method=c("highest", "closest", "all"),
Expand Down
220 changes: 0 additions & 220 deletions R/functions-fragments.R

This file was deleted.

4 changes: 2 additions & 2 deletions R/functions-mzR.R
Expand Up @@ -76,14 +76,14 @@ plotMzDelta_list <- function(object, ## peakLists
ggtitle("Histogram of Mass Delta Distribution")
if (withLabels) {
y_offset <- x_offset <- rep(0.5, 21)
names(y_offset) <- names(x_offset) <- .get.amino.acids()$AA
names(y_offset) <- names(x_offset) <- PSMatch::getAminoAcids()$AA
x_offset[c("I", "L", "K", "Q")] <- 1
y_offset[c("V", "C")] <- 1
y_offset[c("P", "T")] <- 0
y_offset[c("N", "E")] <- 1
y_offset[c("K", "Q", "I", "L")] <- 0
y_offset[c("D", "M")] <- 0
aa <- cbind(.get.amino.acids(), x_offset, y_offset)
aa <- cbind(PSMatch::getAminoAcids(), x_offset, y_offset)
## removing Isoleucine, as it has the same residue mass
## as leucine, and updating leucine's label to I/L
aa$AA <- as.character(aa$AA)
Expand Down
2 changes: 1 addition & 1 deletion R/methods-fragments.R
Expand Up @@ -3,7 +3,7 @@ setMethod("calculateFragments", c("character", "missing"),
modifications = c(C = 57.02146),
neutralLoss = defaultNeutralLoss(),
verbose = isMSnbaseVerbose()) {
l <- lapply(sequence, .calculateFragments,
l <- lapply(sequence, PSMatch:::.calculateFragments,
type = type, z = z, modifications = modifications,
neutralLoss = neutralLoss, verbose = verbose)
return(do.call(rbind, l))
Expand Down

0 comments on commit 9e08755

Please sign in to comment.