Get the extracted ion chromatogram

getChromatogram(
  object,
  dt_range = NULL,
  rt_range = NULL,
  dt_idx = NULL,
  rt_idx = NULL,
  aggregate = colSums
)

Arguments

object

A GCIMSSample object

dt_range

The minimum and maximum drift times to extract (length 2 vector)

rt_range

The minimum and maximum retention times to extract (length 2 vector)

dt_idx

A numeric vector with the drift time indices to extract (or a logical vector of the length of drift time)

rt_idx

A numeric vector with the retention time indices to extract (or a logical vector of the length of retention time)

aggregate

Function that takes the subsetted intensity matrix according to the region of interest and aggregates the drift times, returning a vector representing the chromatogram intensity. colSums by default.

Value

A GCIMSChromatogram object

Examples

x <- GCIMSSample(
  drift_time = 1:2,
  retention_time = 1:3,
  data = matrix(1:6, nrow = 2, ncol = 3)
)
getChromatogram(x)
#> An object of class "GCIMSChromatogram"
#> Slot "retention_time":
#> [1] 1 2 3
#> 
#> Slot "intensity":
#>  1  2  3 
#>  3  7 11 
#> 
#> Slot "baseline":
#> NULL
#> 
#> Slot "drift_time_idx":
#> [1] 1 2
#> 
#> Slot "drift_time_ms":
#> [1] 1 2
#> 
#> Slot "description":
#> character(0)
#> 
#> Slot "peaks":
#> NULL
#> 
#> Slot "peaks_debug_info":
#> NULL
#> 
# Take the maximum intensity in the region for each retention time:
sp1 <- getChromatogram(x, aggregate = function(x) apply(x, 2, max))