Skip to content

Commit

Permalink
Remove obsolete and broken customClusters methods.
Browse files Browse the repository at this point in the history
Closes #113
  • Loading branch information
Charles Plessy committed May 10, 2024
1 parent 93d2fb1 commit 2d3c730
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 35 deletions.
9 changes: 8 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Changes in version 2.8.0
# Changes in version 2.11.1

BUG FIXES

- Remove broken and obsolete `customClusters` method of `clusterCTSS`. Use
`CustomConsensusClusters()` instead.

# Changes in version 2.8.0 (25/10/2023)

BUG FIXES

Expand Down
28 changes: 8 additions & 20 deletions R/ClusteringMethods.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@
#' @param thresholdIsTpm Logical indicating if `threshold` is expressed in
#' raw tag counts (`FALSE`) or normalized signal (`TRUE`).
#'
#' @param method Method to be used for clustering: `"distclu"`,
#' `"paraclu"` or `"custom"`. See Details.
#' @param method Method to be used for clustering: `"distclu"` or `"paraclu"`.
#' See Details.
#'
#' @param maxDist Maximal distance between two neighbouring CTSSs for them to be
#' part of the same cluster. Used only when `method = "distclu"`,
#' otherwise ignored.
#'
#' @param removeSingletons Logical indicating if tag clusters containing only
#' one CTSS be removed. Ignored when `method = "custom"`.
#' one CTSS be removed.
#'
#' @param keepSingletonsAbove Controls which singleton tag clusters will be
#' removed. When `removeSingletons = TRUE`, only singletons with signal
#' `< keepSingletonsAbove` will be removed. Useful to prevent removing
#' highly supported singleton tag clusters. Default value `Inf` results
#' in removing all singleton TCs when `removeSingletons = TRUE`. Ignored
#' when `method = "custom"`.
#' in removing all singleton TCs when `removeSingletons = TRUE`.
#'
#' @param minStability Minimal stability of the cluster, where stability is
#' defined as ratio between maximal and minimal density value for which
Expand All @@ -40,18 +39,12 @@
#' `< minStability` will be discarded. Used only when `method = "paraclu"`.
#'
#' @param maxLength Maximal length of cluster in base-pairs. Clusters with length
#' `> maxLength` will be discarded. Ignored when `method = "custom"`.
#' `> maxLength` will be discarded.
#'
#' @param reduceToNonoverlapping Logical, should smaller clusters contained
#' within bigger cluster be removed to make a final set of tag clusters
#' non-overlapping. Used only `method = "paraclu"`.
#'
#' @param customClusters Genomic coordinates of predefined regions to be used to
#' segment the CTSSs. The format is either a [`GRanges`] object or a
#' [`data.frame`] with the following columns: `chr` (chromosome name),
#' `start` (0-based start coordinate), `end` (end coordinate), `strand`
#' (either `"+"`, or `"-"`). Used only when `method = "custom"`.
#'
#' @param useMulticore Logical, should multicore be used. `useMulticore = TRUE`
#' has no effect on non-Unix-like platforms.
#'
Expand Down Expand Up @@ -116,7 +109,7 @@ setGeneric( "clusterCTSS"
, method = c("distclu", "paraclu", "custom"), maxDist = 20
, removeSingletons = FALSE, keepSingletonsAbove = Inf
, minStability = 1, maxLength = 500
, reduceToNonoverlapping = TRUE, customClusters = NULL
, reduceToNonoverlapping = TRUE
, useMulticore = FALSE, nrCores = NULL)
standardGeneric("clusterCTSS"))

Expand All @@ -125,7 +118,7 @@ setGeneric( "clusterCTSS"
setMethod( "clusterCTSS", "CAGEexp"
, function( object, threshold, nrPassThreshold, thresholdIsTpm, method, maxDist
, removeSingletons, keepSingletonsAbove, minStability, maxLength
, reduceToNonoverlapping, customClusters, useMulticore, nrCores) {
, reduceToNonoverlapping, useMulticore, nrCores) {

assay <- ifelse(isTRUE(thresholdIsTpm), "normalizedTpmMatrix", "counts")
data <- CTSStagCountSE(object)
Expand Down Expand Up @@ -156,12 +149,7 @@ setMethod( "clusterCTSS", "CAGEexp"
, reduceToNonoverlapping = reduceToNonoverlapping
, useMulticore = useMulticore, nrCores = nrCores)
} else if(method == "custom") {
if(is.null(customClusters))
stop(sQuote("customClusters"), " must be given when method = ", sQuote("custom"), ".")
ctss.cluster.list <- .predefined.clusters( data = data[decode(filteredCTSSidx(object)),]
, sample.labels = sampleLabels(object)
, custom.clusters = customClusters
, useMulticore = useMulticore, nrCores = nrCores)
stop("Deprecated method. See ", dQuote("CustomConsensusClusters()"), " instead.")
}

CTSSclusteringMethod(ctss.cluster.list) <- method
Expand Down
19 changes: 5 additions & 14 deletions man/clusterCTSS.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d3c730

Please sign in to comment.