ChAMP error in EPIC data import
4
0
Entering edit mode
5.9 years ago
mac ▴ 70

Hi,

I am trying to use ChAMP for the first time but I am experiencing a problem with importing data. I have a some EPIC idat files and a samplesheet.csv.

I run

data.dir <- file.path("D:/data/idat/")


The output I get is the following

[===========================]
-----------------------------
[read.metharray.sheet] Found the following CSV files:
[1] "D:/data/idat/Samplesheet.csv"
The fraction of failed positions per sample

(You may need to delete samples with high proportion of failed probes
):
Failed CpG Fraction.
NEU_P006_1         0.0009835634
NEU_P003_4         0.0013552857
NEU_P002_3         0.0007977022
NEU_P007_1         0.0007723051
NEU_P004_4         0.0007896213
NEU_P003_2         0.0014026168
NEU_P007_2         0.1024198892
NEU_P006_3         0.0012144468
NEU_P002_1         0.0008115553
NEU_P002_4         0.0008404157
NEU_P003_3         0.0008727394
NEU_P006_2         0.0009212249
NEU_P004_2         0.0008669673
NEU_P007_3         0.0007388270
NEU_P004_1         0.0010031885
NEU_P003_1         0.0015122865
Filtering probes with a detection p-value above 0.01 in one or more samples has removed 89843 probes from the analysis. If a large number of probes have been removed, ChAMP suggests you to identify potentially bad samples.
<< Filter DetP Done. >>
Error in (function (classes, fdef, mtable)  :   unable to find an inherited method for function 'assayData' for signature '"RGChannelSetExtended"'


I cannot get around this error message and therefore I cannot proceed with the analysis. The error happens even if I use the parameters

methValue = "M",detSamplecut = 0.11


To get the M values and get around the rejected sample.

The same dataset can be imported fine with minfi alone or with RnBeads.

Any help would be greatly appreciated.

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] splines   stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base
other attached packages:
[1] dendextend_1.5.2                           qvalue_2.8.0                               plyr_1.8.4                                 ChAMP_2.8.0
[5] IlluminaHumanMethylationEPICmanifest_0.3.0 Illumina450ProbeVariants.db_1.12.0         DMRcate_1.12.0                             DMRcatedata_1.12.0
[9] DSS_2.16.0                                 bsseq_1.12.0                               FEM_3.4.0                                  graph_1.54.0
[13] org.Hs.eg.db_3.4.1                         impute_1.50.0                              igraph_1.0.1                               corrplot_0.77
[17] marray_1.54.0                              limma_3.32.2                               Matrix_1.2-10                              AnnotationDbi_1.38.0
[21] ChAMPdata_2.8.0                            minfi_1.22.1                               bumphunter_1.16.0                          locfit_1.5-9.1
[25] iterators_1.0.8                            foreach_1.4.3                              Biostrings_2.44.0                          XVector_0.16.0
[29] SummarizedExperiment_1.6.1                 DelayedArray_0.2.1                         matrixStats_0.52.2                         Biobase_2.36.2
[33] GenomicRanges_1.28.1                       GenomeInfoDb_1.12.0                        IRanges_2.10.0                             S4Vectors_0.14.0
[37] BiocGenerics_0.22.0                        BiocInstaller_1.26.0
loaded via a namespace (and not attached):
[1] R.utils_2.5.0                                       IlluminaHumanMethylationEPICanno.ilm10b2.hg19_0.6.0 RSQLite_1.1-2
[4] htmlwidgets_0.8                                     trimcluster_0.1-2                                   grid_3.4.0
[7] BiocParallel_1.10.1                                 munsell_0.4.3                                       codetools_0.2-15
[10] preprocessCore_1.38.0                               statmod_1.4.29                                      colorspace_1.3-2
[13] fastICA_1.2-0                                       knitr_1.15.1                                        robustbase_0.92-7
[19] biovizBase_1.24.0                                   diptest_0.75-7                                      R6_2.2.0
[22] doParallel_1.0.10                                   illuminaio_0.18.0                                   clue_0.3-53
[25] AnnotationFilter_1.0.0                              flexmix_2.3-14                                      bitops_1.0-6
[28] reshape_0.8.6                                       assertthat_0.2.0                                    IlluminaHumanMethylation450kanno.ilmn12.hg19_0.6.0
[31] scales_0.4.1                                        nnet_7.3-12                                         gtable_0.2.0
[34] methylumi_2.22.0                                    sva_3.24.0                                          ensembldb_2.0.1
[37] genefilter_1.58.0                                   rtracklayer_1.36.0                                  lazyeval_0.2.0
[40] acepack_1.4.1                                       GEOquery_2.42.0                                     dichromat_2.0-0
[43] checkmate_1.8.2                                     yaml_2.1.14                                         reshape2_1.4.2
[46] GenomicFeatures_1.28.0                              backports_1.0.5                                     httpuv_1.3.3
[49] Hmisc_4.0-3                                         tools_3.4.0                                         nor1mix_1.2-2
[52] ggplot2_2.2.1                                       RColorBrewer_1.1-2                                  DNAcopy_1.50.0
[55] siggenes_1.50.0                                     Rcpp_0.12.10                                        base64enc_0.1-3
[58] zlibbioc_1.22.0                                     purrr_0.2.2                                         RCurl_1.95-4.8
[61] BiasedUrn_1.07                                      rpart_4.1-11                                        openssl_0.9.6
[64] viridis_0.4.0                                       cluster_2.0.6                                       magrittr_1.5
[67] data.table_1.10.4                                   goseq_1.28.0                                        mvtnorm_1.0-6
[70] wateRmelon_1.20.0                                   whisker_0.3-2                                       ProtGenerics_1.8.0
[73] missMethyl_1.10.0                                   RPMM_1.25                                           mime_0.5
[76] xtable_1.8-2                                        XML_3.98-1.7                                        mclust_5.2.3
[79] gridExtra_2.2.1                                     compiler_3.4.0                                      biomaRt_2.32.0
[82] tibble_1.3.0                                        R.oo_1.21.0                                         htmltools_0.3.6
[85] mgcv_1.8-17                                         Formula_1.2-1                                       tidyr_0.6.2
[88] DBI_0.6-1                                           geneLenDataBase_1.12.0                              MASS_7.3-47
[94] R.methodsS3_1.7.1                                   Gviz_1.20.0                                         RefFreeEWAS_2.1
[97] GenomicAlignments_1.12.0                            registry_0.3                                        IlluminaHumanMethylation450kmanifest_0.4.0
[100] foreign_0.8-68                                      plotly_4.6.0                                        annotate_1.54.0
[103] rngtools_1.2.4                                      pkgmaker_0.22                                       multtest_2.32.0
[106] beanplot_1.2                                        ruv_0.9.6                                           doRNG_1.6.6
[109] stringr_1.2.0                                       VariantAnnotation_1.22.0                            digest_0.6.12
[112] base64_2.0                                          htmlTable_1.9                                       kernlab_0.9-25
[115] shiny_1.0.3                                         Rsamtools_1.28.0                                    gtools_3.5.0
[118] modeltools_0.2-21                                   nlme_3.1-131                                        jsonlite_1.4
[121] viridisLite_0.2.0                                   BSgenome_1.44.0                                     lattice_0.20-35
[124] DEoptimR_1.0-8                                      httr_1.2.1                                          survival_2.41-3
[127] GO.db_3.4.1                                         interactiveDisplayBase_1.14.0                       shinythemes_1.1.1
[130] prabclus_2.2-6                                      class_7.3-14                                        stringi_1.1.5
[133] AnnotationHub_2.8.1                                 latticeExtra_0.6-28                                 memoise_1.1.0
[136] dplyr_0.5.0

methylation ChAMP EPIC idat R • 6.9k views
1
Entering edit mode

Your tags have everything except R :)

0
Entering edit mode

Very good point, I have rectified it. It's my first post! :)

1
Entering edit mode

Kudos! A very well written and well organized post.

I have a feeling that some of the dependencies of CHAMP is not fulfilled, most probably because they are old (or even not installed). Could you test your CHAMP installation on test data (see section 4 and 5.4)

https://bioconductor.org/packages/release/bioc/vignettes/ChAMP/inst/doc/ChAMP.html#section-installation

0
Entering edit mode

I did run the test data from the ChAMPdata package and I get the exact same error message:

[===========================]
-----------------------------

[read.metharray.sheet] Found the following CSV files:
[1] "C:/Program Files/R/R-3.4.0/library/ChAMPdata/extdata/lung_test_set.csv"

The fraction of failed positions per sample

(You may need to delete samples with high proportion of failed probes
):
Failed CpG Fraction.
C1         0.0013429122
C2         0.0022162171
C3         0.0003563249
C4         0.0002842360
T1         0.0003831007
T2         0.0011946152
T3         0.0014953286
T4         0.0015447610
Filtering probes with a detection p-value above 0.01 in one or more samples has removed 2728 probes from the analysis. If a large number of probes have been removed, ChAMP suggests you to identify potentially bad samples.
<< Filter DetP Done. >>

Error in (function (classes, fdef, mtable)  :
unable to find an inherited method for function 'assayData' for signature '"RGChannelSetExtended"'

1
Entering edit mode

I am quite sure that it is a package related problem. But hard to point out which package with such a generic message. First, Try to re-install lumi and mehtylumi pacakges (in that order using biocondictor). If that fails to solve the problem, you may try to upgrade all the related pkgs using this:

## try http:// if https:// URLs are not supported
source("https://bioconductor.org/biocLite.R")
biocLite()

0
Entering edit mode

When I load ChAMP I get the following warnings if this is of any help:

> warnings()
Warning messages:

1
Entering edit mode

Another important point: Start a fresh session of R and see if the error repeats. The warn messages are because you have already methods with the same name from other packages, which are getting masked when you load CHAMP. This might create some conflicts. So, before doing anything, just try to run CHAMP in a freshly opened R. And do all the further test in the fresh session to avoid problems due to conflict with other packages.

0
Entering edit mode

I did reinstall lumi and methylumi as suggested and also started a new R session. The problem persists. Also, I have the latest versions of all packages and biocLite() does not update anything.

Interestingly, I installed ChAMP to another machine running Mac instead of Windows and I got the same error message.

Thank you very much in any case :)

1
Entering edit mode

It's really puzzling me now!!! Can you repost the error and sessionInfo on MAC?

0
Entering edit mode

Thank you very much for your persistence! :)

This is what I get on a Mac which is the same error I get on Windows. All packages (and R itself) are up-to-date:

> myload <- champ.load(directory = data.dir, arraytype = "EPIC")
[===========================]
-----------------------------
[read.metharray.sheet] Found the following CSV files:
[1] "idat//Samplesheet.csv"

The fraction of failed positions per sample

(You may need to delete samples with high proportion of failed probes
):
Failed CpG Fraction.
NEU_P006_1         0.0009835634
NEU_P003_4         0.0013552857
NEU_P002_3         0.0007977022
NEU_P007_1         0.0007723051
NEU_P004_4         0.0007896213
NEU_P003_2         0.0014026168
NEU_P007_2         0.1024198892
NEU_P006_3         0.0012144468
NEU_P002_1         0.0008115553
NEU_P002_4         0.0008404157
NEU_P003_3         0.0008727394
NEU_P006_2         0.0009212249
NEU_P004_2         0.0008669673
NEU_P007_3         0.0007388270
NEU_P004_1         0.0010031885
NEU_P003_1         0.0015122865
The detSamplecut parameter is : 0.1
Samples : NEU_P007_2 will be deleted.
There are 15 samples left for analysis.

Filtering probes with a detection p-value above 0.01 in one or more samples has removed 3476 probes from the analysis. If a large number of probes have been removed, ChAMP suggests you to identify potentially bad samples.
<< Filter DetP Done. >>

Error in (function (classes, fdef, mtable)  :
unable to find an inherited method for function 'assayData' for signature '"RGChannelSetExtended"'


The sessioninfo() result is huge and exceeds the 5000 character limit for the forum though so you can find it here https://pastebin.com/CnZByXjc

1
Entering edit mode

Did you check if it gives the same error with Champ test data?

0
Entering edit mode

Yes, I get the same error on Mac when using the ChAMP test data.

I have uploaded the Mac sessioninfo at https://pastebin.com/CnZByXjc

0
Entering edit mode

Interesting! Did you really run in a fresh R session? I see RnBeads_1.8.0 attached (16th entry), but is not used by CHAMP directly. Please try to run in a sandbox situation, else it will be really difficult to dissect the error.

PS: I installed and run on test data on my comp, and it runs fine!

9
Entering edit mode
5.9 years ago
asyavuz ▴ 130

Actually, I traced this error back to wateRmelon, due to relatively recent minfi update. Downgrading Biobase wouldn't work as minfi changed their base objects for RGChannelSet, MethylSet, and RatioSet from eSet to SummarizedExperiment starting from v1.21, some of the inherited functions are changed. One of them is assayData and assayDataElement.

Beadcount filtering uses beadcount function from wateRmelon, which tries to obtain this data with an assayDataElement function call. If this filtering is critical to you, I assume you can downgrade everything, or you can change the wateRmelon source code accordingly to use with the latest minfi. Only thing you need to do is at pfilter.R change

  assayDataElement(x, "NBeads")->nb


at line 23, to

  getNBeads(x)->nb


and

bc_temp[TypeII.Name, ] <- nbcg[getProbeInfo(x, type = "II")$Address,]  at line 41, to bc_temp[TypeII.Name, ] <- nbcg[getProbeInfo(x, type = "II")$AddressA,]


After these changes you can install your customised wateRmelon and load your data with ChAMP. For other functionality provided by wateRmelon, you may need to perform some more alterations. I notified Prof. Schalkwyk (maintainer of wateRmelon) regarding this incompatibility.

Hope this helps!

2
Entering edit mode

Just to let you know that I did this and it actually works. Both ChAMP and wateRmelon got a new update a few days ago but the problem persists. Tweaking the pfilter.R as you suggested solves the problem though. Thank you very much for your awesome solution! :)

1
Entering edit mode

That's a goldmine of info. Thank you!

0
Entering edit mode

That's great! Thank you very much for this. I will try it again later but I am sure it will work! :)

4
Entering edit mode
5.9 years ago
mac ▴ 70

I emailed the developer who said that it is a known problem with the latest version of minfi conflicting with Biobase and suggested downgrading Biobase (which didn't work).

For anyone having the same problem, what solved it was installing R 3.2.2 with Biobase 3.4, minfi 1.20.2 and ChAMP 2.6.4. Not ideal but at least it is functional now.

Thank you very much both Santosh Anand and vchris_ngs. I really appreciate your time and effort in trying to help me.

Hopefully it will be resolved soon. :)

1
Entering edit mode

Oh, so happy that you found a workaround solution! Go ahead and you may accept (tick mark sign to the left) your this answer to close this thread .

0
Entering edit mode

Glad that it worked. Yes I would have told to contact Andrew T and the guy who developed ChAMP since they are pretty helpful. I remember now this problem of the Biobase someone reporting it. But it flipped my mind. Downgrading R was actually fine. I actually upgraded from 3.1 to 3.2 which worked for me then. Now am upgraded to 3.4 but have not really worked with ChAMP so probably I will also face the same issue. Thanks for pointing it out but I hope the author's and developers work on it else for publication purpose one cannot work in different versions of R. Rather do everything in one version.

3
Entering edit mode
5.9 years ago

I think, I know the problem now. It is due to the latest release of minfi package. You may try this (in a fresh R)

# Dload the minfi, v1.20.2
http://bioconductor.org/packages/3.4/bioc/src/contrib/minfi_1.20.2.tar.gz

# install this version using
install.packages("minfi_1.20.2.tar.gz", type="source")

# Load the CHAMP package. Run sessionInfo() to check that you have the 1.20.2 version of minfi loaded.


0
Entering edit mode

It is a problem of the dependencies. OP need to restart a session and then install the dependencies. If the ChAMP is not working with test data then definitely it is a problem related to the packages it needs. I have used ChAMP so I am aware of it. Try to see which version of minfi it is using in the versions mentioned then you can download the old one and reload ChAMP and try to run test run of it on its supplied data.

0
Entering edit mode

Apologies for not replying earlier but as a new user I am limited in the number of posts I can make.

I updated R to version 3.4 patched as I was getting this error when I tried to downgrade minfi as suggested.

I then reinstalled bioconductor and ChAMP. I also tried to install all dependencies manually to ensure everything is OK by running:

biocLite(c("minfi","ChAMP","ChAMPdata","Illumina450ProbeVariants.db","sva","IlluminaHumanMethylation450kmanifest","limma","RPMM","DNAcopy","preprocessCore","impute","marray","wateRmelon","goseq","plyr","GenomicRanges","RefFreeEWAS","qvalue","isva","doParallel","bumphunter","quadprog","shiny","shinythemes","plotly","RColorBrewer","DMRcate","dendextend","IlluminaHumanMethylationEPICmanifest","FEM","matrixStats"), dependencies = TRUE)


After this, half of available packages on bioconductor were installed(!)

I run the test dataset and I got the same error as before.

Then I uninstalled minfi and installed version 1.20.2 as suggested above. Now I got the following different error:

> testDir=system.file("extdata",package="ChAMPdata")
[===========================]
-----------------------------
[read.metharray.sheet] Found the following CSV files:

[1] "C:/Program Files/R/R-3.4.0patched/library/ChAMPdata/extdata/lung_test_set.csv"

The fraction of failed positions per sample

(You may need to delete samples with high proportion of failed probes
):
Failed CpG Fraction.
C1         0.0013429122
C2         0.0022162171
C3         0.0003563249
C4         0.0002842360
T1         0.0003831007
T2         0.0011946152
T3         0.0014953286
T4         0.0015447610
Filtering probes with a detection p-value above 0.01 in one or more samples has removed 2728 probes from the analysis. If a large number of probes have been removed, ChAMP suggests you to identify potentially bad samples.
<< Filter DetP Done. >>

Error in bc_temp[TypeII.Name, ] <- nbcg[getProbeInfo(x, type = "II")\$Address,  :
replacement has length zero


Same when I run my own dataset.

Each attempt was performed in a fresh R session

Installing old minfi, running the test data (with the error) and the sessioninfo() with the old minfi is here https://pastebin.com/6XdXRb8q

Lastly, I installed the devel version of bioconductor and updated all packages to the devel level. I got the same error as in my first post. sessioninfo() here https://pastebin.com/1hLpaBWN

1
Entering edit mode

This is getting more complicated than I thought. Let's make some conclusions to better focus in right direction

1. minfi_1.20.2 doesn't show the original error in the OP. So it is surely the culprit
2. minfi_1.20.2 does show another error. So this is not the solution (at least on your R. I have an old version of R/BioConductor where everything works smoothly).
3. Upgrading everything to devel version gives the same error as the OP => In devel version, minfi has not been patched yet. And moreover, it is not a good idea to run devel version, also given that there are so many dependencies Devel might not be the well tested and stable.

Now, options from here:

1. Try other versions of minfi: between what you have tried and the current version.
2. Downgrade R/Bioconductor. You can always install an older version of R in a separate directory. Install ChAMP locally, by giving lib option to install.packages()

Do everything on Mac. On Windows, there can be yet other unexpected surprises. Good luck!!!

2
Entering edit mode
5.8 years ago
Tian ▴ 50

Hello Guys:

I am the developer of ChAMP, I just fixed this problem by recoded another champ.load() function. The old problem are indeed caused by wateRmelon package failed to extract minfi's rgSet result. And I don't have authority to fix that. So I would rather code another new load function myself.

The new version ChAMP (version 2.8.2) has been relased, which added a new parameter "method" in champ.load() function, you can set it as "ChAMP" to use my loading function, or set it as "minfi" to use old minfi's loading function (but which might be stopped in bead filtering part).

https://bioconductor.org/packages/release/bioc/html/ChAMP.html

In theory, the two method should return the same result, but in practice, only 450K array's result is the same, for EPIC array, since I used latest B4 manifest (relased last week) from illumina. The loading result from champ.load() would be slightly different from old minfi's method, but just slightly different.

Note that new ChAMP also need new ChAMPdata package. Well, I have to include annotation to load right? But now the thing I am still struggle is I have uploaded new ChAMPdata packgae to bioconductor ,seems it has not check and release it.

I have no choice but currently give out a bitbucket link so that you can directly download it from my bitbucket and install ChAMPdata package.

https://bitbucket.org/JoshuaTian/champdata/src

Best

Yuan Tian

0
Entering edit mode

Hey Yuan,

Thank you very much for updating ChAMP and for trying to deal with this bug.

Now, using the method = "ChAMP" as you suggested, I get this error

data.dir <- file.path("D:/data/")


Output

[===========================]
[<<<< ChAMP.IMPORT START >>>>>]
-----------------------------

[ Section 1: Read PD Files Start ]
CSV Directory: D:/data/samplesheet.csv
Find CSV Success
Error in if (skip > 0L) readLines(file, skip) :
argument is of length zero


I have installed the new version of ChAMP data as you suggested

> sessionInfo()
R version 3.4.0 Patched (2017-06-09 r72776)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

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

other attached packages:
[1] doParallel_1.0.10                          ChAMP_2.8.2
[3] IlluminaHumanMethylationEPICmanifest_0.3.0 Illumina450ProbeVariants.db_1.12.0
[5] DMRcate_1.12.1                             DMRcatedata_1.12.0
[7] DSS_2.16.0                                 bsseq_1.12.1
[9] FEM_3.4.0                                  graph_1.54.0
[11] org.Hs.eg.db_3.4.1                         impute_1.50.1
[13] igraph_1.0.1                               corrplot_0.77
[15] marray_1.54.0                              limma_3.32.2
[17] Matrix_1.2-10                              AnnotationDbi_1.38.1
[19] ChAMPdata_2.8.2                            minfi_1.22.1
[21] bumphunter_1.16.0                          locfit_1.5-9.1
[23] iterators_1.0.8                            foreach_1.4.3
[25] Biostrings_2.44.1                          XVector_0.16.0
[27] SummarizedExperiment_1.6.3                 DelayedArray_0.2.7
[29] matrixStats_0.52.2                         Biobase_2.36.2
[31] GenomicRanges_1.28.3                       GenomeInfoDb_1.12.2
[33] IRanges_2.10.2                             S4Vectors_0.14.3
[35] BiocGenerics_0.22.0

0
Entering edit mode

I get the exact same error message:

[===========================]

Note that ChAMP method will NOT return rgSet or mset, they object defined by minfi. Which means, if you use ChAMP method to load data, you can not use SWAN or FunctionNormliazation method in champ.norm() (you can use BMIQ or PBC still). But All other function should not be influenced.

[===========================]

## [<<<< ChAMP.IMPORT START >>>>>]

[ Section 1: Read PD Files Start ] CSV Directory: %MyDir% Find CSV Success Reading CSV File Error in if (skip > 0L) readLines(file, skip) : argument is of length zero

Is it a new minfi error?