Skip to content

Commit

Permalink
Merge branch 'master' into devel
Browse files Browse the repository at this point in the history
* master:
  fix typo
  document issue 160 in readMSData2 acq num warning
  add a warning if acq num not sorted - close issue #160
  fix confusing typo in news
  update readme
  injection time is now added by default in readMSData2
  mention v2.0 and readMSData2 in main vignette
  suggest on latest msdata
  fix bug in addInjectionTime
  rename to addInjectionTime
  new injectionTime method (see issue #159) - code in previous commit
  specify pattern when getting msdata::proteomics files
  new gh devel version

From: Laurent <[email protected]>

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MSnbase@122003 bc3139a8-67e5-0310-9ffc-ced21a209358
  • Loading branch information
l.gatto committed Oct 6, 2016
1 parent 1ffc6b8 commit e108d6b
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 12 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MSnbase
Title: Base Functions and Classes for MS-based Proteomics
Version: 1.99.2
Version: 1.99.3
Description: Basic plotting, data manipulation and processing
of MS-based Proteomics data.
Authors@R: c(person(given = "Laurent", family = "Gatto",
Expand Down Expand Up @@ -63,6 +63,7 @@ Imports:
lattice,
ggplot2,
S4Vectors,
XML,
Rcpp
Suggests:
testthat,
Expand All @@ -75,7 +76,7 @@ Suggests:
Rdisop,
pRoloc,
pRolocdata (>= 1.7.1),
msdata,
msdata (>= 0.12.2),
roxygen2,
rgl,
rpx,
Expand All @@ -85,7 +86,6 @@ Suggests:
imputeLCMD,
norm,
gplots,
XML,
shiny
LinkingTo: Rcpp
License: Artistic-2.0
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import(impute)
import(lattice)
import(methods)

importFrom(XML, xmlInternalTreeParse, getDefaultNamespace, xpathApply,
xmlAttrs)

importFrom(graphics, abline, axis, grid, legend, lines, points, text,
barplot, layout, par)
importFrom(stats, ave, median, medpolish, quantile, reorder, setNames,
Expand Down Expand Up @@ -156,7 +159,6 @@ exportMethods(updateObject,
"sampleNames<-",
fileNames,
msInfo,
isolationWindow,
expemail, exptitle,
ionSource, ionSourceDetails,
analyser, analyzer,
Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
CHANGES IN VERSION 1.99.3
-------------------------
o Injection time is now added to the header when reading mzML files
using readMSData2 (see issue #159) <2016-10-04 Tue>

CHANGES IN VERSION 1.99.2
-------------------------
o Added isolationWindow,MSnExp method <2016-09-23 Fri>
Expand Down
2 changes: 2 additions & 0 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,5 @@ setGeneric("filterRt", function (object, ...) standardGeneric("filterRt"))
setGeneric("filterMsLevel", function (object, ...) standardGeneric("filterMsLevel"))
setGeneric("filterFile", function (object, ...) standardGeneric("filterFile"))
setGeneric("filterAcquisitionNum", function (object, ...) standardGeneric("filterAcquisitionNum"))

## isolationWindow generic is in mzR
13 changes: 13 additions & 0 deletions R/header.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## These data should eventually be extracted in mzR and added to the
## default header

injectionTimeFromFile1 <- function(f) {
xvals <- vector("list", length = length(f))
doc <- XML::xmlInternalTreeParse(f)
namespaceDef <- XML::getDefaultNamespace(doc)
ns <- c(x = namespaceDef[[1]]$uri)
x <- XML::xpathApply(doc, "//x:cvParam[@accession = 'MS:1000927']",
namespaces = ns, xmlAttrs)
xvals <- sapply(x, "[", "value")
as.numeric(unlist(xvals))
}
8 changes: 8 additions & 0 deletions R/readMSData2.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ readMSData2 <- function(files,
centroided = rep(as.logical(NA), nrow(fdData)),
smoothed = rep(as.logical(smoothed.), nrow(fdData)),
fdData, stringsAsFactors = FALSE)
injt <- injectionTimeFromFile1(f)
if (is.numeric(injt) && length(injt) == nrow(fdData))
fdData$injectionTime <- injt
## Order the fdData by acquisitionNum to force use of acquisitionNum
## as unique ID for the spectrum (issue #103). That way we can use
## the spIdx (is the index of the spectrum within the file) for
## subsetting and extracting.
if (!all(sort(fdData$acquisitionNum) == fdData$acquisitionNum))
warning(paste("Unexpected acquisition number order detected.",
"Please contact the maintainers or open an issue",
"on https://github.com/lgatto/MSnbase.",
sep = "\n")) ## see issue #160
fdData <- fdData[order(fdData$acquisitionNum), ]
featureDataList <- c(featureDataList, list(fdData))
mzR::close(msdata)
Expand Down
2 changes: 1 addition & 1 deletion man/OnDiskMSnExp-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ mzsAfter <- intensity(odmse)
head(lengths(mzs))
head(lengths(mzsAfter))
f <- msdata::proteomics(full.names = TRUE)
f <- msdata::proteomics(full.names = TRUE, pattern = "TMT_Erwinia")
odmse <- readMSData2(f)
validObject(odmse)
odmse[[1]]
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_MSnExp.R
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ test_that("Noise estimation MSnExp", {
})

test_that("isolation window", {
f <- msdata::proteomics(full.names = TRUE)
f <- msdata::proteomics(full.names = TRUE, pattern = "TMT_Erwinia")
i1 <- isolationWindow(f, unique = FALSE)
i2 <- isolationWindow(readMSData2(f), unique = FALSE)
i3 <- isolationWindow(readMSData(f), unique = FALSE)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_OnDiskMSnExp.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("OnDiskMSnExp constructor", {
})

test_that("Coercion to MSnExp", {
f <- msdata:::proteomics(full.names = TRUE)
f <- msdata:::proteomics(full.names = TRUE, pattern = "TMT_Erwinia")
x <- readMSData2(f, verbose = FALSE)
y <- readMSData(f, msLevel. = 2, centroided. = NA, verbose = FALSE)
expect_error(as(x, "MSnExp"))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_centroided.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_that("centroided accessor with/without na.fail", {
f <- msdata::proteomics(full.names = TRUE)
f <- msdata::proteomics(full.names = TRUE, pattern = "TMT_Erwinia")
x <- readMSData(f)
x2 <- readMSData2(f)
## in-mem, single spectrum
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_readMSData2.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context("readMSData2")

test_that("msLevel set correctly", {
f <- msdata::proteomics(full.names = TRUE)
f <- msdata::proteomics(full.names = TRUE, pattern = "TMT_Erwinia")
x <- readMSData2(f, verbose = FALSE)
expect_equivalent(centroided(x), rep(NA, length(x)))
x <- readMSData2(f, centroided = TRUE, verbose = FALSE)
Expand Down
12 changes: 10 additions & 2 deletions vignettes/MSnbase-demo.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ format\footnote{%%
\paragraph{Raw data} The \texttt{XML}-based formats, \texttt{mzXML}
\cite{Pedrioli2004}, \texttt{mzData} \cite{Orchard2007} and
\texttt{mzML} \cite{Martens2010} can be imported with the
\Rfunction{readMSData} function, as illstrated below (see
\Rfunction{readMSData} function, as illustrated below (see
\Rfunction{?readMSData} for more details).


Expand All @@ -120,13 +120,21 @@ rawdata <- readMSData(file, msLevel = 2, verbose = FALSE)
@
%% $

Either MS1 or MS2 spectra can be loaded at a time by setting the
Only spectra of a give MS level can be loaded at a time by setting the
\texttt{msLevel} parameter accordingly. In this document, we will use
the \Robject{itraqdata} data set, provided with \Biocpkg{MSnbase}. It
includes feature metadata, accessible with the \Rfunction{fData}
accessor. The metadata includes identification data for the
\Sexpr{length(itraqdata)} MS2 spectra.

\paragraph{MSnbase 2.0 } The new major version of \Biocpkg{MSnbase}
uses a new \textit{on-disk} data storage model (see the
\textit{benchmarking} vignette for more details). The new data backend
is compatible with the orignal \textit{in-memory} model. To make use
of the new infrastructure, read your raw data using
\Rfunction{readMSData2}, rather than \Rfunction{readMSData}. All
existing operations work irrespective of the backend.

\paragraph{Peak lists} Peak lists can often be exported after spectrum
processing from vendor-specific software and are also used as input to
search engines. Peak lists in \texttt{mgf} format can be imported
Expand Down
2 changes: 1 addition & 1 deletion vignettes/benchmarking.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ distributed with the `r Biocexptpkg("msdata")` package

```{r msdata}
library("msdata")
f <- msdata::proteomics(full.names = TRUE)
f <- msdata::proteomics(full.names = TRUE, pattern = "TMT_Erwinia")
basename(f)
```

Expand Down

0 comments on commit e108d6b

Please sign in to comment.