Skip to content

Commit f9ec8cf

Browse files
committed
Merge branch 'jorainer-jomain' into devel
2 parents 4fe6e24 + b751370 commit f9ec8cf

File tree

8 files changed

+60
-63
lines changed

8 files changed

+60
-63
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
^\.Rproj\.user$
44
^\.gitignore$
55
^\.git$
6+
^\.github$

.github/workflows/check-bioc.yml

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ name: R-CMD-check-bioc
3434
## Note that you can always run a GHA test without the cache by using the word
3535
## "/nocache" in the commit message.
3636
env:
37-
has_testthat: 'true'
37+
has_testthat: 'false'
3838
run_covr: 'true'
3939
run_pkgdown: 'true'
40-
has_RUnit: 'false'
40+
has_RUnit: 'true'
4141
has_BiocCheck: 'false'
4242
cache-version: 'cache-v1'
4343

@@ -123,33 +123,14 @@ jobs:
123123
- name: Install macOS system dependencies
124124
if: matrix.config.os == 'macOS-latest'
125125
run: |
126-
## Enable installing XML from source if needed
127-
brew install libxml2
128-
echo "XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config" >> $GITHUB_ENV
129-
130-
## Required to install magick as noted at
131-
## https://github.com/r-lib/usethis/commit/f1f1e0d10c1ebc75fd4c18fa7e2de4551fd9978f#diff-9bfee71065492f63457918efcd912cf2
132-
brew install imagemagick@6
133-
134-
## For textshaping, required by ragg, and required by pkgdown
135-
brew install harfbuzz fribidi
136-
137-
## For installing usethis's dependency gert
138-
brew install libgit2
139-
140-
## required for ncdf4
141-
## brew install netcdf ## Does not work as it is compiled with gcc
142-
## Use pre-compiled libraries from https://mac.r-project.org/libs-4/
143-
curl -O https://mac.r-project.org/libs-4/netcdf-4.7.4-darwin.17-x86_64.tar.gz
144-
tar fvxzm netcdf-4.7.4-darwin.17-x86_64.tar.gz -C /
145-
rm netcdf-4.7.4-darwin.17-x86_64.tar.gz
146-
curl -O https://mac.r-project.org/libs-4/hdf5-1.12.0-darwin.17-x86_64.tar.gz
147-
tar fvxzm hdf5-1.12.0-darwin.17-x86_64.tar.gz -C /
148-
rm hdf5-1.12.0-darwin.17-x86_64.tar.gz
149-
curl -O https://mac.r-project.org/libs-4/szip-2.1.1-darwin.17-x86_64.tar.gz
150-
tar fvxzm szip-2.1.1-darwin.17-x86_64.tar.gz -C /
151-
rm szip-2.1.1-darwin.17-x86_64.tar.gz
152-
126+
## Install pre-compiled libraries from
127+
## https://mac.r-project.org/bin/darwin17/x86_64/
128+
## The path might need to be updated depending on the macOS version.
129+
130+
# curl -O https://mac.r-project.org/bin/darwin20/arm64/openssl-3.3.2-darwin.20-arm64.tar.xz
131+
# tar -xvmpf openssl-3.3.2-darwin.20-arm64.tar.xz -C /
132+
# rm openssl-3.3.2-darwin.20-arm64.tar.xz
133+
153134
- name: Install Windows system dependencies
154135
if: runner.os == 'Windows'
155136
run: |
@@ -201,17 +182,17 @@ jobs:
201182
if: env.has_RUnit == 'true'
202183
run: |
203184
## Install BiocGenerics
204-
BiocManager::install("BiocGenerics")
185+
BiocManager::install(c("BiocGenerics", "RUnit"))
205186
shell: Rscript {0}
206187

207188
- name: Install covr
208-
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
189+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
209190
run: |
210191
remotes::install_cran("covr")
211192
shell: Rscript {0}
212193

213194
- name: Install pkgdown
214-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
195+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
215196
run: |
216197
remotes::install_github("r-lib/pkgdown")
217198
shell: Rscript {0}
@@ -261,20 +242,21 @@ jobs:
261242
shell: Rscript {0}
262243

263244
- name: Test coverage
264-
if: github.ref == 'refs/heads/master' && env.run_covr == 'true' && runner.os == 'Linux'
245+
if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux'
265246
run: |
266247
covr::codecov()
267248
shell: Rscript {0}
268249

269250
- name: Install package
270-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
251+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
271252
run: R CMD INSTALL .
272253

273254
- name: Deploy package
274-
if: github.ref == 'refs/heads/master' && env.run_pkgdown == 'true' && runner.os == 'Linux'
255+
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
275256
run: |
276257
git config --local user.email "[email protected]"
277258
git config --local user.name "GitHub Actions"
259+
git config --global --add safe.directory /__w/mzR/mzR
278260
Rscript -e "pkgdown::deploy_to_branch(new_process = FALSE)"
279261
shell: bash {0}
280262
## Note that you need to run pkgdown::deploy_to_branch(new_process = FALSE)

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: mzR
22
Type: Package
33
Title: parser for netCDF, mzXML and mzML and mzIdentML files
44
(mass spectrometry data)
5-
Version: 2.41.3
5+
Version: 2.41.4
66
Author: Bernd Fischer, Steffen Neumann, Laurent Gatto, Qiang Kou, Johannes Rainer
77
Authors@R: c(
88
person("Steffen", "Neumann", email="[email protected]", role=c("aut","cre")),

NEWS

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
CHANGES IN VERSION 2.41.4
2+
-------------------------
3+
o Use "rtime" and "intensity" as column names for the data.frame returned
4+
by `chromatogram()`. Fixes #304.
5+
16
CHANGES IN VERSION 2.41.3
27
-------------------------
3-
o Fixed off-by-one indexing issue with index access for chromatogramHeader vs chromatogram. Fixes #302. Thanks Nils Hoffmann !
8+
o Fixed off-by-one indexing issue with index access for chromatogramHeader vs
9+
chromatogram. Fixes #302. Thanks Nils Hoffmann !
410

511
CHANGES IN VERSION 2.41.2
612
-------------------------

R/methods-mzRpwiz.R

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,34 +154,29 @@ setMethod("tic", "mzRpwiz",
154154
})
155155

156156
setMethod("chromatograms", "mzRpwiz",
157-
function(object, chrom) chromatogram(object, chrom))
158-
157+
function(object, chrom, drop = TRUE) chromatogram(object, chrom,
158+
drop = drop))
159159

160160
setMethod("chromatogram", "mzRpwiz",
161-
function(object, chrom) {
161+
function(object, chrom, drop = TRUE) {
162162
## To avoid confusion, the first chromatogram (at index
163163
## 0) is indexed at position 1 in R and the last one (at
164164
## index nChrom(object) - 1) is indexed at position
165165
## nChrom(object).
166166
n <- nChrom(object)
167-
all <- FALSE
168-
if (missing(chrom)) {
167+
if (missing(chrom))
169168
chrom <- 1:n
170-
all <- TRUE
169+
else {
170+
stopifnot(is.numeric(chrom))
171+
chrom <- as.integer(chrom)
171172
}
172-
stopifnot(is.numeric(chrom))
173-
chrom <- as.integer(chrom)
174173
if (min(chrom) < 1 | max(chrom) > n)
175174
stop("Index out of bound [", 1, ":", n, "].")
176175
# chromatogram index is adjusted in the backend function
177-
if (length(chrom) == 1 & !all) {
178-
ans <- object@backend$getChromatogramsInfo(chrom)
179-
} else {
180-
ans <- lapply(chrom,
181-
function(x)
182-
object@backend$getChromatogramsInfo(x))
183-
}
184-
return(ans)
176+
if (drop && length(chrom) == 1)
177+
object@backend$getChromatogramsInfo(chrom)
178+
else
179+
lapply(chrom, object@backend$getChromatogramsInfo)
185180
})
186181

187182
setMethod("chromatogramHeader", "mzRpwiz",
@@ -191,7 +186,6 @@ setMethod("chromatogramHeader", "mzRpwiz",
191186
} else {
192187
stopifnot(is.numeric(chrom))
193188
n <- nChrom(object)
194-
195189
if (min(chrom) < 1 | max(chrom) > n)
196190
stop("Index out of bound [", 1, ":", n, "]")
197191
# chromatogram index is adjusted in the backend function

inst/unitTests/test_chromatograms.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ test_chromatograms1 <- function() {
1111
checkIdentical(nrow(chromatogram(x, 136L)), 527L)
1212
checkIdentical(nrow(chromatogram(x, 137L)), 567L)
1313
checkIdentical(nrow(chromatogram(x, 138L)), 567L)
14+
chr <- chromatogram(x, 138L)
15+
checkTrue(is.data.frame(chr))
16+
checkIdentical(colnames(chr), c("rtime", "intensity"))
17+
chr1 <- chromatogram(x, 138L, drop = FALSE)
18+
checkTrue(is.list(chr1))
19+
checkEquals(chr, chr1[[1L]])
1420
close(x)
1521
}
1622

@@ -62,9 +68,9 @@ test_chromatogramHeader_indexing <- function() {
6268
checkTrue(grepl("Index out of bound", e$message))
6369
})
6470

71+
all_chrom <- chromatogram(x)
6572
chrom2 <- chromatogram(x, 2)
66-
ch2SafeChromId <- make.names(ch2$chromatogramId)
67-
checkEquals(ch2SafeChromId, colnames(chrom2)[2])
73+
checkEquals(all_chrom[[2]], chrom2)
6874

6975
close(x)
7076
}

man/peaks.Rd

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151

5252
get3Dmap(object, scans, lowMz, highMz, resMz, ...)
5353

54-
\S4method{chromatogram}{mzRpwiz}(object, chrom)
54+
\S4method{chromatogram}{mzRpwiz}(object, chrom, drop = TRUE)
5555

56-
\S4method{chromatograms}{mzRpwiz}(object, chrom) ## same as chromatogram
56+
\S4method{chromatograms}{mzRpwiz}(object, chrom, drop = TRUE) ## same as chromatogram
5757

5858
\S4method{chromatogramHeader}{mzRpwiz}(object, chrom)
5959

@@ -84,6 +84,14 @@
8484
for all chromatograms is returned.
8585
}
8686

87+
\item{drop}{
88+
For \code{chromatogram()}, \code{chromatograms()}: \code{logical(1)}
89+
whether the result should always be a \code{list} of
90+
\code{data.frame} (\code{drop = FALSE}), even if data from a single
91+
chromatogram is requested, or if, in such cases, a \code{data.frame}
92+
should be returned (\code{drop = TRUE}, the default).
93+
}
94+
8795
\item{...}{Other arguments. A \code{scan} parameter can be passed to
8896
\code{peaks}.} }
8997

@@ -125,9 +133,9 @@
125133

126134
The \code{chromatogram} (\code{chromatograms}) accessors return
127135
chromatograms for the MS file handle. If a single index is provided,
128-
as \code{data.frame} containing the retention time (1st columns) and
129-
intensities (2nd column) is returned. The name of the former is always
130-
\code{time}, while the latter will depend on the run parameters.
136+
as \code{data.frame} containing the retention time (\code{"rtime"},
137+
first column) and intensities (\code{"intensity"}, second column) is
138+
returned.
131139

132140
If more than 1 or no chromatogram indices are provided, then a list of
133141
chromatograms is returned; either those passed as argument or all of

src/RcppPwiz.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,8 @@ Rcpp::DataFrame RcppPwiz::getChromatogramsInfo( int whichChrom )
875875
intensity.push_back(p.intensity);
876876
}
877877

878-
chromatogramsInfo = Rcpp::DataFrame::create(Rcpp::_["time"] = time,
879-
Rcpp::_[c->id] = intensity);
878+
chromatogramsInfo = Rcpp::DataFrame::create(Rcpp::_["rtime"] = time,
879+
Rcpp::_["intensity"] = intensity);
880880

881881
}
882882
return(chromatogramsInfo);

0 commit comments

Comments
 (0)