inst/examples/qplotRaw.r

setGeneric('qplotRaw', function(object,...) standardGeneric('qplotRaw'))

setMethod('qplotRaw', 'xcmsRaw', function(object, 
                                          mzrange = numeric(),
                                          rtrange = numeric(),
                                          scanrange = numeric(),
                                          log = FALSE,
                                          title = 'Raw Data') {
  
  raw <- .qplotRawCalcs(object, mzrange, rtrange, scanrange, log, title)$raw
  if(nrow(raw) > 0){
      newdata <- qdata(cbind(time = raw[,"time"], mz = raw[,"mz"]), size = 0.01)
      print(qscatter(x = time, y = mz, newdata, main = title,
          xlab="Seconds", ylab="m/z", #col=col,
          xlim=range(raw[,"time"]), ylim=range(raw[,"mz"])))
  } else {
    if (length(rtrange) >= 2) {
    } else if (length(scanrange) < 2){
      scanrange <- c(1, length(object@scantime))} else{ 
        scanrange <- range(scanrange)
      print(qscatter(x = time, y = mz, c(x = NA, y = NA), main = title, xlab="Seconds", ylab="m/z",
         xlim=c(object@scantime[scanrange[1]],object@scantime[scanrange[2]]), ylim=mzrange))
    }
  }
  
  invisible(raw)
})


.qplotRawCalcs <- function(object, mzrange, rtrange, scanrange, log, title){
  raw <- rawMat(object, mzrange, rtrange, scanrange, log)
  return(list(raw = raw))
}

.getqplotRawDisplay <- function(...){
  
}
  
mariev/chromatoplotsgui documentation built on May 21, 2019, 11:46 a.m.