Skip to content

Commit

Permalink
Subsampling for reporting and plotting methylation values distributio…
Browse files Browse the repository at this point in the history
…ns in filtering

report to reduce memory footprint.

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/RnBeads@114320 bc3139a8-67e5-0310-9ffc-ced21a209358
  • Loading branch information
f.mueller committed Mar 7, 2016
1 parent 1990526 commit a48edfd
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Authors@R: c(
role = c("aut")),
person("Fabian", "Mueller", email = "[email protected]",
role = c("aut", "cre")))
Date: 2016-01-13
Version: 1.3.6
Date: 2016-03-07
Version: 1.3.7
Suggests:
Category,
GEOquery,
Expand Down
30 changes: 29 additions & 1 deletion R/filteringSummary.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,35 @@ rnb.step.filter.summary.internal <- function(rnb.set, removed.samples, removed.s
logger.status("Added summary table of removed and retained items")

## Construct vectors of removed and retained betas
mm <- meth(rnb.set)
siteInds <- NULL
# subsample sites from removed and retained sites in order to reduce memory footprint
if (rnb.getOption("distribution.subsample") > 1){
numSites <- rnb.getOption("distribution.subsample")
if (length(removed.sites) != 0) {
if (length(removed.sites) > numSites){
siteInds <- sort(sample(removed.sites, size=numSites))
} else {
siteInds <- removed.sites
}
retained.sites <- setdiff(1:nsites(rnb.set), removed.sites)
if (length(retained.sites) > numSites){
siteInds <- sort(c(siteInds, sample(retained.sites, size=numSites)))
} else {
siteInds <- sort(c(siteInds, retained.sites))
}
} else {
siteInds <- sort(sample.int(nsites(rnb.set), size=numSites))
}
}
if (!is.null(siteInds)){
logger.info(c("Subsampling", length(siteInds), "sites for plotting density distributions"))
# new site indices in subsampled set
indexMap <- rep(NA, nsites(rnb.set))
indexMap[siteInds] <- 1:length(siteInds)
removed.sites <- na.omit(indexMap[removed.sites])
}

mm <- meth(rnb.set, i=siteInds)
if (length(removed.samples) != 0) {
betas.removed <- as.vector(mm[, removed.samples])
mm <- mm[, -removed.samples]
Expand Down
6 changes: 6 additions & 0 deletions inst/NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
RnBeads 1.3.7
=============

* Subsampling for reporting and plotting methylation values distributions in filtering
report to reduce memory footprint.

RnBeads 1.3.6
=============

Expand Down

0 comments on commit a48edfd

Please sign in to comment.