Skip to content

Commit

Permalink
minor changes, ptw, plot
Browse files Browse the repository at this point in the history
  • Loading branch information
lalo-caballero committed Apr 16, 2024
1 parent 92771c5 commit e6ecc61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions R/align-GCIMSSample.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ methods::setMethod(
"alignRt_ptw", "GCIMSSample",
function(x, ric_ref, ric_ref_rt) {
optimize_polynomial_order <- function(ric_sample, ric_ref) {
correction_type_options <- seq.int(0, 10)
poly_orders <- seq.int(1, 10)
correction_type_options <- seq.int(0, 2)
poly_orders <- seq.int(1, 2)
xi <- seq_len(length(ric_sample))
corr <- numeric(length(poly_orders) + 1L)
corr[1] <- stats::cor(ric_ref, ric_sample, use = "complete.obs")
Expand Down
7 changes: 6 additions & 1 deletion R/peaks-GCIMSSpectrum.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ setMethod(
if (is.null(object@peaks)) {
stop("Please run findPeaks() on the spectrum first")
}
tibble::as_tibble(cbind(SampleID = object@description, object@peaks))
if(nrow(object@peaks)==0){
p <- NULL
}else{
p <- tibble::as_tibble(cbind(SampleID = object@description, object@peaks))
}
return(p)
}
)

Expand Down
4 changes: 2 additions & 2 deletions R/plot-GCIMSSample.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mat_to_gplot <- function(intmat, dt_min = NULL, dt_max = NULL, rt_min = NULL, rt
}
intmat_trans <- trans$transform(intmat)
colormap <- farver::encode_native(
viridisLite::viridis(256L, direction = -1, option = "A")
viridisLite::viridis(256L, direction = -1, option = "G")
)
nr <- mat_to_nativeRaster(intmat_trans, colormap)

Expand All @@ -101,7 +101,7 @@ mat_to_gplot <- function(intmat, dt_min = NULL, dt_max = NULL, rt_min = NULL, rt
) +
ggplot2::scale_fill_viridis_c( # This has to match with the COLORMAP above
direction = -1,
option = "A",
option = "G",
limits = minmax,
na.value = "#00000000",
trans = trans
Expand Down

0 comments on commit e6ecc61

Please sign in to comment.