Skip to content

PPC package-ppc.read.raw.nobatch (PR#8316)

1 message · martin.o'gorman@nonlinear.com

#
Full_Name: Martin O'Gorman
Version: 
OS: 
Submission from: (NULL) (84.176.63.149)


I have been looking at the PPC package and have a question. As the input data is
comma separated, shouldn?t the command to read in the raw (no batch) mass spec
data indicate that sep=?,?  (marked below) ? Otherwise, the data read in is the
pair of values (m/z,intensity). It is not obvious why that should be. While
playing around with the data, I noticed that xtr (the intensity matrix) is a
full matrix of value NA as a result of omitting the ?,?. I apologize in advance
if I have missed something obvious. However, the batch read function does use
the sep=?,?. This possible bug doesn't doesn't crash the script and so is
difficult to spot.

 

Many thanks 

Martin

 

 

 

 

 

 

ppc.read.raw.nobatch <- function(directory, mz = NULL) {

  datafiles.list <- ppc.xl.get.names.of.files(directory)

  

  ##

  ## First determine the dimensions of the data matrix

  ##

 

  if (is.null(mz)) {

    pat1 <- read.table(datafiles.list[1])   ?-----  here

    mz <- pat1[,1]

  }

  

  xtr <- matrix(NA, nrow=length(mz), ncol=length(datafiles.list))

 

  ##

  ## Now read in all the data

  ##

  for (j in 1:length(datafiles.list)) {

    if (ppc.options$debug) print(paste("Reading file", datafiles.list[j]))

    

    temp <-  read.table(datafiles.list[j], sep = ",")

    

    xtr[, j] <- approx(temp[, 1], temp[, 2], xout = mz)$y

  }

  

  return(list(xtr = xtr,

              mz = mz,

              filenames=datafiles.list))

}