diff --git a/R/ISAtab-class.R b/R/ISAtab-class.R index cadbb3b..aaf8d02 100644 --- a/R/ISAtab-class.R +++ b/R/ISAtab-class.R @@ -15,6 +15,7 @@ ISAtab <- setClass("ISAtab", assay.filenames.per.study="list", assay.files="list", assay.files.per.study="list", + assay.names="list", assay.technology.types="character", assay.measurement.types="character", data.filenames="list", diff --git a/R/ISAtab-methods.R b/R/ISAtab-methods.R index 0b9abe7..c5ef9b9 100644 --- a/R/ISAtab-methods.R +++ b/R/ISAtab-methods.R @@ -15,6 +15,7 @@ setMethod(f="[",signature="ISAtab", definition=function(x, i,j, drop) { if (i=="assay.filenames") { return(x@assay.filenames) } else {} if (i=="assay.filenames.per.study") { return(x@assay.filenames.per.study) } else {} if (i=="assay.files") { return(x@assay.files) } else {} + if (i=="assay.names") { return(x@assay.names) } else {} if (i=="assay.files.per.study") { return(x@assay.files.per.study) } else {} if (i=="assay.technology.types") { return(x@assay.technology.types) } else {} if (i=="assay.measurement.types") { return(x@assay.measurement.types) } else {} @@ -48,6 +49,7 @@ setReplaceMethod(f="[",signature="ISAtab", definition=function(x,i,j,value){ if (i=="assay.filenames") { x@assay.filenames<-value } else {} if (i=="assay.filenames.per.study") { x@assay.filenames.per.study<-value } else {} if (i=="assay.files") { x@assay.files<-value } else {} + if (i=="assay.names") { x@assay.names<-value } else {} if (i=="assay.files.per.study") { x@assay.files.per.study<-value} else {} if (i=="assay.technology.types") { x@assay.technology.types<-value} else {} if (i=="assay.measurement.types") { x@assay.measurement.types<-value } else {} @@ -144,7 +146,12 @@ setMethod( function(i) read.table(file.path(path,afilenames.per.study[[j]][[i]]), sep="\t", header=TRUE, stringsAsFactors=FALSE, check.names=FALSE)))) names(afiles.per.study) <- sidentifiers - .Object["assay.files.per.study"] < afiles.per.study + .Object["assay.files.per.study"] <- afiles.per.study + + + ###assay.names + assay.names <- lapply( afiles, function(i) i[ grep(isatab.syntax$assay.name, colnames(i) ) ]) + .Object["assay.names"] <- assay.names ## Assay technology types #data frame with types diff --git a/R/Risa-ms.R b/R/Risa-ms.R index c25ef48..dcf82bc 100644 --- a/R/Risa-ms.R +++ b/R/Risa-ms.R @@ -1,6 +1,5 @@ ### Methods to deal with assays whose technology type is mass spectrometry - ### specific function to deal with assays whose technology type is mass spectrometry using the xcms package ### it returns an xcmsSet processAssayXcmsSet.1factor = function(isa, assay.filename, ...){ @@ -47,6 +46,12 @@ processAssayXcmsSet.1factor = function(isa, assay.filename, ...){ ### it returns an xcmsSet ### TODO - change implementation to include all factors processAssayXcmsSet = function(isa, assay.filename, ...){ + + + phenodata.data.frame <- as.data.frame(isa["factors"]) + + + for(i in seq_len(length(isa["assay.filenames"]))){ if (isa["assay.filenames"][[i]]==assay.filename){ @@ -55,7 +60,7 @@ processAssayXcmsSet = function(isa, assay.filename, ...){ { #mass spectrometry files msfiles = isa["data.filenames"][[i]][[ isatab.syntax$raw.spectral.data.file ]] - + pd = try(read.AnnotatedDataFrame(file.path(isa["path"], isa["assay.filenames"][i]), row.names = NULL, blank.lines.skip = TRUE, fill = TRUE, varMetadata.char = "$", quote="\"")) diff --git a/R/Risa.R b/R/Risa.R index b5d023f..3b1b51e 100755 --- a/R/Risa.R +++ b/R/Risa.R @@ -16,7 +16,8 @@ isatab.syntax <- list( free.induction.decay.data.file="Free Induction Decay Data File", array.data.file="Array Data File", raw.spectral.data.file="Raw Spectral Data File", - factor.name="Factor Name" + factor.name="Factor Name", + assay.name="Assay Name" ) technology.types <- list( diff --git a/man/ISAtab-class.Rd b/man/ISAtab-class.Rd index e25fb30..5b71970 100644 --- a/man/ISAtab-class.Rd +++ b/man/ISAtab-class.Rd @@ -23,6 +23,7 @@ Objects can be created by calls of the form \code{new("ISAtab", ...)}. \item{\code{assay.filenames.per.study}:}{Object of class \code{"list"}, the names of the assay files according to the study they belong to } \item{\code{assay.files}:}{Object of class \code{"list"}, a list of data frames with the contents of the assay files } \item{\code{assay.files.per.study}:}{Object of class \code{"list"}, a list of data frames with the contents of the assay files divided per study they belong to } + \item{\code{assay.names}:}{Object of class \code{"list"}, which is a list of data frames, containing, per each assay file, the column of the assay file corresponding to the "Assay Name" } \item{\code{assay.technology.types}:}{Object of class \code{"character"}, a list with the technology types corresponding to each assay } \item{\code{assay.measurement.types}:}{Object of class \code{"character"}, a list with the names of the data files } \item{\code{data.filenames}:}{Object of class \code{"list"}, a list with the names of the samples }