Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export(adjustEnrichment)
export(aggHicMatrices)
export(aggMetadata)
export(as_ginteractions)
export(assignToBins)
export(binPairs)
export(binRanges)
export(calcLoopEnrichment)
export(changePixelRes)
export(clusters)
export(defaultBuffer)
export(end1)
export(end2)
export(getPairClusters)
export(hdf5BlockApply)
export(makeGInteractionsFromDataFrame)
export(makeRandomGInteractions)
Expand Down Expand Up @@ -52,12 +52,12 @@ export(selectTopRight)
export(selectionMethod)
export(seqnames1)
export(seqnames2)
export(sets)
export(shiftRanges)
export(snapToBins)
export(sources)
export(start1)
export(start2)
export(subsetBySource)
exportClasses(DelegatingGInteractions)
exportClasses(InteractionArray)
exportClasses(InteractionJaggedArray)
Expand All @@ -79,19 +79,19 @@ exportMethods(aggHicMatrices)
exportMethods(aggMetadata)
exportMethods(as.list)
exportMethods(as_ginteractions)
exportMethods(assignToBins)
exportMethods(binPairs)
exportMethods(binRanges)
exportMethods(calcLoopEnrichment)
exportMethods(cbind)
exportMethods(changePixelRes)
exportMethods(clusters)
exportMethods(colData)
exportMethods(countOverlaps)
exportMethods(counts)
exportMethods(dim)
exportMethods(end1)
exportMethods(end2)
exportMethods(findOverlaps)
exportMethods(getPairClusters)
exportMethods(hdf5BlockApply)
exportMethods(interactions)
exportMethods(length)
Expand Down Expand Up @@ -131,14 +131,14 @@ exportMethods(selectTopRight)
exportMethods(selectionMethod)
exportMethods(seqnames1)
exportMethods(seqnames2)
exportMethods(sets)
exportMethods(shiftRanges)
exportMethods(show)
exportMethods(snapToBins)
exportMethods(sources)
exportMethods(start1)
exportMethods(start2)
exportMethods(subsetByOverlaps)
exportMethods(subsetBySource)
import(data.table,
except = c(between, shift, first, second, indices))
import(methods)
Expand Down
18 changes: 9 additions & 9 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ setGeneric("makeGInteractionsFromDataFrame",
...)
standardGeneric("makeGInteractionsFromDataFrame"))

#' @rdname assignToBins
#' @rdname binPairs
#' @export
setGeneric("assignToBins",
setGeneric("binPairs",
function(x,
binSize,
pos1 = 'center',
pos2 = 'center',
...)
standardGeneric("assignToBins"))
standardGeneric("binPairs"))

#' @rdname binRanges
#' @export
Expand Down Expand Up @@ -63,22 +63,22 @@ setGeneric("mergePairs",
setGeneric("selectionMethod", function(x, ...)
standardGeneric("selectionMethod"))

#' @rdname clusters
#' @rdname getPairClusters
#' @export
setGeneric("clusters", function(x, ...)
standardGeneric("clusters"))
setGeneric("getPairClusters", function(x, ...)
standardGeneric("getPairClusters"))

#' @rdname sources
#' @export
setGeneric("sources", function(x)
standardGeneric("sources"))

#' @rdname sets
#' @rdname subsetBySource
#' @export
setGeneric("sets", function(x,
setGeneric("subsetBySource", function(x,
include,
exclude)
standardGeneric("sets"))
standardGeneric("subsetBySource"))

#' @rdname aggMetadata
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/methods-CountMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' setNames("WT") |>
#' read.table(header=TRUE) |>
#' as_ginteractions(keep.extra.columns=FALSE) |>
#' assignToBins(binSize=100e3)
#' binPairs(binSize=100e3)
#'
#' ## Removes the "chr" prefix for compatibility
#' ## with the preprocessed hic files
Expand Down
2 changes: 1 addition & 1 deletion R/methods-InteractionJaggedArray.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ setMethod("[", "InteractionJaggedArray", function(x, i, j) {
#' iarr <- pullHicMatrices(gi, hicFiles, 100e03, half="both")
#'
#' ## Shift first two ranges out of range
#' gi2 <- c(assignToBins(gi[1:2], binSize=100e3, pos1=-200e3), gi[3:4])
#' gi2 <- c(binPairs(gi[1:2], binSize=100e3, pos1=-200e3), gi[3:4])
#'
#' ## Find overlaps
#' findOverlaps(iarr, gi2)
Expand Down
2 changes: 1 addition & 1 deletion R/methods-MatrixSelection.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
abort(c(glue("All interactions in `x` must be \\
the same width."),
"i"="Check this with `width(x)`.",
"i"="Set binSize with `assignToBins(x, binSize)`."))
"i"="Set binSize with `binPairs(x, binSize)`."))
}
## How does moving down or right change dist to diag?
p <- pairdist(x)
Expand Down
78 changes: 39 additions & 39 deletions R/methods-MergedGInteractions.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ setMethod("aggMetadata", signature(x = "MergedGInteractions",
#' Access the names or source files of
#' a `MergedGInteractions` object.
#'
#' @inheritParams sets
#' @inheritParams subsetBySource
#' @return A character vector of names or source
#' files of a `MergedGInteractions` object.
#' @examples
Expand Down Expand Up @@ -198,7 +198,7 @@ setMethod("sources", "MergedGInteractions",
function(x) as.character(unique(x@allPairs$src)))

#' Create logial matrix of sources for each merged pair
#' @inheritParams sets
#' @inheritParams subsetBySource
#' @importFrom data.table data.table as.data.table
#' @importFrom stats setNames
#' @return A logical matrix with columns for each source
Expand Down Expand Up @@ -241,7 +241,7 @@ setMethod("sources", "MergedGInteractions",
}

#' Check source names
#' @inheritParams sets
#' @inheritParams subsetBySource
#' @param vec Input character vector (i.e. include, exclude or both)
#' @importFrom glue glue glue_collapse double_quote
#' @importFrom rlang abort
Expand All @@ -264,11 +264,11 @@ setMethod("sources", "MergedGInteractions",
}

#' Find subset pairs using include and exclude sources
#' @inheritParams sets
#' @inheritParams subsetBySource
#' @importFrom data.table data.table
#' @return A `MergedGInteractions` object of subset pairs.
#' @noRd
.setsIncludeExclude <- function(x, include, exclude) {
.subsetBySourceIncludeExclude <- function(x, include, exclude) {

## Check source names
.checkSourceNames(x, vec = c(include, exclude))
Expand All @@ -286,11 +286,11 @@ setMethod("sources", "MergedGInteractions",
}

#' Find subset pairs using include sources
#' @inheritParams sets
#' @inheritParams subsetBySource
#' @importFrom data.table data.table
#' @return A `MergedGInteractions` object of subset pairs.
#' @noRd
.setsInclude <- function(x, include) {
.subsetBySourceInclude <- function(x, include) {

## Check source names
.checkSourceNames(x, vec = include)
Expand All @@ -306,11 +306,11 @@ setMethod("sources", "MergedGInteractions",
}

#' Find subset pairs using exclude sources
#' @inheritParams sets
#' @inheritParams subsetBySource
#' @importFrom data.table data.table
#' @return A `MergedGInteractions` object of subset pairs.
#' @noRd
.setsExclude <- function(x, exclude) {
.subsetBySourceExclude <- function(x, exclude) {

## Check source names
.checkSourceNames(x, vec = exclude)
Expand All @@ -331,7 +331,7 @@ setMethod("sources", "MergedGInteractions",
#' @importFrom utils combn
#' @return A `MergedGInteractions` object of de novo pairs.
#' @noRd
.sets <- function(x) {
.subsetBySource <- function(x) {

## Calculate the src matrix
srcMat <- .makeSrcMatrix(x)
Expand Down Expand Up @@ -374,9 +374,9 @@ setMethod("sources", "MergedGInteractions",
}) |> unlist()
names(idxList) <- srcNames

## Index the sets
sets <- lapply(idxList, \(i) x[i])
return(sets)
## Index the subsetBySource
subsetBySource <- lapply(idxList, \(i) x[i])
return(subsetBySource)
}

#' Get each set from a MergedGInteractions object
Expand All @@ -389,8 +389,8 @@ setMethod("sources", "MergedGInteractions",
#' merged pair is not returned.
#'
#' Optional `include` and `exclude` parameters modulate
#' the behavior of `sets` to return different
#' subsets of originating pairs. For example, `include` requires
#' the behavior of `subsetBySource` to return different
#' subsubsetBySource of originating pairs. For example, `include` requires
#' that the returned pairs be present in specific sources,
#' while `exclude` requires that returned pairs be absent
#' from specific sources. Sources not listed in either
Expand Down Expand Up @@ -435,47 +435,47 @@ setMethod("sources", "MergedGInteractions",
#' ## Merge pairs
#' x <- mergePairs(x = giList, radius = 20)
#'
#' sets(x)
#' subsetBySource(x)
#'
#' @rdname sets
#' @rdname subsetBySource
#' @export
setMethod("sets",
setMethod("subsetBySource",
signature(x = "MergedGInteractions",
include = "missing",
exclude = "missing"),
definition = .sets)
definition = .subsetBySource)

#' @rdname sets
#' @rdname subsetBySource
#' @export
setMethod("sets",
setMethod("subsetBySource",
signature(x = "MergedGInteractions",
include = "character_OR_missing",
exclude = "missing"),
definition = .setsInclude)
definition = .subsetBySourceInclude)

#' @rdname sets
#' @rdname subsetBySource
#' @export
setMethod("sets",
setMethod("subsetBySource",
signature(x = "MergedGInteractions",
include = "missing",
exclude = "character_OR_missing"),
definition = .setsExclude)
definition = .subsetBySourceExclude)

#' @rdname sets
#' @rdname subsetBySource
#' @export
setMethod("sets",
setMethod("subsetBySource",
signature(x = "MergedGInteractions",
include = "character_OR_missing",
exclude = "character_OR_missing"),
definition = .setsIncludeExclude)
definition = .subsetBySourceIncludeExclude)



#' Internal accessor function for clusters
#' @inheritParams clusters
#' Internal accessor function for getPairClusters
#' @inheritParams getPairClusters
#' @importFrom data.table data.table
#' @noRd
.clusters <- function(x) {
.getPairClusters <- function(x) {

## Suppress NSE notes in R CMD check
i.id <- NULL
Expand Down Expand Up @@ -533,16 +533,16 @@ setMethod("sets",
#' radius = 10e03,
#' column = "APScoreAvg")
#'
#' ## Access pair clusters
#' clusters(x[1:3])
#' clusters(x[3:1])
#' clusters(x[c(3, 1, 2)])
#' clusters(x) |> length()
#' ## Access pair getPairClusters
#' getPairClusters(x[1:3])
#' getPairClusters(x[3:1])
#' getPairClusters(x[c(3, 1, 2)])
#' getPairClusters(x) |> length()
#'
#' @rdname clusters
#' @rdname getPairClusters
#' @export
setMethod("clusters", signature(x = "MergedGInteractions"),
definition = .clusters)
setMethod("getPairClusters", signature(x = "MergedGInteractions"),
definition = .getPairClusters)

#' Get selectionMethod from MergedGInteractions object
#'
Expand Down
2 changes: 1 addition & 1 deletion R/methods-adjustEnrichment.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
#'
#' ## Calculate loop enrichment
#' enrich <- calcLoopEnrichment(
#' x=assignToBins(loops, 100e03),
#' x=binPairs(loops, 100e03),
#' files=hicFiles
#' )
#'
Expand Down
2 changes: 1 addition & 1 deletion R/methods-aggHicMatrices.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
#'
#' ## Expand pixel ranges with a 5 pixel buffer on either side
#' loops <-
#' assignToBins(loops, binSize=100e3) |>
#' binPairs(loops, binSize=100e3) |>
#' pixelsToMatrices(buffer=5)
#'
#' ## Extract 10, 11x11 count matrices from 2 hic files
Expand Down
Loading