Skip to content

Commit

Permalink
fixed limit pass
Browse files Browse the repository at this point in the history
  • Loading branch information
plger committed Dec 6, 2024
1 parent 6e6cb7b commit c468478
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: epiwraps
Type: Package
Title: epiwraps: Wrappers for plotting and dealing with epigenomics data
Version: 0.99.100
Version: 0.99.101
Date: 2024-10-24
Authors@R: c(
person("Pierre-Luc", "Germain", email="[email protected]",
Expand Down
18 changes: 16 additions & 2 deletions R/signal2Matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ signal2Matrix <- function(filepaths, regions, extend=2000, w=NULL, scaling=TRUE,

####### BIGWIG OR COVERAGE INPUT

# since as.normalizedMatrix doesn't have all the args of normalizeToMatrix
args <- list(...)
def_args <- list(background=NA, smooth_fun=default_smooth_fun,
keep=c(0,1), limit=NULL, flip_upstream=FALSE)
for(f in names(def_args)){
if(is.null(args[[f]])) args[[f]] <- def_args[[f]]
}
if(type=="scaled"){
upstream <- .getBinSignalFromBW(co, upstream, w=w,
method=binMethod, verbose=verbose)
Expand All @@ -209,15 +216,22 @@ signal2Matrix <- function(filepaths, regions, extend=2000, w=NULL, scaling=TRUE,
mat <- cbind(upstream, mat, downstream)
row.names(mat) <- names(regions2)
mat <- EnrichedHeatmap::as.normalizedMatrix(unclass(mat), extend=extend,
signal_name=filename, k_target=scaledBins, ...,
signal_name=filename, k_target=scaledBins, keep=args$keep,
smooth_fun=args$smooth_fun, flip_upstream=args$flip_upstream,
limit=args$limit, background=args$background,
k_upstream=extend[[1]]/w, k_downstream=extend[[2]]/w )
}else{
mat <- .getBinSignalFromBW(co, regions2, w=w,
method=binMethod, verbose=verbose)
mat <- EnrichedHeatmap::as.normalizedMatrix(unclass(mat), extend=extend,
signal_name=filename, k_target=0L, ...,
signal_name=filename, k_target=0L, keep=args$keep,
smooth_fun=args$smooth_fun, flip_upstream=args$flip_upstream,
limit=args$limit, background=args$background,
k_upstream=extend[[1]]/w, k_downstream=extend[[2]]/w )
}
if(!is.null(args$limit))
mat[mat<min(args$limit)] <- min(args$limit)
mat[mat>max(args$limit)] <- max(args$limit)
}

rm(co)
Expand Down

0 comments on commit c468478

Please sign in to comment.