hansenlab / minfi

Devel repository for minfi
60 stars 70 forks source link

blockFinder() now supports DelayedArray-backed minfi objects with warning #160

Closed PeteHaitch closed 6 years ago

PeteHaitch commented 6 years ago

Support is preliminary and unoptimised. The entire meth signal matrix must be loaded into memory.

A proper implementation will require bumphunter to support DelayedArray instances.

The way it is currently, blockFinder() will give a warning if object is not matrix-backed. However, that warning gets kinda lost amongst the default verbose output of the function (see below).

@kasperdanielhansen: Would you prefer that blockFinder() returned an error if object is not matrix-backed or is this suitable?

suppressPackageStartupMessages(library(minfi))
object <- cpgCollapse(ratioConvert(mapToGenome(realize(minfiData::MsetEx))),
                      returnBlockInfo = FALSE)
#> [cpgCollapse] Creating annotation.
#> Loading required package: IlluminaHumanMethylation450kanno.ilmn12.hg19
#> [cpgCollapseAnnotation] Clustering islands and clusters of probes.
#> [cpgCollapseAnnotation] Computing new annotation.
#> [cpgCollapseAnnotation] Defining blocks.
#> [cpgCollapse] Collapsing data
#> .....
#> ........
#> ..........
#> .........
#> ........
#> ........
#> ..........
#> .......
#> .....
#> ......
#> ........
#> ...........
design <- model.matrix(~ gl(2, 3))
b <- blockFinder(object, 
                 design = design,
                 pickCutoff = TRUE,
                 B = 10)
#> Warning: Memory usage may be high because 'blockFinder()' is not yet
#> optimized for use with DelayedArray-backed minfi objects.
#> [bumphunterEngine] Using a single core (backend: doSEQ, version: 1.4.4).
#> [bumphunterEngine] Computing coefficients.
#> [bumphunterEngine] Smoothing coefficients.
#> Loading required package: rngtools
#> Loading required package: pkgmaker
#> Loading required package: registry
#> 
#> Attaching package: 'pkgmaker'
#> The following object is masked from 'package:S4Vectors':
#> 
#>     new2
#> The following objects are masked from 'package:base':
#> 
#>     isFALSE, isNamespaceLoaded
#> [bumphunterEngine] Performing 10 permutations.
#> [bumphunterEngine] Computing marginal permutation p-values.
#> [bumphunterEngine] Smoothing permutation coefficients.
#> [bumphunterEngine] cutoff: 0.196
#> [bumphunterEngine] Finding regions.
#> [bumphunterEngine] Found 40 bumps.
#> [bumphunterEngine] Computing regions for each permutation.
#> [bumphunterEngine] Estimating p-values and FWER.

Created on 2018-04-20 by the reprex package (v0.2.0).

PeteHaitch commented 6 years ago

Closing stale pull request. Will revisit this in #168.