hansenlab / minfi

Devel repository for minfi
58 stars 68 forks source link

Can't use preprocessRaw with rgSet #112

Closed JieYang031 closed 7 years ago

JieYang031 commented 7 years ago

I tried to feed rgSet with preprocessRaw from preprocess.R file but it gave me an error. Then I looked into the function and tried to run the preprocessRaw function step by step. I found the error is related to the Methylset function.

out <- MethylSet(Meth = M, Unmeth = U, colData = colData(rgSet),
                     annotation = annotation(rgSet), metadata = metadata(rgSet))

The above error is essentially related to the colData. I also found colData is a method from the SummarizedExperiment package and it is not applicable to the class RGChannelSetExtended.

> colData(rgSet)
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘colData’ for signature ‘"RGChannelSetExtended"’

Then I looked for the definition of MethylSet in the mset.R file

MethylSet <- function(Meth = new("matrix"), Unmeth = new("matrix"),
                      annotation = "", preprocessMethod = "", ...) {
    ## Check rownames, colnames
    assays <- SimpleList(Meth = Meth, Unmeth = Unmeth)
    new("MethylSet",
        SummarizedExperiment(assays = assays, ...),
        annotation = annotation,
        preprocessMethod = preprocessMethod
        )
}

The function did not have the option of colData and metadata. So I go back to check the origin of colData. It comes from the R package named summarizedExperiment. All I can think of is that the class of rgSet is not suitable for colData function. But how can we change the class of rgSet and make it usable in the colData function?

kasperdanielhansen commented 7 years ago

You're using an object created with an old (well, not that old) version of minfi together with new code. The class structure has changed. You can check whether or not you have a valid object with the loaded class definition by

validObject(rgSet)

I predict you will see a message. To update your object to the new class definition, do

reset = updateObject(rgSet)

(this only needs to be done once, you should then re-save rgSet.

Closing this issue as I assume this addresses it.