Skip to content

Commit

Permalink
fixed error in scaled heatmap from GRanges/RleList
Browse files Browse the repository at this point in the history
  • Loading branch information
plger committed May 16, 2024
1 parent 3973d62 commit 91c3f5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: epiwraps
Type: Package
Title: epiwraps: Wrappers for plotting and dealing with epigenomics data
Version: 0.99.90
Date: 2024-04-29
Version: 0.99.91
Date: 2024-05-16
Authors@R: c(
person("Pierre-Luc", "Germain", email="pierre-luc.germain@hest.ethz.ch",
role=c("cre","aut"), comment=c(ORCID="0000-0003-3418-4218")),
Expand Down
2 changes: 2 additions & 0 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ head(paste(missingLvls, collapse=", "), 3))
if(is.list(tracks)) tracks <- tracks[[1]]
if(is(tracks, "GRanges")){
sl <- seqlengths(tracks)
}else if(is(tracks, "RleList")){
sl <- lengths(tracks)
}else if(.parseFiletypeFromName(tracks)=="bw"){
sl <- seqlengths(BigWigFile(tracks))
}else if(.parseFiletypeFromName(tracks)=="bam"){
Expand Down
8 changes: 4 additions & 4 deletions R/signal2Matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ signal2Matrix <- function(filepaths, regions, extend=2000, w=NULL, scaling=TRUE,
filepath <- filepaths[[filename]]
if(is(filepath, "GRanges")){
if(verbose) message("Computing signal from GRanges '", filename, "'...")
}else{
}else if(!is(filepath, "RleList")){
if(verbose) message("Reading ", filepath)
if(grepl("\\.rds$",filepath,ignore.case=TRUE))
filepath <- readRDS(filepath)
Expand All @@ -144,7 +144,7 @@ signal2Matrix <- function(filepaths, regions, extend=2000, w=NULL, scaling=TRUE,
if(is(filepath, "GRanges")){

####### GRanges INPUT
if(type=="scale"){
if(type=="scaled"){
target_ratio <- w*scaledBins/sum(extend)
mat <- normalizeToMatrix(filepath, regions, w=w, extend=extend,
value_column="score", mean_mode="absolute",
Expand All @@ -156,6 +156,8 @@ signal2Matrix <- function(filepaths, regions, extend=2000, w=NULL, scaling=TRUE,
}
####### END GRanges INPUT

}else if(is(filepath, "RleList")){
co <- filepath
}else if(grepl("\\.bam$",filepath,ignore.case=TRUE)){

####### BAM INPUT
Expand Down Expand Up @@ -188,8 +190,6 @@ signal2Matrix <- function(filepaths, regions, extend=2000, w=NULL, scaling=TRUE,
co <- rtracklayer::import(filepath, format="BigWig", as="RleList",
selection=BigWigSelection(readRegions))

}else if(is(filepath, "RleList")){
co <- filepath
}else{
stop("Unknown file format")
}
Expand Down

0 comments on commit 91c3f5a

Please sign in to comment.