sgibb / maldiquant Goto Github PK
View Code? Open in Web Editor NEWQuantitative Analysis of Mass Spectrometry Data
Home Page: https://strimmerlab.github.io/software/maldiquant/
Quantitative Analysis of Mass Spectrometry Data
Home Page: https://strimmerlab.github.io/software/maldiquant/
plotMsiSlice
instead of plotImsSlice
.library("MALDIquant")
s <- c(createMassSpectrum(1:5, 1:5),
createMassSpectrum(double(), double()))
m <- mergeMassSpectra(s)
# Error in approxfun(x = x@mass, y = x@intensity, method = method, yleft = yleft, : need at least two non-NA values to interpolate
# In addition: Warning message:
# In max(x@intensity) : no non-missing arguments to max; returning -Inf
Use roxygen2 to create Rd files.
minNumber
should be reduced to the maximal number of MassPeaks objects in the current label otherwise all peaks will removed:
library("MALDIquant")
p <- c(createMassPeaks(1:3, 1:3),
createMassPeaks(1:2, 1:2),
createMassPeaks(1, 1))
filterPeaks(p, minNumber=2, labels=c(1, 2, 2))
# [[1]]
# S4 class type : MassPeaks
# Number of m/z values : 0
# Range of m/z values : NA
# Range of intensity values: NA
# Range of snr values : NA
# Memory usage : 1.234 KiB
#
# [[2]]
# S4 class type : MassPeaks
# Number of m/z values : 1
# Range of m/z values : 1 - 1
# Range of intensity values: 1 - 1
# Range of snr values : NA - NA
# Memory usage : 1.258 KiB
#
# [[3]]
# S4 class type : MassPeaks
# Number of m/z values : 1
# Range of m/z values : 1 - 1
# Range of intensity values: 1e+00 - 1e+00
# Range of snr values : NA - NA
# Memory usage : 1.258 KiB
expected output:
# warning: reduce minNumber for label "1" because minNumber > n doesn't make sense!
# [[1]]
# S4 class type : MassPeaks
# Number of m/z values : 3
# Range of m/z values : 1 - 3
# Range of intensity values: 1 - 3
# Range of snr values : NA - NA
# Memory usage : 1.281 KiB
Some raw files contain integer intensity values (e.g. fid files). Summing all this integers could cause an integer overflow.
totalIonCurrent(g[[1]])
# [1] NA
# Warning message:
# In sum(object@intensity, na.rm = TRUE) :
# Integer overflow - use sum(as.numeric(.))
To reproduce:
library("MALDIquant")
s <- c(createMassPeaks(1:4, rep(1, 4), metaData=list(name=33)),
createMassPeaks(1:4, rep(1, 4), metaData=list(name=33)),
createMassPeaks(1:4, rep(1, 4), metaData=list(name=22)),
createMassPeaks(1:4, rep(1, 4), metaData=list(name=22)),
createMassPeaks(1:4, rep(1, 4), metaData=list(name=34)),
createMassPeaks(1:4, rep(1, 4), metaData=list(name=34)))
f <- factor(rep(c(33, 22, 34), each=2))
p <- mergeMassPeaks(s, f)
sapply(p, function(x)metaData(x)$name)
## order is 22 33 44 instead of 33, 22, 34
Adapt to alignSpectra
and new intensityMatrix
(separate binPeaks
call is not needed anymore).
Since fix #23 mergeMassSpectra
throws a warning:
MassSpectrum created with missing/filtered mass values.
(which is not unusal in merging and should not confuse the user)
Seems to be a rounding problem:
> library("MALDIquant")
> createMassSpectrum(1:10, 1:10)
#S4 class type : MassSpectrum
#Number of m/z values : 10
#Range of m/z values : 1 - 10
#Range of intensity values: 1 - 10
> createMassSpectrum((1:10)+0.2, 1:10)
#S4 class type : MassSpectrum
#Number of m/z values : 10
#Range of m/z values : 1.2 - 10.2
#Range of intensity values: 1 - 10
#Warning message:
#In validityMethod(object) :
# MassSpectrum created with missing/filtered mass values. This may compromise subsequent baseline correction and peak detection.
Merge Monoisotopic Peak Detection from MALDIquantTools into MALDIquant.
using R Under development (unstable) (2013-07-02 r63156)
using platform: x86_64-unknown-linux-gnu (64-bit)
checking R code for possible problems ... NOTE
Found an obsolete/platform-specific call in the following function:
‘.openInteractiveDevice’
Found the platform-specific devices:
‘X11’ ‘windows’
dev.new() is the preferred way to open a new device,
in the unlikely event one is needed.
filterPeaks
doesn't allow different minFrequency
arguments for different labels. It only allows one minFrequency
argument for all labels. That's only fine if all biological replicates have the same number of technical replicates.
Wrapper around transformIntensity
.
R CMD check output:
File
LICENSE
is not mentioned in the DESCRIPTION file.
MALDIquant is distributed under GPL (>=3) which is a supported license. We already use the License: GPL
field in DESCRIPTION
. That's why the LICENSE
file could simply removed (it should be used only for unsupported licenses).
Currently the TIC is calculated by sum(spectrum@intensity)
but this is only correct if all spectrum@mass
values are equally spaced. For most spectra generated by Bruker devices this isn't true, because the difference between to mass values increases.
Something like (head(intensity, -1)+tail(intensity, -1))/2 * diff(mass)
is needed.
In the future, pls explain
MALDI (11:47)
TOF (11:53)
TopHat (13:37)in the Description
The representation
argument in setClass
was marked as deprecated (replaced by slots
and contains
).
Centroided or missing mass values break our window-based baseline correction and peak detection algorithms. That's why the constructor createMassSpectrum
has to test for centroided or missing mass values and shows a warning if needed.
filterPeaks use floor
to determine minimal number of peaks from a given minFrequency
argument but it should not round it because this behavior is mostly unexpected.
To reproduce:
minFrequency=2/3
;
2/3_3 == 2 (at least 2; mass == 1:4 for group 1);
2/3_4 == 2.6667 (=> at least 3 peaks (mass == 1:4) for group 2; but filterPeaks uses floor and we get mass == 1:5)
library("MALDIquant")
p <- c(createMassPeaks(1:3, 1:3),
createMassPeaks(1:4, 1:4),
createMassPeaks(1:5, 1:5),
createMassPeaks(1:3, 1:3),
createMassPeaks(1:4, 1:4),
createMassPeaks(1:5, 1:5),
createMassPeaks(1:6, 1:6))
sapply(filterPeaks(p, minFrequency=2/3, labels=c(rep(1, 3), rep(2, 4))), mass)
iplot
uses some platform specific code, causes NOTE s on CRAN checks and the most important function getGraphicsEvent
has some bugs e.g. https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15208
see also: #13
Mark
calibrate
on matricesstandardizeTotalIonCurrent
on MassSpectrum objectstotalIonCurrent<-
as deprecated.
Documentation
calibrateIntensity
(TIC, Median, PQN)calibrateIntensity
to workflow exampleR 3.0.0 will add LongVector support:
http://stat.ethz.ch/R-manual/R-devel/library/base/html/LongVectors.html
Length of mass
and intensity
are possibly no integers anymore. That's why some C code has to be rewritten. All .C
-calls have to be replaced by .Call
(#14).
( Low priority because who want's to (or could) create spectra with more than 2^31-1 data points?:open_mouth:)
Don't forget MALDIquant-internal.Rd
.
library("MALDIquant")
p <- c(createMassPeaks(mass=1:2, intensity=1:2,
metaData=list(files=letters[1:2])),
createMassPeaks(mass=1, intensity=1,
metaData=list(files=letters[3])))
mergeMassPeaks(p)
averageMassSpectra
will replace current mergeMassSpectra
(should be marked as deprecated or should really merges spectra) and will work on a mass range that is covered by all spectra.
To reproduce:
library("MALDIquant")
s <- createMassSpectrum(1:2, 1:2)
estimateBaseline(s, method="Median")
Output:
Warning message:
In runmed(y, k = (2 * halfWindowSize + 1)) :
'k' is bigger than 'n'! Changing 'k' to 1
Don't forget NAMESPACE
and man page.
To reproduce:
library("MALDIquant")
data(fiedler2009subset)
MALDIquant:::.doByLabels(fiedler2009subset[1:4], labels=1:4, function(x)x[[1]])
Error message:
Error in `split<-.default`(`*tmp*`, f, drop = drop, value = value) :
object of type 'S4' is not subsettable
It should be possible to use TIC only on a user-defined range.
(If no range is given the largest overlap should be chosen.)
library("MALDIquant")
s <- createMassSpectrum(mass=1:10, intensity=rep(0, 10))
as.matrix(s)
# mass intensity
# [1,] 1 0
# [2,] 2 0
# [3,] 3 0
# [4,] 4 0
# [5,] 5 0
# [6,] 6 0
# [7,] 7 0
# [8,] 8 0
# [9,] 9 0
#[10,] 10 0
length(s)
# [1] 10
totalIonCurrent(s) <- 1
as.matrix(s)
# mass intensity
length(s)
# [1] 0
Don't forget NAMESPACE
and MALDIquant-internal.Rd
.
Package in Depends field not imported from: ‘methods’
These packages needs to imported from for the case when
this namespace is loaded but not attached.
See the information on DESCRIPTION files in the chapter ‘Creating R
packages’ of the ‘Writing R Extensions’ manual.
cleanup and move tests from ../tests
to inst/tests/
Use mclapply
and mcmapply
to allow parallel execution at least on unix based platforms.
Would you consider depending on ProtGenerics
and use the mass
and intensity
generics that are defined there? They are defined as follows
setGeneric("intensity", function(object, ...) standardGeneric("intensity"))
setGeneric("mass", function(object, ...) standardGeneric("mass"))
testthat 0.8 comes with a new recommended structure for storing your tests. To
better meet CRAN recommended practices, testthat now recommend that you to put
your tests in tests/testthat
, instead of inst/test
(this makes it
possible for users to choose whether or not to install tests). With this
new structure, you'll need to use test_check()
instead of test_packages()
in the test file (usually tests/testthat.R
) that runs all testthat unit
tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.