Skip to content

Commit

Permalink
refactor: import filterSpectra from ProtGenerics
Browse files Browse the repository at this point in the history
- Import `filterSpectra` from `ProtGenerics`.
- Address Laurent's review comments.
  • Loading branch information
jorainer committed Jan 24, 2024
1 parent 8b7ab92 commit e817ed3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Authors@R: c(person(given = "Laurent", family = "Gatto",
role = "aut"))
Depends:
R (>= 4.2),
ProtGenerics (>= 1.9.1),
ProtGenerics (>= 1.35.2),
Imports:
methods,
S4Vectors,
Expand All @@ -53,7 +53,7 @@ VignetteBuilder: knitr
BugReports: https://github.com/RforMassSpectrometry/MsExperiment/issues
URL: https://github.com/RforMassSpectrometry/MsExperiment
biocViews: Infrastructure, Proteomics, MassSpectrometry, Metabolomics, ExperimentalDesign, DataImport
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown=TRUE)
Encoding: UTF-8
Collate:
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export(MsExperimentFiles)
export(dbWriteSampleData)
export(existMsExperimentFiles)
export(experimentFiles)
export(filterSpectra)
export(linkSampleData)
export(otherData)
export(qdata)
Expand Down Expand Up @@ -53,6 +52,7 @@ importFrom(methods,slotNames)
importFrom(methods,validObject)
importMethodsFrom(BiocGenerics,dbconn)
importMethodsFrom(ProtGenerics,"spectra<-")
importMethodsFrom(ProtGenerics,filterSpectra)
importMethodsFrom(S4Vectors,"mcols<-")
importMethodsFrom(S4Vectors,"metadata<-")
importMethodsFrom(S4Vectors,mcols)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## MsExperiment 1.5.3

- Add `filterSpectra` method to allow filtering of `Spectra` within an
`MsExperiment` while keeping eventually present relationships between samples
`MsExperiment` while keeping possibly present relationships between samples
and spectra consistent.

## MsExperiment 1.5.2
Expand Down
10 changes: 3 additions & 7 deletions R/MsExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
#' - `filterSpectra`: subsets the `Spectra` within an `MsExperiment` using a
#' provided filter function (parameter `filter`). Parameters for the filter
#' function can be passed with parameter `...`. Any of the filter functions
#' of a [Spectra()] object can be passed with parameter `filter`. Eventually
#' of a [Spectra()] object can be passed with parameter `filter`. Possibly
#' present relationships between samples and spectra (*links*, see also
#' `linkSampleData`) are updated. Filtering affects only the spectra data
#' of the object, none of the other slots and data (e.g. `sampleData`) are
Expand Down Expand Up @@ -577,19 +577,15 @@ setMethod("[", "MsExperiment", function(x, i, j, ..., drop = FALSE) {
.extractSamples(x, i, newx = x)
})

#' @rdname MsExperiment
#'
#' @export
setGeneric("filterSpectra", def = function(object, filter, ...)
standardGeneric("filterSpectra"))

#' @rdname MsExperiment
#'
#' @importMethodsFrom Spectra selectSpectraVariables
#'
#' @importMethodsFrom Spectra spectraVariables
#'
#' @importMethodsFrom Spectra peaksVariables
#'
#' @importMethodsFrom ProtGenerics filterSpectra
setMethod(
"filterSpectra", c("MsExperiment", "function"),
function(object, filter, ...) {
Expand Down
7 changes: 2 additions & 5 deletions man/MsExperiment.Rd

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

0 comments on commit e817ed3

Please sign in to comment.