-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add findpeaks for GCIMSSpectrum and update alignment options
- Loading branch information
lalo-caballero
committed
May 3, 2024
1 parent
9d4a822
commit eb20294
Showing
13 changed files
with
150 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#' Peak detection for a GCIMSSpectrum | ||
#' @param object A [GCIMSSpectrum] object | ||
#' @inheritDotParams findPeaksImpl1D -x -y | ||
#' @return The modified [GCIMSSpectrum], with a peak list | ||
#' @family GCIMSSpectrum | ||
#' @export | ||
setMethod( | ||
"findPeaks", | ||
"GCIMSSpectrum", | ||
function(object, ...) { | ||
dt <- dtime(object) | ||
intens <- intensity(object) | ||
peak_list_and_debug_info <- findPeaksImpl1D( | ||
x = dt, | ||
y = intens, | ||
... | ||
) | ||
object@peaks_debug_info <- peak_list_and_debug_info$debug_info | ||
peaks(object) <- peak_list_and_debug_info$peak_list | ||
object | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#' @describeIn GCIMSSpectrum-class Get the peak list | ||
#' @importMethodsFrom ProtGenerics peaks | ||
#' @return A data frame with the peaks in the spectrum | ||
#' @export | ||
setMethod( | ||
"peaks", | ||
"GCIMSSpectrum", | ||
function(object) { | ||
if (is.null(object@peaks)) { | ||
stop("Please run findPeaks() on the spectrum first") | ||
} | ||
if(nrow(object@peaks)==0){ | ||
p <- NULL | ||
}else{ | ||
p <- tibble::as_tibble(cbind(SampleID = object@description, object@peaks)) | ||
} | ||
return(p) | ||
} | ||
) | ||
|
||
#' @describeIn GCIMSSpectrum-class Set the peak list | ||
#' @param value A data frame with the peak list | ||
#' @return The GCIMSSpectrum object | ||
#' @importMethodsFrom ProtGenerics "peaks<-" | ||
#' @export | ||
setMethod( | ||
"peaks<-", | ||
"GCIMSSpectrum", | ||
function(object, value) { | ||
value <- methods::as(value, "DataFrame") | ||
# We don't want this column: | ||
value$SampleID <- NULL | ||
object@peaks <- value | ||
object | ||
} | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.