Skip to content

Commit

Permalink
Added assay.names as another slot in the ISAtab-class
Browse files Browse the repository at this point in the history
  • Loading branch information
agbeltran committed Mar 7, 2013
1 parent 591d152 commit e441735
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions R/ISAtab-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 8 additions & 1 deletion R/ISAtab-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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 {}
Expand Down Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions R/Risa-ms.R
Original file line number Diff line number Diff line change
@@ -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, ...){
Expand Down Expand Up @@ -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){
Expand All @@ -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="\""))
Expand Down
3 changes: 2 additions & 1 deletion R/Risa.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions man/ISAtab-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit e441735

Please sign in to comment.