Skip to content

Commit

Permalink
refactor: change colnames of chromatogram() data.frame
Browse files Browse the repository at this point in the history
- Change the column names of the `data.frame` returned by `chromatogram()` to
  `"rtime"` and `"intensity"` (issue sneumann#304).
  • Loading branch information
jorainer committed Jan 29, 2025
1 parent 0368dbf commit 28e40f9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: mzR
Type: Package
Title: parser for netCDF, mzXML and mzML and mzIdentML files
(mass spectrometry data)
Version: 2.41.1
Version: 2.41.2
Author: Bernd Fischer, Steffen Neumann, Laurent Gatto, Qiang Kou, Johannes Rainer
Authors@R: c(
person("Steffen", "Neumann", email="[email protected]", role=c("aut","cre")),
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 2.41.2
-------------------------
o Use "rtime" and "intensity" as column names for the data.frame returned by
chromatogram() (# 304).

CHANGES IN VERSION 2.41.1
-------------------------
o Fix compilation error with stricter compiler checks
Expand Down
2 changes: 2 additions & 0 deletions inst/unitTests/test_chromatograms.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ test_chromatograms1 <- function() {
checkIdentical(nrow(chromatogram(x, 136L)), 527L)
checkIdentical(nrow(chromatogram(x, 137L)), 567L)
checkIdentical(nrow(chromatogram(x, 138L)), 567L)
chr <- chromatogram(x, 138L)
checkIdentical(colnames(chr), c("rtime", "intensity"))
}

test_chromatograms2 <- function() {
Expand Down
5 changes: 2 additions & 3 deletions man/peaks.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@

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

If more than 1 or no chromatogram indices are provided, then a list of
chromatograms is returned; either those passed as argument or all of
Expand Down
4 changes: 2 additions & 2 deletions src/RcppPwiz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,8 @@ Rcpp::DataFrame RcppPwiz::getChromatogramsInfo( int whichChrom )
intensity.push_back(p.intensity);
}

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

}
return(chromatogramsInfo);
Expand Down

0 comments on commit 28e40f9

Please sign in to comment.