hansenlab / minfi

Devel repository for minfi
58 stars 68 forks source link

Problem in constructing MethylSet object #121

Closed gerrywong closed 6 years ago

gerrywong commented 6 years ago

Hi, I want to construct a MethylSet manually, but I'm confused that the MethylSet from RGChannelSet looks like this

swanmset MethylSet (storageMode: lockedEnvironment) assayData: 485512 features, 485 samples element names: Meth, Unmeth An object of class 'AnnotatedDataFrame': none Annotation array: IlluminaHumanMethylation450k annotation: ilmn12.hg19 Preprocessing Method: SWAN (based on a MethylSet preprocesses as 'Raw (no normalization or bg correction)' minfi version: 1.18.6 Manifest version: 0.4.0

but the one created manually looks like:

methset<-MethylSet(Meth=Methmat,Unmeth=Umethmat,annotation =annotation) methset class: MethylSet dim: 485512 6 metadata(0): assays(2): Meth Unmeth rownames(485512): cg00000029 cg00000108 ... ch.X.97737721F ch.X.98007042R rowData names(0): colnames(6): F29_neg F32_neg ... F105_pos F125_pos colData names(0): Annotation array: IlluminaHumanMethylation450k annotation: ilmn12.hg19 Preprocessing Method: NA minfi version: NA Manifest version: NA

When I choose to "new" a MethylSet, it has an error:

methset<-new("MethylSet",Meth=Methmat,Unmeth=Umethmat,annotation=annotation) Error in initialize(value, ...) : invalid names for slots of class “MethylSet”: Meth, Unmeth

The "Methmat" and "Umethmat" are both matrices with colnames and rownames.

What's the right way to construct a MethylSet object? I noticed that RGChannelSet inherited from ExpressionSet, so the MethylSet from RGChannelSet has the slot "assayData", while the MethylSet of myself dose not have the slot "assayData". How to do to make the MethylSet contain "assayData"?

session info:

R version 3.4.1 (2017-06-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.3 LTS

Matrix products: default BLAS: /usr/lib/openblas-base/libblas.so.3 LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets [8] methods base

other attached packages: [1] minfi_1.22.1 bumphunter_1.16.0
[3] locfit_1.5-9.1 iterators_1.0.8
[5] foreach_1.4.3 Biostrings_2.44.2
[7] XVector_0.16.0 SummarizedExperiment_1.6.4 [9] DelayedArray_0.2.7 matrixStats_0.52.2
[11] Biobase_2.36.2 GenomicRanges_1.28.5
[13] GenomeInfoDb_1.12.2 IRanges_2.10.3
[15] S4Vectors_0.14.4 BiocGenerics_0.22.0

loaded via a namespace (and not attached): [1] mclust_5.3 base64_2.0 Rcpp_0.12.12
[4] lattice_0.20-35 Rsamtools_1.28.0 digest_0.6.12
[7] R6_2.2.2 plyr_1.8.4 RSQLite_2.0
[10] httr_1.3.1 zlibbioc_1.22.0 rlang_0.1.2
[13] GenomicFeatures_1.28.5 data.table_1.10.4 annotate_1.54.0
[16] blob_1.1.0 Matrix_1.2-11 preprocessCore_1.38.1
[19] splines_3.4.1 BiocParallel_1.10.1 stringr_1.2.0
[22] RCurl_1.95-4.8 bit_1.1-12 biomaRt_2.32.1
[25] compiler_3.4.1 rtracklayer_1.36.4 multtest_2.32.0
[28] pkgmaker_0.22 openssl_0.9.7 GEOquery_2.42.0
[31] tibble_1.3.4 GenomeInfoDbData_0.99.0 quadprog_1.5-5
[34] codetools_0.2-15 XML_3.98-1.9 reshape_0.8.7
[37] GenomicAlignments_1.12.2 MASS_7.3-47 bitops_1.0-6
[40] grid_3.4.1 nlme_3.1-131 xtable_1.8-2
[43] registry_0.3 DBI_0.7 magrittr_1.5
[46] stringi_1.1.5 genefilter_1.58.1 doRNG_1.6.6
[49] limma_3.32.6 nor1mix_1.2-3 RColorBrewer_1.1-2
[52] siggenes_1.50.0 tools_3.4.1 illuminaio_0.18.0
[55] bit64_0.9-7 rngtools_1.2.4 survival_2.41-3
[58] AnnotationDbi_1.38.2 beanplot_1.2 memoise_1.1.0

kasperdanielhansen commented 6 years ago

You are conflating two different versions of minfi.

It used to be the case that RGChannelSet / MethylSet / RatioSet al inherited from eSet. But now they inherit from SummarizedExperiment. Old objects can be updated using updateObject() and can be checked for validity using validObject()

You should create new MethylSet's by using the constructor function MethylSet()

Best, Kasper

On Sun, Oct 1, 2017 at 4:03 AM, gerrywong notifications@github.com wrote:

Hi, I want to construct a MethylSet manually, but I'm confused that the MethylSet from RGChannelSet looks like this

swanmset MethylSet (storageMode: lockedEnvironment) assayData: 485512 features, 485 samples element names: Meth, Unmeth An object of class 'AnnotatedDataFrame': none Annotation array: IlluminaHumanMethylation450k annotation: ilmn12.hg19 Preprocessing Method: SWAN (based on a MethylSet preprocesses as 'Raw (no normalization or bg correction)' minfi version: 1.18.6 Manifest version: 0.4.0

but the one created manually looks like:

methset<-MethylSet(Meth=Methmat,Unmeth=Umethmat,annotation =annotation) methset class: MethylSet dim: 485512 6 metadata(0): assays(2): Meth Unmeth rownames(485512): cg00000029 cg00000108 ... ch.X.97737721F ch.X.98007042R rowData names(0): colnames(6): F29_neg F32_neg ... F105_pos F125_pos colData names(0): Annotation array: IlluminaHumanMethylation450k annotation: ilmn12.hg19 Preprocessing Method: NA minfi version: NA Manifest version: NA

When I choose to "new" a MethylSet, it has an error:

methset<-new("MethylSet",Meth=Methmat,Unmeth=Umethmat, annotation=annotation) Error in initialize(value, ...) : invalid names for slots of class “MethylSet”: Meth, Unmeth

The "Methmat" and "Umethmat" are both matrices with colnames and rownames.

What's the right way to construct a MethylSet object? I noticed that RGChannelSet inherited from ExpressionSet, so the MethylSet from RGChannelSet has the slot "assayData", while the MethylSet of myself dose not have the slot "assayData". How to do to make the MethylSet contain "assayData"?

session info:

R version 3.4.1 (2017-06-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.3 LTS

Matrix products: default BLAS: /usr/lib/openblas-base/libblas.so.3 LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats4 parallel stats graphics grDevices utils datasets [8] methods base

other attached packages: [1] minfi_1.22.1 bumphunter_1.16.0 [3] locfit_1.5-9.1 iterators_1.0.8 [5] foreach_1.4.3 Biostrings_2.44.2 [7] XVector_0.16.0 SummarizedExperiment_1.6.4 [9] DelayedArray_0.2.7 matrixStats_0.52.2 [11] Biobase_2.36.2 GenomicRanges_1.28.5 [13] GenomeInfoDb_1.12.2 IRanges_2.10.3 [15] S4Vectors_0.14.4 BiocGenerics_0.22.0

loaded via a namespace (and not attached): [1] mclust_5.3 base64_2.0 Rcpp_0.12.12 [4] lattice_0.20-35 Rsamtools_1.28.0 digest_0.6.12 [7] R6_2.2.2 plyr_1.8.4 RSQLite_2.0 [10] httr_1.3.1 zlibbioc_1.22.0 rlang_0.1.2 [13] GenomicFeatures_1.28.5 data.table_1.10.4 annotate_1.54.0 [16] blob_1.1.0 Matrix_1.2-11 preprocessCore_1.38.1 [19] splines_3.4.1 BiocParallel_1.10.1 stringr_1.2.0 [22] RCurl_1.95-4.8 bit_1.1-12 biomaRt_2.32.1 [25] compiler_3.4.1 rtracklayer_1.36.4 multtest_2.32.0 [28] pkgmaker_0.22 openssl_0.9.7 GEOquery_2.42.0 [31] tibble_1.3.4 GenomeInfoDbData_0.99.0 quadprog_1.5-5 [34] codetools_0.2-15 XML_3.98-1.9 reshape_0.8.7 [37] GenomicAlignments_1.12.2 MASS_7.3-47 bitops_1.0-6 [40] grid_3.4.1 nlme_3.1-131 xtable_1.8-2 [43] registry_0.3 DBI_0.7 magrittr_1.5 [46] stringi_1.1.5 genefilter_1.58.1 doRNG_1.6.6 [49] limma_3.32.6 nor1mix_1.2-3 RColorBrewer_1.1-2 [52] siggenes_1.50.0 tools_3.4.1 illuminaio_0.18.0 [55] bit64_0.9-7 rngtools_1.2.4 survival_2.41-3 [58] AnnotationDbi_1.38.2 beanplot_1.2 memoise_1.1.0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kasperdanielhansen/minfi/issues/121, or mute the thread https://github.com/notifications/unsubscribe-auth/AEuhn650MEiEeUyf6tne8jfWGZJKsKrUks5sn0dSgaJpZM4Pp0Va .

gerrywong commented 6 years ago

So, although there are some differences between the objects inheriting from eSet and ones inheriting from SummarizedExperiment, it is just the constructor has changed and they will do not impact on the result of further steps. Am I right?

kasperdanielhansen commented 6 years ago

You're right, but you should run old objects through updateObject() first. Basically you should not have those lying around.

On Mon, Oct 2, 2017 at 12:18 AM, gerrywong notifications@github.com wrote:

So, although there are some differences between the objects inheriting from eSet and ones inheriting from SummarizedExperiment, it is just the constructor has changed and they will do not impact on the result of further steps. Am I right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kasperdanielhansen/minfi/issues/121#issuecomment-333437635, or mute the thread https://github.com/notifications/unsubscribe-auth/AEuhnzP4bd9FyKQKBg-n1ftuVHM8iRT8ks5soGQNgaJpZM4Pp0Va .