R/profplot.r

#' @export
setGeneric('cgProfPlot', function(object){
  message('No plot method defined!')
  object})

setMethod('cgProfPlot', 'xcmsRaw', function(object){
  cgprof <- getcgprof(object)
  qprofplot(cgprof, object@filepath)
  
})

getcgprof <- function(object){
  df <- getProfile(object)
  col <- range(log(df$intensity), na.rm = TRUE)
  col <- log(df$intensity)
  col <- col/max(col)
  cgprof <- qdata(df, size = .1, color = rgb(1 - col, 1 - col, 0))
  return(cgprof)
}

qprofplot <- function(qd, filepath){
  return(qscatter(x = time,
                  y = mz,
                  data = qd,
                  main = paste('genProfile: ', filepath),
                  xlab = "Seconds",
                  ylab = "m/z",
                  xlim=range(qd$time), 
                  ylim=range(qd$mz), 
                  alpha = 0.5))
}
mariev/chromatoplotsgui documentation built on May 21, 2019, 11:46 a.m.