Skip to content

Commit

Permalink
docs: add comment and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Sep 22, 2023
1 parent 1645a4c commit 7d169e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion R/MsBackend.R
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,11 @@
#' `data`. The second parameter `peaksVariables` allows to define which columns
#' in `data` contain *peak variables* such as the m/z and intensity values of
#' individual peaks per spectrum. The default for this parameter is
#' `peaksVariables = c("mz", "intensity")`.
#' `peaksVariables = c("mz", "intensity")`. Note that it is not supported to
#' provide either `"mz"` or `"intensity"`, if provided, both need to be
#' present in the data frame. Alternatively, the function also supports a data
#' frame without m/z and intensity values, in which case a `Spectra` without
#' mass peaks is created.
#'
#' Suggested columns of this `DataFrame` are:
#'
Expand Down
2 changes: 2 additions & 0 deletions R/MsBackendDataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ setMethod("backendInitialize", signature = "MsBackendDataFrame",
if (!is(data, "DataFrame"))
stop("'data' has to be a 'DataFrame'")
peaksVariables <- intersect(peaksVariables, colnames(data))
## support either no m/z or intensity values provided, or both
## have to be specified.
if (sum(c("mz", "intensity") %in% peaksVariables) == 1L)
stop("Both \"mz\" and \"intensity\" peak variables ",
"need to be provided.")
Expand Down
6 changes: 5 additions & 1 deletion man/MsBackend.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7d169e4

Please sign in to comment.